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
--- 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);
modifiedpallets/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(),
+								&current_id,
+								income_acc,
+								ExistenceRequirement::KeepAlive,
+							)
+							.and_then(|_| Self::add_lock_balance(&current_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(
+							&current_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))
 	}
 }
 
modifiedpallets/app-promotion/src/weights.rsdiffbeforeafterboth
before · pallets/app-promotion/src/weights.rs
1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_app_promotion4//!5//! 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: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-app-promotion15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/app-promotion/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_app_promotion.35pub trait WeightInfo {36	fn start_app_promotion() -> Weight;37	fn stop_app_promotion() -> Weight;38	fn set_admin_address() -> Weight;39	fn payout_stakers() -> Weight;40	fn stake() -> Weight;41	fn unstake() -> Weight;42	fn recalculate_stake() -> Weight;43	fn sponsor_collection() -> Weight;44	fn stop_sponsoring_collection() -> Weight;45	fn sponsor_contract() -> Weight;46	fn stop_sponsoring_contract() -> Weight;47}4849/// Weights for pallet_app_promotion using the Substrate node and recommended hardware.50pub struct SubstrateWeight<T>(PhantomData<T>);51impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {52	// Storage: Promotion StartBlock (r:1 w:1)53	// Storage: ParachainSystem ValidationData (r:1 w:0)54	// Storage: Promotion NextInterestBlock (r:0 w:1)55	fn start_app_promotion() -> Weight {56		(2_299_000 as Weight)57			.saturating_add(T::DbWeight::get().reads(2 as Weight))58			.saturating_add(T::DbWeight::get().writes(2 as Weight))59	}60	// Storage: Promotion StartBlock (r:1 w:1)61	// Storage: Promotion NextInterestBlock (r:0 w:1)62	fn stop_app_promotion() -> Weight {63		(1_733_000 as Weight)64			.saturating_add(T::DbWeight::get().reads(1 as Weight))65			.saturating_add(T::DbWeight::get().writes(2 as Weight))66	}67	// Storage: Promotion Admin (r:0 w:1)68	fn set_admin_address() -> Weight {69		(553_000 as Weight)70			.saturating_add(T::DbWeight::get().writes(1 as Weight))71	}72	// Storage: Promotion Admin (r:1 w:0)73	fn payout_stakers() -> Weight {74		(1_398_000 as Weight)75			.saturating_add(T::DbWeight::get().reads(1 as Weight))76	}77	// Storage: System Account (r:1 w:1)78	// Storage: Balances Locks (r:1 w:1)79	// Storage: ParachainSystem ValidationData (r:1 w:0)80	// Storage: Promotion Staked (r:1 w:1)81	fn stake() -> Weight {82		(9_506_000 as Weight)83			.saturating_add(T::DbWeight::get().reads(4 as Weight))84			.saturating_add(T::DbWeight::get().writes(3 as Weight))85	}86	// Storage: System Account (r:1 w:0)87	fn unstake() -> Weight {88		(2_529_000 as Weight)89			.saturating_add(T::DbWeight::get().reads(1 as Weight))90	}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)97	// Storage: Common CollectionById (r:1 w:1)98	fn sponsor_collection() -> Weight {99		(10_882_000 as Weight)100			.saturating_add(T::DbWeight::get().reads(2 as Weight))101			.saturating_add(T::DbWeight::get().writes(1 as Weight))102	}103	// Storage: Promotion Admin (r:1 w:0)104	// Storage: Common CollectionById (r:1 w:1)105	fn stop_sponsoring_collection() -> Weight {106		(10_544_000 as Weight)107			.saturating_add(T::DbWeight::get().reads(2 as Weight))108			.saturating_add(T::DbWeight::get().writes(1 as Weight))109	}110	// Storage: Promotion Admin (r:1 w:0)111	// Storage: EvmContractHelpers Sponsoring (r:0 w:1)112	fn sponsor_contract() -> Weight {113		(2_163_000 as Weight)114			.saturating_add(T::DbWeight::get().reads(1 as Weight))115			.saturating_add(T::DbWeight::get().writes(1 as Weight))116	}117	// Storage: Promotion Admin (r:1 w:0)118	// Storage: EvmContractHelpers Sponsoring (r:1 w:1)119	fn stop_sponsoring_contract() -> Weight {120		(3_511_000 as Weight)121			.saturating_add(T::DbWeight::get().reads(2 as Weight))122			.saturating_add(T::DbWeight::get().writes(1 as Weight))123	}124}125126// For backwards compatibility and tests127impl WeightInfo for () {128	// Storage: Promotion StartBlock (r:1 w:1)129	// Storage: ParachainSystem ValidationData (r:1 w:0)130	// Storage: Promotion NextInterestBlock (r:0 w:1)131	fn start_app_promotion() -> Weight {132		(2_299_000 as Weight)133			.saturating_add(RocksDbWeight::get().reads(2 as Weight))134			.saturating_add(RocksDbWeight::get().writes(2 as Weight))135	}136	// Storage: Promotion StartBlock (r:1 w:1)137	// Storage: Promotion NextInterestBlock (r:0 w:1)138	fn stop_app_promotion() -> Weight {139		(1_733_000 as Weight)140			.saturating_add(RocksDbWeight::get().reads(1 as Weight))141			.saturating_add(RocksDbWeight::get().writes(2 as Weight))142	}143	// Storage: Promotion Admin (r:0 w:1)144	fn set_admin_address() -> Weight {145		(553_000 as Weight)146			.saturating_add(RocksDbWeight::get().writes(1 as Weight))147	}148	// Storage: Promotion Admin (r:1 w:0)149	fn payout_stakers() -> Weight {150		(1_398_000 as Weight)151			.saturating_add(RocksDbWeight::get().reads(1 as Weight))152	}153	// Storage: System Account (r:1 w:1)154	// Storage: Balances Locks (r:1 w:1)155	// Storage: ParachainSystem ValidationData (r:1 w:0)156	// Storage: Promotion Staked (r:1 w:1)157	fn stake() -> Weight {158		(9_506_000 as Weight)159			.saturating_add(RocksDbWeight::get().reads(4 as Weight))160			.saturating_add(RocksDbWeight::get().writes(3 as Weight))161	}162	// Storage: System Account (r:1 w:0)163	fn unstake() -> Weight {164		(2_529_000 as Weight)165			.saturating_add(RocksDbWeight::get().reads(1 as Weight))166	}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)173	// Storage: Common CollectionById (r:1 w:1)174	fn sponsor_collection() -> Weight {175		(10_882_000 as Weight)176			.saturating_add(RocksDbWeight::get().reads(2 as Weight))177			.saturating_add(RocksDbWeight::get().writes(1 as Weight))178	}179	// Storage: Promotion Admin (r:1 w:0)180	// Storage: Common CollectionById (r:1 w:1)181	fn stop_sponsoring_collection() -> Weight {182		(10_544_000 as Weight)183			.saturating_add(RocksDbWeight::get().reads(2 as Weight))184			.saturating_add(RocksDbWeight::get().writes(1 as Weight))185	}186	// Storage: Promotion Admin (r:1 w:0)187	// Storage: EvmContractHelpers Sponsoring (r:0 w:1)188	fn sponsor_contract() -> Weight {189		(2_163_000 as Weight)190			.saturating_add(RocksDbWeight::get().reads(1 as Weight))191			.saturating_add(RocksDbWeight::get().writes(1 as Weight))192	}193	// Storage: Promotion Admin (r:1 w:0)194	// Storage: EvmContractHelpers Sponsoring (r:1 w:1)195	fn stop_sponsoring_contract() -> Weight {196		(3_511_000 as Weight)197			.saturating_add(RocksDbWeight::get().reads(2 as Weight))198			.saturating_add(RocksDbWeight::get().writes(1 as Weight))199	}200}
after · pallets/app-promotion/src/weights.rs
1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_app_promotion4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-08-31, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-app-promotion15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/app-promotion/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(missing_docs)]30#![allow(clippy::unnecessary_cast)]3132use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};33use sp_std::marker::PhantomData;3435/// Weight functions needed for pallet_app_promotion.36pub trait WeightInfo {37	fn start_app_promotion() -> Weight;38	fn stop_app_promotion() -> Weight;39	fn set_admin_address() -> Weight;40	fn payout_stakers() -> Weight;41	fn stake() -> Weight;42	fn unstake() -> Weight;43	fn sponsor_collection() -> Weight;44	fn stop_sponsoring_collection() -> Weight;45	fn sponsor_contract() -> Weight;46	fn stop_sponsoring_contract() -> Weight;47}4849/// Weights for pallet_app_promotion using the Substrate node and recommended hardware.50pub struct SubstrateWeight<T>(PhantomData<T>);51impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {52	// Storage: Promotion StartBlock (r:1 w:1)53	// Storage: ParachainSystem ValidationData (r:1 w:0)54	// Storage: Promotion NextInterestBlock (r:0 w:1)55	fn start_app_promotion() -> Weight {56		(3_995_000 as Weight)57			.saturating_add(T::DbWeight::get().reads(2 as Weight))58			.saturating_add(T::DbWeight::get().writes(2 as Weight))59	}60	// Storage: Promotion StartBlock (r:1 w:1)61	// Storage: Promotion NextInterestBlock (r:0 w:1)62	fn stop_app_promotion() -> Weight {63		(3_623_000 as Weight)64			.saturating_add(T::DbWeight::get().reads(1 as Weight))65			.saturating_add(T::DbWeight::get().writes(2 as Weight))66	}67	// Storage: Promotion Admin (r:0 w:1)68	fn set_admin_address() -> Weight {69		(1_203_000 as Weight)70			.saturating_add(T::DbWeight::get().writes(1 as Weight))71	}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)76	fn payout_stakers() -> Weight {77		(10_859_000 as Weight)78			.saturating_add(T::DbWeight::get().reads(5 as Weight))79			.saturating_add(T::DbWeight::get().writes(1 as Weight))80	}81	// Storage: System Account (r:1 w:1)82	// Storage: Balances Locks (r:1 w:1)83	// Storage: ParachainSystem ValidationData (r:1 w:0)84	// Storage: Promotion Staked (r:1 w:1)85	// Storage: Promotion TotalStaked (r:1 w:1)86	fn stake() -> Weight {87		(14_789_000 as Weight)88			.saturating_add(T::DbWeight::get().reads(5 as Weight))89			.saturating_add(T::DbWeight::get().writes(4 as Weight))90	}91	// Storage: Promotion Staked (r:2 w:1)92	// Storage: ParachainSystem ValidationData (r:1 w:0)93	// Storage: Promotion PendingUnstake (r:1 w:1)94	// Storage: Promotion TotalStaked (r:1 w:1)95	fn unstake() -> Weight {96		(16_889_000 as Weight)97			.saturating_add(T::DbWeight::get().reads(5 as Weight))98			.saturating_add(T::DbWeight::get().writes(3 as Weight))99	}100	// Storage: Promotion Admin (r:1 w:0)101	// Storage: Common CollectionById (r:1 w:1)102	fn sponsor_collection() -> Weight {103		(18_377_000 as Weight)104			.saturating_add(T::DbWeight::get().reads(2 as Weight))105			.saturating_add(T::DbWeight::get().writes(1 as Weight))106	}107	// Storage: Promotion Admin (r:1 w:0)108	// Storage: Common CollectionById (r:1 w:1)109	fn stop_sponsoring_collection() -> Weight {110		(13_989_000 as Weight)111			.saturating_add(T::DbWeight::get().reads(2 as Weight))112			.saturating_add(T::DbWeight::get().writes(1 as Weight))113	}114	// Storage: Promotion Admin (r:1 w:0)115	// Storage: EvmContractHelpers Sponsoring (r:0 w:1)116	fn sponsor_contract() -> Weight {117		(4_162_000 as Weight)118			.saturating_add(T::DbWeight::get().reads(1 as Weight))119			.saturating_add(T::DbWeight::get().writes(1 as Weight))120	}121	// Storage: Promotion Admin (r:1 w:0)122	// Storage: EvmContractHelpers Sponsoring (r:1 w:1)123	fn stop_sponsoring_contract() -> Weight {124		(5_457_000 as Weight)125			.saturating_add(T::DbWeight::get().reads(2 as Weight))126			.saturating_add(T::DbWeight::get().writes(1 as Weight))127	}128}129130// For backwards compatibility and tests131impl WeightInfo for () {132	// Storage: Promotion StartBlock (r:1 w:1)133	// Storage: ParachainSystem ValidationData (r:1 w:0)134	// Storage: Promotion NextInterestBlock (r:0 w:1)135	fn start_app_promotion() -> Weight {136		(3_995_000 as Weight)137			.saturating_add(RocksDbWeight::get().reads(2 as Weight))138			.saturating_add(RocksDbWeight::get().writes(2 as Weight))139	}140	// Storage: Promotion StartBlock (r:1 w:1)141	// Storage: Promotion NextInterestBlock (r:0 w:1)142	fn stop_app_promotion() -> Weight {143		(3_623_000 as Weight)144			.saturating_add(RocksDbWeight::get().reads(1 as Weight))145			.saturating_add(RocksDbWeight::get().writes(2 as Weight))146	}147	// Storage: Promotion Admin (r:0 w:1)148	fn set_admin_address() -> Weight {149		(1_203_000 as Weight)150			.saturating_add(RocksDbWeight::get().writes(1 as Weight))151	}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)156	fn payout_stakers() -> Weight {157		(10_859_000 as Weight)158			.saturating_add(RocksDbWeight::get().reads(5 as Weight))159			.saturating_add(RocksDbWeight::get().writes(1 as Weight))160	}161	// Storage: System Account (r:1 w:1)162	// Storage: Balances Locks (r:1 w:1)163	// Storage: ParachainSystem ValidationData (r:1 w:0)164	// Storage: Promotion Staked (r:1 w:1)165	// Storage: Promotion TotalStaked (r:1 w:1)166	fn stake() -> Weight {167		(14_789_000 as Weight)168			.saturating_add(RocksDbWeight::get().reads(5 as Weight))169			.saturating_add(RocksDbWeight::get().writes(4 as Weight))170	}171	// Storage: Promotion Staked (r:2 w:1)172	// Storage: ParachainSystem ValidationData (r:1 w:0)173	// Storage: Promotion PendingUnstake (r:1 w:1)174	// Storage: Promotion TotalStaked (r:1 w:1)175	fn unstake() -> Weight {176		(16_889_000 as Weight)177			.saturating_add(RocksDbWeight::get().reads(5 as Weight))178			.saturating_add(RocksDbWeight::get().writes(3 as Weight))179	}180	// Storage: Promotion Admin (r:1 w:0)181	// Storage: Common CollectionById (r:1 w:1)182	fn sponsor_collection() -> Weight {183		(18_377_000 as Weight)184			.saturating_add(RocksDbWeight::get().reads(2 as Weight))185			.saturating_add(RocksDbWeight::get().writes(1 as Weight))186	}187	// Storage: Promotion Admin (r:1 w:0)188	// Storage: Common CollectionById (r:1 w:1)189	fn stop_sponsoring_collection() -> Weight {190		(13_989_000 as Weight)191			.saturating_add(RocksDbWeight::get().reads(2 as Weight))192			.saturating_add(RocksDbWeight::get().writes(1 as Weight))193	}194	// Storage: Promotion Admin (r:1 w:0)195	// Storage: EvmContractHelpers Sponsoring (r:0 w:1)196	fn sponsor_contract() -> Weight {197		(4_162_000 as Weight)198			.saturating_add(RocksDbWeight::get().reads(1 as Weight))199			.saturating_add(RocksDbWeight::get().writes(1 as Weight))200	}201	// Storage: Promotion Admin (r:1 w:0)202	// Storage: EvmContractHelpers Sponsoring (r:1 w:1)203	fn stop_sponsoring_contract() -> Weight {204		(5_457_000 as Weight)205			.saturating_add(RocksDbWeight::get().reads(2 as Weight))206			.saturating_add(RocksDbWeight::get().writes(1 as Weight))207	}208}