Skip to content

Commit 3fca979

Browse files
committed
evmc init data
1 parent 61415cc commit 3fca979

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

src/did/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ serde_json = { workspace = true }
3434
sha2 = { workspace = true }
3535
sha3 = { workspace = true }
3636
thiserror = { workspace = true }
37+
ic-log = { workspace = true }
3738

3839
[dev-dependencies]
3940
eth-signer = { path = "../eth-signer" }

src/did/src/init.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
use std::time::Duration;
2+
3+
use candid::{CandidType, Nat, Principal};
4+
use ic_log::LogSettings;
5+
use serde::Deserialize;
6+
7+
use crate::{H160, U256};
8+
9+
pub type GenesisAccount = (H160, Option<U256>);
10+
11+
/// These are the arguments which are taken by the evm canister init fn
12+
#[derive(Debug, Clone, CandidType, Deserialize)]
13+
pub struct EvmCanisterInitData {
14+
pub signature_verification_principal: Principal,
15+
pub min_gas_price: Nat,
16+
pub chain_id: u64,
17+
#[serde(default)]
18+
pub log_settings: Option<LogSettings>,
19+
#[serde(default)]
20+
pub permissions: Option<Vec<(Principal, Vec<Permission>)>>,
21+
#[serde(default)]
22+
pub transaction_processing_interval: Option<Duration>,
23+
/// Owner of the EVM Canister
24+
pub owner: Principal,
25+
/// Genesis accounts
26+
pub genesis_accounts: Vec<GenesisAccount>,
27+
/// Coinbase address
28+
pub coinbase: H160,
29+
}
30+
31+
/// Principal specific permission
32+
#[derive(
33+
Debug, Clone, CandidType, Deserialize, Hash, PartialEq, Eq, PartialOrd, Ord, serde::Serialize,
34+
)]
35+
pub enum Permission {
36+
/// Gives administrator permissions
37+
Admin,
38+
/// Allows calling the endpoints to read the logs and get runtime statistics
39+
ReadLogs,
40+
/// Allows calling the endpoints to set the logs configuration
41+
UpdateLogsConfiguration,
42+
/// Allows caller to update blockchain history
43+
UpdateBlockchain,
44+
}

src/did/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub mod error;
1111
pub mod gas;
1212
pub mod hash;
1313
pub mod ic;
14+
pub mod init;
1415
pub mod integer;
1516
pub mod keccak;
1617
pub mod mint_order_exemption;

0 commit comments

Comments
 (0)