Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
fix(admin): admin initialization is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yahortsaryk committed Jun 14, 2023
1 parent e6dc6ed commit 6b83898
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions bucket/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub mod ddc_bucket {
#[ink(storage)]
#[derive(SpreadAllocate, Default)]
pub struct DdcBucket {
perms: PermStore,
buckets: BucketStore,
buckets_perms: BucketsPermsStore,
bucket_params: ParamsStore,
Expand All @@ -70,7 +71,6 @@ pub mod ddc_bucket {
nodes: NodeStore,
node_params: ParamsStore,
accounts: AccountStore,
perms: PermStore,
network_fee: NetworkFeeStore,
committer_store: CommitterStore,
protocol_store: ProtocolStore,
Expand All @@ -84,16 +84,12 @@ pub mod ddc_bucket {
#[ink(constructor)]
pub fn new() -> Self {
ink_lang::utils::initialize_contract(|contract: &mut Self| {
let operator = Self::env().caller();

contract.committer_store.init(operator);
contract.protocol_store.init(operator, DEFAULT_BASIS_POINTS);

// Make the creator of this contract a super-admin.
let admin_id = Self::env().caller();
contract
.perms
.grant_permission(admin_id, &Permission::SuperAdmin);
// Make the creator of this contract a super-admin.
contract.perms.grant_permission(admin_id, &Permission::SuperAdmin);

contract.committer_store.init(admin_id);
contract.protocol_store.init(admin_id, DEFAULT_BASIS_POINTS);

// Reserve IDs 0.
let _ = contract.accounts.create_if_not_exist(AccountId::default());
Expand Down

0 comments on commit 6b83898

Please sign in to comment.