Skip to content

Commit

Permalink
Add authorization for EVM contract deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jberci committed Jul 26, 2024
1 parent 32d31b3 commit 1d5d9b4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ impl module_evm::Config for Config {
const CONFIDENTIAL: bool = true;
}

#[allow(clippy::declare_interior_mutable_const)]
impl modules::access::Config for Config {
const METHOD_AUTHORIZATIONS: Lazy<modules::access::types::Authorization> = Lazy::new(|| {
modules::access::types::Authorization::with_filtered_methods([(
"evm.Create",
modules::access::types::MethodAuthorization::allow_from([Address::from_bech32(
"oasis1qryqqccycvckcxp453tflalujvlf78xymcdqw4vz",
)
.unwrap()]),
)])
});
}

/// The EVM ParaTime.
pub struct Runtime;

Expand Down Expand Up @@ -142,6 +155,8 @@ impl sdk::Runtime for Runtime {
modules::consensus_accounts::Module<modules::consensus::Module>,
// EVM.
module_evm::Module<Config>,
// Access control module.
modules::access::Module<Config>,
);

fn trusted_signers() -> Option<TrustedSigners> {
Expand Down Expand Up @@ -284,6 +299,7 @@ impl sdk::Runtime for Runtime {
gas_costs: module_evm::GasCosts {},
},
},
(), // Access module.
)
}

Expand Down

0 comments on commit 1d5d9b4

Please sign in to comment.