diff --git a/pallets/ddc-accounts/src/lib.rs b/pallets/ddc-accounts/src/lib.rs index 9e892a90e..1f24c4449 100644 --- a/pallets/ddc-accounts/src/lib.rs +++ b/pallets/ddc-accounts/src/lib.rs @@ -53,12 +53,6 @@ pub struct BucketsDetails { pub amount: Balance, } -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] -pub struct ReceiverDetails { - cdn_owner: AccountId, - amount: Balance, -} - #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct AccountsLedger { /// The stash account whose balance is actually locked and can be used for CDN usage. @@ -251,6 +245,9 @@ pub mod pallet { #[pallet::call] impl Pallet { + /// Create new bucket with provided public availability & reserved resources + /// + /// Anyone can create a bucket #[pallet::weight(10_000)] pub fn create_bucket( origin: OriginFor, @@ -309,7 +306,6 @@ pub mod pallet { let stash_balance = ::Currency::free_balance(&stash); let value = value.min(stash_balance); - Self::deposit_event(Event::::Deposited(stash.clone(), value)); let item = AccountsLedger { stash: stash.clone(), total: value, @@ -317,6 +313,7 @@ pub mod pallet { unlocking: Default::default(), }; Self::update_ledger_and_deposit(&stash, &controller, &item)?; + Self::deposit_event(Event::::Deposited(stash.clone(), value)); Ok(()) } diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index 134d45a78..f355c3d8a 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -528,15 +528,15 @@ pub mod pallet { let stash_balance = T::Currency::free_balance(&stash); let value = value.min(stash_balance); - Self::deposit_event(Event::::Bonded(stash.clone(), value)); let item = StakingLedger { - stash, + stash: stash.clone(), total: value, active: value, chilling: Default::default(), unlocking: Default::default(), }; Self::update_ledger(&controller, &item); + Self::deposit_event(Event::::Bonded(stash, value)); Ok(()) } diff --git a/pallets/ddc-validator/src/lib.rs b/pallets/ddc-validator/src/lib.rs index 2fca6f69e..3658306da 100644 --- a/pallets/ddc-validator/src/lib.rs +++ b/pallets/ddc-validator/src/lib.rs @@ -422,8 +422,8 @@ pub mod pallet { ); ensure!( - staking::Validators::::contains_key(Self::get_stash_for_ddc_validator( - &ddc_valitor_key).unwrap() + staking::Validators::::contains_key( + Self::get_stash_for_ddc_validator(&ddc_valitor_key).unwrap() ), Error::::NotValidatorStash ); @@ -440,14 +440,14 @@ pub mod pallet { ValidationDecisions::::insert(era, cdn_node.clone(), validation_decision.clone()); + ValidationDecisionSetForNode::::insert(era, cdn_node.clone(), true); + Self::deposit_event(Event::::ValidationDecision( era, - cdn_node.clone(), + cdn_node, validation_decision, )); - ValidationDecisionSetForNode::::insert(era, cdn_node, true); - Ok(()) } @@ -475,8 +475,8 @@ pub mod pallet { ); ensure!( - staking::Validators::::contains_key(Self::get_stash_for_ddc_validator( - &ddc_valitor_key).unwrap() + staking::Validators::::contains_key( + Self::get_stash_for_ddc_validator(&ddc_valitor_key).unwrap() ), Error::::NotValidatorStash ); @@ -527,8 +527,8 @@ pub mod pallet { ); ensure!( - staking::Validators::::contains_key(Self::get_stash_for_ddc_validator( - &ddc_valitor_key).unwrap() + staking::Validators::::contains_key( + Self::get_stash_for_ddc_validator(&ddc_valitor_key).unwrap() ), Error::::NotValidatorStash ); @@ -546,8 +546,8 @@ pub mod pallet { } /// Exstrinsic registers a ddc validator key for future use - /// - /// Only controller of validator can call this exstrinsic + /// + /// Only controller of validator can call this exstrinsic /// Validator has to be in the active set #[pallet::weight(100_000)] pub fn set_validator_key(