difftreelog
minimal deposit for staking increased to 100 , added impl for `payout_stakers`.
in: master
3 files changed
pallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/benchmarking.rs
+++ b/pallets/app-promotion/src/benchmarking.rs
@@ -36,7 +36,8 @@
benchmarks! {
where_clause{
where T: Config + pallet_unique::Config + pallet_evm_migration::Config ,
- T::BlockNumber: From<u32>
+ T::BlockNumber: From<u32> + Into<u32>,
+ <<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum + From<u128>
}
start_app_promotion {
@@ -73,16 +74,16 @@
let _ = <T as Config>::Currency::make_free_balance_be(&caller, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;
- } : {PromototionPallet::<T>::unstake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?}
+ } : {PromototionPallet::<T>::unstake(RawOrigin::Signed(caller.clone()).into())?}
- recalculate_stake {
- let caller = account::<T::AccountId>("caller", 0, SEED);
- let share = Perbill::from_rational(1u32, 10);
- let _ = <T as Config>::Currency::make_free_balance_be(&caller, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
- let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;
- let block = <T::RelayBlockNumberProvider as BlockNumberProvider>::current_block_number();
- let mut acc = <BalanceOf<T>>::default();
- } : {PromototionPallet::<T>::recalculate_stake(&caller, block, share * <T as Config>::Currency::total_balance(&caller), &mut acc)}
+ // recalculate_and_insert_stake{
+ // let caller = account::<T::AccountId>("caller", 0, SEED);
+ // let share = Perbill::from_rational(1u32, 10);
+ // let _ = <T as Config>::Currency::make_free_balance_be(&caller, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
+ // let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;
+ // let block = <T::RelayBlockNumberProvider as BlockNumberProvider>::current_block_number();
+ // let mut acc = <BalanceOf<T>>::default();
+ // } : {PromototionPallet::<T>::recalculate_and_insert_stake(&caller, block, share * <T as Config>::Currency::total_balance(&caller), &mut acc)}
sponsor_collection {
let pallet_admin = account::<T::AccountId>("admin", 0, SEED);
pallets/app-promotion/src/lib.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -191,12 +191,12 @@
pub type NextInterestBlock<T: Config> =
StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
- /// Stores the address of the staker for which the last revenue recalculation was performed.
+ /// Stores hash a record for which the last revenue recalculation was performed.
/// If `None`, then recalculation has not yet been performed or calculations have been completed for all stakers.
#[pallet::storage]
- #[pallet::getter(fn get_last_calculated_staker)]
- pub type LastCalcucaltedStaker<T: Config> =
- StorageValue<Value = T::AccountId, QueryKind = OptionQuery>;
+ #[pallet::getter(fn get_next_calculated_record)]
+ pub type NextCalculatedRecord<T: Config> =
+ StorageValue<Value = (T::AccountId, T::BlockNumber), QueryKind = OptionQuery>;
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
@@ -259,8 +259,8 @@
#[pallet::call]
impl<T: Config> Pallet<T>
where
- T::BlockNumber: From<u32>,
- <<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum + From<u128>
+ T::BlockNumber: From<u32> + Into<u32>,
+ <<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum + From<u128>,
{
#[pallet::weight(T::WeightInfo::set_admin_address())]
pub fn set_admin_address(origin: OriginFor<T>, admin: T::CrossAccountId) -> DispatchResult {
@@ -312,9 +312,11 @@
#[pallet::weight(T::WeightInfo::stake())]
pub fn stake(staker: OriginFor<T>, amount: BalanceOf<T>) -> DispatchResult {
let staker_id = ensure_signed(staker)?;
-
- ensure!(amount >= Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get(), ArithmeticError::Underflow);
+ ensure!(
+ amount >= Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get(),
+ ArithmeticError::Underflow
+ );
let balance =
<<T as Config>::Currency as Currency<T::AccountId>>::free_balance(&staker_id);
@@ -365,7 +367,7 @@
amount
})
.sum();
-
+
let block =
T::RelayBlockNumberProvider::current_block_number() + T::PendingInterval::get();
<PendingUnstake<T>>::insert(
@@ -374,9 +376,13 @@
.checked_add(&total_staked)
.ok_or(ArithmeticError::Overflow)?,
);
-
- TotalStaked::<T>::set(TotalStaked::<T>::get().checked_sub(&total_staked).ok_or(ArithmeticError::Underflow)?); // when error we should recover stake state for the staker
+ TotalStaked::<T>::set(
+ TotalStaked::<T>::get()
+ .checked_sub(&total_staked)
+ .ok_or(ArithmeticError::Underflow)?,
+ ); // when error we should recover initial stake state for the staker
+
Ok(None.into())
// let staker_id = ensure_signed(staker)?;
@@ -511,16 +517,64 @@
admin_id == Admin::<T>::get().ok_or(Error::<T>::AdminNotSet)?,
Error::<T>::NoPermission
);
-
- let raw_key = Staked::<T>::hashed_key_for((admin_id, T::BlockNumber::default()));
-
- let key_iterator = Staked::<T>::iter_keys_from(raw_key).skip(1).into_iter();
-
- match Self::get_last_calculated_staker() {
- Some(last_staker) => {},
- None => {}
- };
+ let current_recalc_block =
+ Self::get_current_recalc_block(T::RelayBlockNumberProvider::current_block_number());
+ let next_recalc_block = current_recalc_block + T::RecalculationInterval::get();
+
+ let mut storage_iterator = Self::get_next_calculated_key()
+ .map_or(Staked::<T>::iter().skip(0), |key| {
+ Staked::<T>::iter_from(key).skip(1)
+ });
+
+ NextCalculatedRecord::<T>::set(None);
+
+ {
+ let mut stakers_number = stakers_number.unwrap_or(20);
+ let mut current_id = admin_id;
+ let mut income_acc = BalanceOf::<T>::default();
+
+ while let Some(((id, staked_block), (amount, next_recalc_block_for_stake))) =
+ storage_iterator.next()
+ {
+ if current_id != id {
+ if income_acc != BalanceOf::<T>::default() {
+ <T::Currency as Currency<T::AccountId>>::transfer(
+ &T::TreasuryAccountId::get(),
+ ¤t_id,
+ income_acc,
+ ExistenceRequirement::KeepAlive,
+ )
+ .and_then(|_| Self::add_lock_balance(¤t_id, income_acc))?;
+
+ Self::deposit_event(Event::StakingRecalculation(
+ current_id, amount, income_acc,
+ ));
+ }
+
+ stakers_number -= 1;
+ if stakers_number == 0 {
+ NextCalculatedRecord::<T>::set(Some((id, staked_block)));
+ break;
+ }
+ income_acc = BalanceOf::<T>::default();
+ current_id = id;
+ };
+ if next_recalc_block_for_stake >= current_recalc_block {
+ Self::recalculate_and_insert_stake(
+ ¤t_id,
+ staked_block,
+ next_recalc_block,
+ amount,
+ ((next_recalc_block_for_stake - current_recalc_block)
+ / T::RecalculationInterval::get())
+ .into() + 1,
+ &mut income_acc,
+ );
+ }
+ }
+ }
+
Ok(())
}
}
@@ -609,31 +663,43 @@
Self::total_staked_by_id_per_block(staker.as_sub()).unwrap_or_default()
}
- fn recalculate_stake(
+ fn recalculate_and_insert_stake(
staker: &T::AccountId,
- block: T::BlockNumber,
+ staked_block: T::BlockNumber,
+ next_recalc_block: T::BlockNumber,
base: BalanceOf<T>,
+ iters: u32,
income_acc: &mut BalanceOf<T>,
) {
- let income = Self::calculate_income(base);
- // base.checked_add(&income).map(|res| {
- // <Staked<T>>::insert((staker, block), res);
- // *income_acc += income;
- // <T::Currency as Currency<T::AccountId>>::transfer(
- // &T::TreasuryAccountId::get(),
- // staker,
- // income,
- // ExistenceRequirement::KeepAlive,
- // )
- // .and_then(|_| Self::add_lock_balance(staker, income));
- // });
+ let income = Self::calculate_income(base, iters);
+
+ base.checked_add(&income).map(|res| {
+ <Staked<T>>::insert((staker, staked_block), (res, next_recalc_block));
+ *income_acc += income;
+ });
}
- fn calculate_income<I>(base: I) -> I
+ fn calculate_income<I>(base: I, iters: u32) -> I
where
I: EncodeLike<BalanceOf<T>> + Balance,
{
- T::IntervalIncome::get() * base
+ let mut income = base;
+
+ (0..iters).for_each(|_| income += T::IntervalIncome::get() * income);
+
+ income - base
+ }
+
+ fn get_current_recalc_block(current_relay_block: T::BlockNumber) -> T::BlockNumber {
+ (current_relay_block / T::RecalculationInterval::get()) * T::RecalculationInterval::get()
+ }
+
+ // fn get_next_recalc_block(current_relay_block: T::BlockNumber) -> T::BlockNumber {
+ // Self::get_current_recalc_block(current_relay_block) + T::RecalculationInterval::get()
+ // }
+
+ fn get_next_calculated_key() -> Option<Vec<u8>> {
+ Self::get_next_calculated_record().map(|key| Staked::<T>::hashed_key_for(key))
}
}
pallets/app-promotion/src/weights.rsdiffbeforeafterboth3//! Autogenerated weights for pallet_app_promotion3//! Autogenerated weights for pallet_app_promotion4//!4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-08-30, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2022-08-31, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10247//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024889// Executed Command:9// Executed Command:26#![cfg_attr(rustfmt, rustfmt_skip)]26#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]27#![allow(unused_parens)]28#![allow(unused_imports)]28#![allow(unused_imports)]29#![allow(missing_docs)]29#![allow(clippy::unnecessary_cast)]30#![allow(clippy::unnecessary_cast)]303131use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};39 fn payout_stakers() -> Weight;40 fn payout_stakers() -> Weight;40 fn stake() -> Weight;41 fn stake() -> Weight;41 fn unstake() -> Weight;42 fn unstake() -> Weight;42 fn recalculate_stake() -> Weight;43 fn sponsor_collection() -> Weight;43 fn sponsor_collection() -> Weight;44 fn stop_sponsoring_collection() -> Weight;44 fn stop_sponsoring_collection() -> Weight;45 fn sponsor_contract() -> Weight;45 fn sponsor_contract() -> Weight;53 // Storage: ParachainSystem ValidationData (r:1 w:0)53 // Storage: ParachainSystem ValidationData (r:1 w:0)54 // Storage: Promotion NextInterestBlock (r:0 w:1)54 // Storage: Promotion NextInterestBlock (r:0 w:1)55 fn start_app_promotion() -> Weight {55 fn start_app_promotion() -> Weight {56 (2_299_000 as Weight)56 (3_995_000 as Weight)57 .saturating_add(T::DbWeight::get().reads(2 as Weight))57 .saturating_add(T::DbWeight::get().reads(2 as Weight))58 .saturating_add(T::DbWeight::get().writes(2 as Weight))58 .saturating_add(T::DbWeight::get().writes(2 as Weight))59 }59 }60 // Storage: Promotion StartBlock (r:1 w:1)60 // Storage: Promotion StartBlock (r:1 w:1)61 // Storage: Promotion NextInterestBlock (r:0 w:1)61 // Storage: Promotion NextInterestBlock (r:0 w:1)62 fn stop_app_promotion() -> Weight {62 fn stop_app_promotion() -> Weight {63 (1_733_000 as Weight)63 (3_623_000 as Weight)64 .saturating_add(T::DbWeight::get().reads(1 as Weight))64 .saturating_add(T::DbWeight::get().reads(1 as Weight))65 .saturating_add(T::DbWeight::get().writes(2 as Weight))65 .saturating_add(T::DbWeight::get().writes(2 as Weight))66 }66 }67 // Storage: Promotion Admin (r:0 w:1)67 // Storage: Promotion Admin (r:0 w:1)68 fn set_admin_address() -> Weight {68 fn set_admin_address() -> Weight {69 (553_000 as Weight)69 (1_203_000 as Weight)70 .saturating_add(T::DbWeight::get().writes(1 as Weight))70 .saturating_add(T::DbWeight::get().writes(1 as Weight))71 }71 }72 // Storage: Promotion Admin (r:1 w:0)72 // Storage: Promotion Admin (r:1 w:0)73 // Storage: ParachainSystem ValidationData (r:1 w:0)74 // Storage: Promotion NextCalculatedRecord (r:1 w:1)75 // Storage: Promotion Staked (r:2 w:0)73 fn payout_stakers() -> Weight {76 fn payout_stakers() -> Weight {74 (1_398_000 as Weight)77 (10_859_000 as Weight)78 .saturating_add(T::DbWeight::get().reads(5 as Weight))75 .saturating_add(T::DbWeight::get().reads(1 as Weight))79 .saturating_add(T::DbWeight::get().writes(1 as Weight))76 }80 }77 // Storage: System Account (r:1 w:1)81 // Storage: System Account (r:1 w:1)78 // Storage: Balances Locks (r:1 w:1)82 // Storage: Balances Locks (r:1 w:1)79 // Storage: ParachainSystem ValidationData (r:1 w:0)83 // Storage: ParachainSystem ValidationData (r:1 w:0)80 // Storage: Promotion Staked (r:1 w:1)84 // Storage: Promotion Staked (r:1 w:1)85 // Storage: Promotion TotalStaked (r:1 w:1)81 fn stake() -> Weight {86 fn stake() -> Weight {82 (9_506_000 as Weight)87 (14_789_000 as Weight)83 .saturating_add(T::DbWeight::get().reads(4 as Weight))88 .saturating_add(T::DbWeight::get().reads(5 as Weight))84 .saturating_add(T::DbWeight::get().writes(3 as Weight))89 .saturating_add(T::DbWeight::get().writes(4 as Weight))85 }90 }91 // Storage: Promotion Staked (r:2 w:1)86 // Storage: System Account (r:1 w:0)92 // Storage: ParachainSystem ValidationData (r:1 w:0)93 // Storage: Promotion PendingUnstake (r:1 w:1)94 // Storage: Promotion TotalStaked (r:1 w:1)87 fn unstake() -> Weight {95 fn unstake() -> Weight {88 (2_529_000 as Weight)96 (16_889_000 as Weight)97 .saturating_add(T::DbWeight::get().reads(5 as Weight))89 .saturating_add(T::DbWeight::get().reads(1 as Weight))98 .saturating_add(T::DbWeight::get().writes(3 as Weight))90 }99 }91 // Storage: System Account (r:1 w:0)92 fn recalculate_stake() -> Weight {93 (2_203_000 as Weight)94 .saturating_add(T::DbWeight::get().reads(1 as Weight))95 }96 // Storage: Promotion Admin (r:1 w:0)100 // Storage: Promotion Admin (r:1 w:0)97 // Storage: Common CollectionById (r:1 w:1)101 // Storage: Common CollectionById (r:1 w:1)98 fn sponsor_collection() -> Weight {102 fn sponsor_collection() -> Weight {99 (10_882_000 as Weight)103 (18_377_000 as Weight)100 .saturating_add(T::DbWeight::get().reads(2 as Weight))104 .saturating_add(T::DbWeight::get().reads(2 as Weight))101 .saturating_add(T::DbWeight::get().writes(1 as Weight))105 .saturating_add(T::DbWeight::get().writes(1 as Weight))102 }106 }103 // Storage: Promotion Admin (r:1 w:0)107 // Storage: Promotion Admin (r:1 w:0)104 // Storage: Common CollectionById (r:1 w:1)108 // Storage: Common CollectionById (r:1 w:1)105 fn stop_sponsoring_collection() -> Weight {109 fn stop_sponsoring_collection() -> Weight {106 (10_544_000 as Weight)110 (13_989_000 as Weight)107 .saturating_add(T::DbWeight::get().reads(2 as Weight))111 .saturating_add(T::DbWeight::get().reads(2 as Weight))108 .saturating_add(T::DbWeight::get().writes(1 as Weight))112 .saturating_add(T::DbWeight::get().writes(1 as Weight))109 }113 }110 // Storage: Promotion Admin (r:1 w:0)114 // Storage: Promotion Admin (r:1 w:0)111 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)115 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)112 fn sponsor_contract() -> Weight {116 fn sponsor_contract() -> Weight {113 (2_163_000 as Weight)117 (4_162_000 as Weight)114 .saturating_add(T::DbWeight::get().reads(1 as Weight))118 .saturating_add(T::DbWeight::get().reads(1 as Weight))115 .saturating_add(T::DbWeight::get().writes(1 as Weight))119 .saturating_add(T::DbWeight::get().writes(1 as Weight))116 }120 }117 // Storage: Promotion Admin (r:1 w:0)121 // Storage: Promotion Admin (r:1 w:0)118 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)122 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)119 fn stop_sponsoring_contract() -> Weight {123 fn stop_sponsoring_contract() -> Weight {120 (3_511_000 as Weight)124 (5_457_000 as Weight)121 .saturating_add(T::DbWeight::get().reads(2 as Weight))125 .saturating_add(T::DbWeight::get().reads(2 as Weight))122 .saturating_add(T::DbWeight::get().writes(1 as Weight))126 .saturating_add(T::DbWeight::get().writes(1 as Weight))123 }127 }129 // Storage: ParachainSystem ValidationData (r:1 w:0)133 // Storage: ParachainSystem ValidationData (r:1 w:0)130 // Storage: Promotion NextInterestBlock (r:0 w:1)134 // Storage: Promotion NextInterestBlock (r:0 w:1)131 fn start_app_promotion() -> Weight {135 fn start_app_promotion() -> Weight {132 (2_299_000 as Weight)136 (3_995_000 as Weight)133 .saturating_add(RocksDbWeight::get().reads(2 as Weight))137 .saturating_add(RocksDbWeight::get().reads(2 as Weight))134 .saturating_add(RocksDbWeight::get().writes(2 as Weight))138 .saturating_add(RocksDbWeight::get().writes(2 as Weight))135 }139 }136 // Storage: Promotion StartBlock (r:1 w:1)140 // Storage: Promotion StartBlock (r:1 w:1)137 // Storage: Promotion NextInterestBlock (r:0 w:1)141 // Storage: Promotion NextInterestBlock (r:0 w:1)138 fn stop_app_promotion() -> Weight {142 fn stop_app_promotion() -> Weight {139 (1_733_000 as Weight)143 (3_623_000 as Weight)140 .saturating_add(RocksDbWeight::get().reads(1 as Weight))144 .saturating_add(RocksDbWeight::get().reads(1 as Weight))141 .saturating_add(RocksDbWeight::get().writes(2 as Weight))145 .saturating_add(RocksDbWeight::get().writes(2 as Weight))142 }146 }143 // Storage: Promotion Admin (r:0 w:1)147 // Storage: Promotion Admin (r:0 w:1)144 fn set_admin_address() -> Weight {148 fn set_admin_address() -> Weight {145 (553_000 as Weight)149 (1_203_000 as Weight)146 .saturating_add(RocksDbWeight::get().writes(1 as Weight))150 .saturating_add(RocksDbWeight::get().writes(1 as Weight))147 }151 }148 // Storage: Promotion Admin (r:1 w:0)152 // Storage: Promotion Admin (r:1 w:0)153 // Storage: ParachainSystem ValidationData (r:1 w:0)154 // Storage: Promotion NextCalculatedRecord (r:1 w:1)155 // Storage: Promotion Staked (r:2 w:0)149 fn payout_stakers() -> Weight {156 fn payout_stakers() -> Weight {150 (1_398_000 as Weight)157 (10_859_000 as Weight)158 .saturating_add(RocksDbWeight::get().reads(5 as Weight))151 .saturating_add(RocksDbWeight::get().reads(1 as Weight))159 .saturating_add(RocksDbWeight::get().writes(1 as Weight))152 }160 }153 // Storage: System Account (r:1 w:1)161 // Storage: System Account (r:1 w:1)154 // Storage: Balances Locks (r:1 w:1)162 // Storage: Balances Locks (r:1 w:1)155 // Storage: ParachainSystem ValidationData (r:1 w:0)163 // Storage: ParachainSystem ValidationData (r:1 w:0)156 // Storage: Promotion Staked (r:1 w:1)164 // Storage: Promotion Staked (r:1 w:1)165 // Storage: Promotion TotalStaked (r:1 w:1)157 fn stake() -> Weight {166 fn stake() -> Weight {158 (9_506_000 as Weight)167 (14_789_000 as Weight)159 .saturating_add(RocksDbWeight::get().reads(4 as Weight))168 .saturating_add(RocksDbWeight::get().reads(5 as Weight))160 .saturating_add(RocksDbWeight::get().writes(3 as Weight))169 .saturating_add(RocksDbWeight::get().writes(4 as Weight))161 }170 }171 // Storage: Promotion Staked (r:2 w:1)162 // Storage: System Account (r:1 w:0)172 // Storage: ParachainSystem ValidationData (r:1 w:0)173 // Storage: Promotion PendingUnstake (r:1 w:1)174 // Storage: Promotion TotalStaked (r:1 w:1)163 fn unstake() -> Weight {175 fn unstake() -> Weight {164 (2_529_000 as Weight)176 (16_889_000 as Weight)177 .saturating_add(RocksDbWeight::get().reads(5 as Weight))165 .saturating_add(RocksDbWeight::get().reads(1 as Weight))178 .saturating_add(RocksDbWeight::get().writes(3 as Weight))166 }179 }167 // Storage: System Account (r:1 w:0)168 fn recalculate_stake() -> Weight {169 (2_203_000 as Weight)170 .saturating_add(RocksDbWeight::get().reads(1 as Weight))171 }172 // Storage: Promotion Admin (r:1 w:0)180 // Storage: Promotion Admin (r:1 w:0)173 // Storage: Common CollectionById (r:1 w:1)181 // Storage: Common CollectionById (r:1 w:1)174 fn sponsor_collection() -> Weight {182 fn sponsor_collection() -> Weight {175 (10_882_000 as Weight)183 (18_377_000 as Weight)176 .saturating_add(RocksDbWeight::get().reads(2 as Weight))184 .saturating_add(RocksDbWeight::get().reads(2 as Weight))177 .saturating_add(RocksDbWeight::get().writes(1 as Weight))185 .saturating_add(RocksDbWeight::get().writes(1 as Weight))178 }186 }179 // Storage: Promotion Admin (r:1 w:0)187 // Storage: Promotion Admin (r:1 w:0)180 // Storage: Common CollectionById (r:1 w:1)188 // Storage: Common CollectionById (r:1 w:1)181 fn stop_sponsoring_collection() -> Weight {189 fn stop_sponsoring_collection() -> Weight {182 (10_544_000 as Weight)190 (13_989_000 as Weight)183 .saturating_add(RocksDbWeight::get().reads(2 as Weight))191 .saturating_add(RocksDbWeight::get().reads(2 as Weight))184 .saturating_add(RocksDbWeight::get().writes(1 as Weight))192 .saturating_add(RocksDbWeight::get().writes(1 as Weight))185 }193 }186 // Storage: Promotion Admin (r:1 w:0)194 // Storage: Promotion Admin (r:1 w:0)187 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)195 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)188 fn sponsor_contract() -> Weight {196 fn sponsor_contract() -> Weight {189 (2_163_000 as Weight)197 (4_162_000 as Weight)190 .saturating_add(RocksDbWeight::get().reads(1 as Weight))198 .saturating_add(RocksDbWeight::get().reads(1 as Weight))191 .saturating_add(RocksDbWeight::get().writes(1 as Weight))199 .saturating_add(RocksDbWeight::get().writes(1 as Weight))192 }200 }193 // Storage: Promotion Admin (r:1 w:0)201 // Storage: Promotion Admin (r:1 w:0)194 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)202 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)195 fn stop_sponsoring_contract() -> Weight {203 fn stop_sponsoring_contract() -> Weight {196 (3_511_000 as Weight)204 (5_457_000 as Weight)197 .saturating_add(RocksDbWeight::get().reads(2 as Weight))205 .saturating_add(RocksDbWeight::get().reads(2 as Weight))198 .saturating_add(RocksDbWeight::get().writes(1 as Weight))206 .saturating_add(RocksDbWeight::get().writes(1 as Weight))199 }207 }