git.delta.rocks / unique-network / refs/commits / 50852e23a743

difftreelog

minimal deposit for staking increased to 100 , added impl for `payout_stakers`.

PraetorP2022-08-31parent: #e85b045.patch.diff
in: master

3 files changed

modifiedpallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth
36benchmarks! {36benchmarks! {
37 where_clause{37 where_clause{
38 where T: Config + pallet_unique::Config + pallet_evm_migration::Config ,38 where T: Config + pallet_unique::Config + pallet_evm_migration::Config ,
39 T::BlockNumber: From<u32>39 T::BlockNumber: From<u32> + Into<u32>,
40 <<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum + From<u128>
40 }41 }
41 start_app_promotion {42 start_app_promotion {
4243
73 let _ = <T as Config>::Currency::make_free_balance_be(&caller, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());74 let _ = <T as Config>::Currency::make_free_balance_be(&caller, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
74 let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;75 let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;
7576
76 } : {PromototionPallet::<T>::unstake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?}77 } : {PromototionPallet::<T>::unstake(RawOrigin::Signed(caller.clone()).into())?}
7778
78 recalculate_stake {79 // recalculate_and_insert_stake{
79 let caller = account::<T::AccountId>("caller", 0, SEED);80 // let caller = account::<T::AccountId>("caller", 0, SEED);
80 let share = Perbill::from_rational(1u32, 10);81 // let share = Perbill::from_rational(1u32, 10);
81 let _ = <T as Config>::Currency::make_free_balance_be(&caller, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());82 // let _ = <T as Config>::Currency::make_free_balance_be(&caller, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
82 let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;83 // let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;
83 let block = <T::RelayBlockNumberProvider as BlockNumberProvider>::current_block_number();84 // let block = <T::RelayBlockNumberProvider as BlockNumberProvider>::current_block_number();
84 let mut acc = <BalanceOf<T>>::default();85 // let mut acc = <BalanceOf<T>>::default();
85 } : {PromototionPallet::<T>::recalculate_stake(&caller, block, share * <T as Config>::Currency::total_balance(&caller), &mut acc)}86 // } : {PromototionPallet::<T>::recalculate_and_insert_stake(&caller, block, share * <T as Config>::Currency::total_balance(&caller), &mut acc)}
8687
87 sponsor_collection {88 sponsor_collection {
88 let pallet_admin = account::<T::AccountId>("admin", 0, SEED);89 let pallet_admin = account::<T::AccountId>("admin", 0, SEED);
modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
191 pub type NextInterestBlock<T: Config> =191 pub type NextInterestBlock<T: Config> =
192 StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;192 StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
193193
194 /// Stores the address of the staker for which the last revenue recalculation was performed.194 /// Stores hash a record for which the last revenue recalculation was performed.
195 /// If `None`, then recalculation has not yet been performed or calculations have been completed for all stakers.195 /// If `None`, then recalculation has not yet been performed or calculations have been completed for all stakers.
196 #[pallet::storage]196 #[pallet::storage]
197 #[pallet::getter(fn get_last_calculated_staker)]197 #[pallet::getter(fn get_next_calculated_record)]
198 pub type LastCalcucaltedStaker<T: Config> =198 pub type NextCalculatedRecord<T: Config> =
199 StorageValue<Value = T::AccountId, QueryKind = OptionQuery>;199 StorageValue<Value = (T::AccountId, T::BlockNumber), QueryKind = OptionQuery>;
200200
201 #[pallet::hooks]201 #[pallet::hooks]
202 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {202 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
259 #[pallet::call]259 #[pallet::call]
260 impl<T: Config> Pallet<T>260 impl<T: Config> Pallet<T>
261 where261 where
262 T::BlockNumber: From<u32>,262 T::BlockNumber: From<u32> + Into<u32>,
263 <<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum + From<u128>263 <<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum + From<u128>,
264 {264 {
265 #[pallet::weight(T::WeightInfo::set_admin_address())]265 #[pallet::weight(T::WeightInfo::set_admin_address())]
266 pub fn set_admin_address(origin: OriginFor<T>, admin: T::CrossAccountId) -> DispatchResult {266 pub fn set_admin_address(origin: OriginFor<T>, admin: T::CrossAccountId) -> DispatchResult {
375 .ok_or(ArithmeticError::Overflow)?,377 .ok_or(ArithmeticError::Overflow)?,
376 );378 );
377 379
378 TotalStaked::<T>::set(TotalStaked::<T>::get().checked_sub(&total_staked).ok_or(ArithmeticError::Underflow)?); // when error we should recover stake state for the staker380 TotalStaked::<T>::set(
381 TotalStaked::<T>::get()
382 .checked_sub(&total_staked)
383 .ok_or(ArithmeticError::Underflow)?,
384 ); // when error we should recover initial stake state for the staker
379385
380 Ok(None.into())386 Ok(None.into())
381387
512 Error::<T>::NoPermission518 Error::<T>::NoPermission
513 );519 );
514 520
515 let raw_key = Staked::<T>::hashed_key_for((admin_id, T::BlockNumber::default()));521 let current_recalc_block =
516 522 Self::get_current_recalc_block(T::RelayBlockNumberProvider::current_block_number());
523 let next_recalc_block = current_recalc_block + T::RecalculationInterval::get();
524
517 let key_iterator = Staked::<T>::iter_keys_from(raw_key).skip(1).into_iter();525 let mut storage_iterator = Self::get_next_calculated_key()
518 526 .map_or(Staked::<T>::iter().skip(0), |key| {
527 Staked::<T>::iter_from(key).skip(1)
528 });
529
530 NextCalculatedRecord::<T>::set(None);
531
532 {
533 let mut stakers_number = stakers_number.unwrap_or(20);
534 let mut current_id = admin_id;
535 let mut income_acc = BalanceOf::<T>::default();
536
537 while let Some(((id, staked_block), (amount, next_recalc_block_for_stake))) =
538 storage_iterator.next()
539 {
540 if current_id != id {
541 if income_acc != BalanceOf::<T>::default() {
542 <T::Currency as Currency<T::AccountId>>::transfer(
543 &T::TreasuryAccountId::get(),
544 &current_id,
545 income_acc,
546 ExistenceRequirement::KeepAlive,
547 )
548 .and_then(|_| Self::add_lock_balance(&current_id, income_acc))?;
549
519 match Self::get_last_calculated_staker() {550 Self::deposit_event(Event::StakingRecalculation(
551 current_id, amount, income_acc,
552 ));
553 }
554
555 stakers_number -= 1;
556 if stakers_number == 0 {
520 Some(last_staker) => {},557 NextCalculatedRecord::<T>::set(Some((id, staked_block)));
521 None => {}558 break;
522 };559 }
560 income_acc = BalanceOf::<T>::default();
561 current_id = id;
562 };
563 if next_recalc_block_for_stake >= current_recalc_block {
564 Self::recalculate_and_insert_stake(
565 &current_id,
566 staked_block,
567 next_recalc_block,
568 amount,
569 ((next_recalc_block_for_stake - current_recalc_block)
570 / T::RecalculationInterval::get())
571 .into() + 1,
572 &mut income_acc,
573 );
574 }
575 }
576 }
523577
524 Ok(())578 Ok(())
525 }579 }
609 Self::total_staked_by_id_per_block(staker.as_sub()).unwrap_or_default()663 Self::total_staked_by_id_per_block(staker.as_sub()).unwrap_or_default()
610 }664 }
611665
612 fn recalculate_stake(666 fn recalculate_and_insert_stake(
613 staker: &T::AccountId,667 staker: &T::AccountId,
614 block: T::BlockNumber,668 staked_block: T::BlockNumber,
669 next_recalc_block: T::BlockNumber,
615 base: BalanceOf<T>,670 base: BalanceOf<T>,
671 iters: u32,
616 income_acc: &mut BalanceOf<T>,672 income_acc: &mut BalanceOf<T>,
617 ) {673 ) {
618 let income = Self::calculate_income(base);674 let income = Self::calculate_income(base, iters);
619 // base.checked_add(&income).map(|res| {675
620 // <Staked<T>>::insert((staker, block), res);676 base.checked_add(&income).map(|res| {
621 // *income_acc += income;677 <Staked<T>>::insert((staker, staked_block), (res, next_recalc_block));
622 // <T::Currency as Currency<T::AccountId>>::transfer(678 *income_acc += income;
623 // &T::TreasuryAccountId::get(),679 });
624 // staker,
625 // income,
626 // ExistenceRequirement::KeepAlive,
627 // )
628 // .and_then(|_| Self::add_lock_balance(staker, income));
629 // });
630 }680 }
631681
632 fn calculate_income<I>(base: I) -> I682 fn calculate_income<I>(base: I, iters: u32) -> I
633 where683 where
634 I: EncodeLike<BalanceOf<T>> + Balance,684 I: EncodeLike<BalanceOf<T>> + Balance,
635 {685 {
686 let mut income = base;
687
636 T::IntervalIncome::get() * base688 (0..iters).for_each(|_| income += T::IntervalIncome::get() * income);
689
690 income - base
637 }691 }
692
693 fn get_current_recalc_block(current_relay_block: T::BlockNumber) -> T::BlockNumber {
694 (current_relay_block / T::RecalculationInterval::get()) * T::RecalculationInterval::get()
695 }
696
697 // fn get_next_recalc_block(current_relay_block: T::BlockNumber) -> T::BlockNumber {
698 // Self::get_current_recalc_block(current_relay_block) + T::RecalculationInterval::get()
699 // }
700
701 fn get_next_calculated_key() -> Option<Vec<u8>> {
702 Self::get_next_calculated_record().map(|key| Staked::<T>::hashed_key_for(key))
703 }
638}704}
639705
640impl<T: Config> Pallet<T>706impl<T: Config> Pallet<T>
modifiedpallets/app-promotion/src/weights.rsdiffbeforeafterboth
3//! Autogenerated weights for pallet_app_promotion3//! Autogenerated weights for pallet_app_promotion
4//!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-dev
6//! 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: 1024
88
9// 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)]
3031
31use 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 }