Skip to content

Commit

Permalink
Clean roles for eth-client contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
karim-en committed Oct 27, 2023
1 parent 87c161b commit 6208abe
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions contracts/near/eth-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,22 @@ pub struct HeaderInfo {
#[serde(crate = "near_sdk::serde")]
pub enum Role {
PauseManager,
UpgradableManager,
UpgradableCodeStager,
UpgradableCodeDeployer,
UpgradableDurationManager,
ConfigManager,
UnrestrictedAddBlockHeader,
DAO,
}

#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize, PanicOnDefault, Pausable, Upgradable)]
#[access_control(role_type(Role))]
#[pausable(manager_roles(Role::PauseManager))]
#[upgradable(access_control_roles(
code_stagers(Role::UpgradableCodeStager, Role::UpgradableManager),
code_deployers(Role::UpgradableCodeDeployer, Role::UpgradableManager),
duration_initializers(Role::UpgradableDurationManager, Role::UpgradableManager),
duration_update_stagers(Role::UpgradableDurationManager, Role::UpgradableManager),
duration_update_appliers(Role::UpgradableDurationManager, Role::UpgradableManager),
code_stagers(Role::UpgradableCodeStager, Role::DAO),
code_deployers(Role::UpgradableCodeDeployer, Role::DAO),
duration_initializers(Role::DAO),
duration_update_stagers(Role::DAO),
duration_update_appliers(Role::DAO),
))]
pub struct EthClient {
/// Whether client validates the PoW when accepting the header. Should only be set to `false`
Expand Down Expand Up @@ -252,7 +250,7 @@ impl EthClient {
self.record_header(header);
}

#[access_control_any(roles(Role::ConfigManager))]
#[access_control_any(roles(Role::DAO))]
pub fn update_trusted_signer(&mut self, trusted_signer: Option<AccountId>) {
self.trusted_signer = trusted_signer;
}
Expand All @@ -261,7 +259,7 @@ impl EthClient {
self.trusted_signer.clone()
}

#[access_control_any(roles(Role::ConfigManager))]
#[access_control_any(roles(Role::DAO))]
pub fn update_dags_merkle_roots(
&mut self,
#[serializer(borsh)] dags_start_epoch: u64,
Expand Down

0 comments on commit 6208abe

Please sign in to comment.