git.delta.rocks / unique-network / refs/commits / ebc4cdb8a3c4

difftreelog

add force methods for collection in `Unique` , add events Stake, Unstake, SetAdmin

PraetorP2022-09-05parent: #9704432.patch.diff
in: master

8 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6473,7 +6473,7 @@
 
 [[package]]
 name = "pallet-unique"
-version = "0.1.3"
+version = "0.1.4"
 dependencies = [
  "ethereum",
  "evm-coder",
modifiedpallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth
before · pallets/app-promotion/src/benchmarking.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg(feature = "runtime-benchmarks")]1819use super::*;20use crate::Pallet as PromototionPallet;2122use sp_runtime::traits::Bounded;23use sp_std::vec;2425use frame_benchmarking::{benchmarks, account};2627use frame_system::{Origin, RawOrigin};28use pallet_unique::benchmarking::create_nft_collection;29use pallet_evm_migration::Pallet as EvmMigrationPallet;3031// trait BenchmarkingConfig: Config + pallet_unique::Config { }3233// impl<T: Config + pallet_unique::Config> BenchmarkingConfig for T { }3435const SEED: u32 = 0;36benchmarks! {37	where_clause{38		where T:  Config + pallet_unique::Config + pallet_evm_migration::Config ,39		T::BlockNumber: From<u32> + Into<u32>,40		<<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum + From<u128>41	}42	// start_app_promotion {4344	// } : {PromototionPallet::<T>::start_app_promotion(RawOrigin::Root.into(), None)?}4546	// stop_app_promotion{47	// 	PromototionPallet::<T>::start_app_promotion(RawOrigin::Root.into(), Some(25.into()))?;48	// } : {PromototionPallet::<T>::stop_app_promotion(RawOrigin::Root.into())?}4950	set_admin_address {51		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);52		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());53	} : {PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin))?}5455	payout_stakers{56		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);57		let share = Perbill::from_rational(1u32, 10);58		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;59		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());60		let staker: T::AccountId = account("caller", 0, SEED);61		let stakers: Vec<T::AccountId> = (0..100).map(|index| account("staker", index, SEED)).collect();62		stakers.iter().for_each(|staker| {63			<T as Config>::Currency::make_free_balance_be(&staker,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());64		});65		let _ = <T as Config>::Currency::make_free_balance_be(&staker,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());66		let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(staker.clone()).into(), share * <T as Config>::Currency::total_balance(&staker))?;67	} : {PromototionPallet::<T>::payout_stakers(RawOrigin::Signed(pallet_admin.clone()).into(), Some(1))?}6869	stake {70		let caller = account::<T::AccountId>("caller", 0, SEED);71		let share = Perbill::from_rational(1u32, 10);72		let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());73	} : {PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?}7475	unstake {76		let caller = account::<T::AccountId>("caller", 0, SEED);77		let share = Perbill::from_rational(1u32, 20);78		let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());79		(0..10).map(|_| PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))).collect::<Result<Vec<_>, _>>()?;8081	} : {PromototionPallet::<T>::unstake(RawOrigin::Signed(caller.clone()).into())?}8283	// recalculate_and_insert_stake{84	// 	let caller = account::<T::AccountId>("caller", 0, SEED);85	// 	let share = Perbill::from_rational(1u32, 10);86	// 	let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());87	// 	let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;88	// 	let block = <T::RelayBlockNumberProvider as BlockNumberProvider>::current_block_number();89	// 	let mut acc = <BalanceOf<T>>::default();90	// } : {PromototionPallet::<T>::recalculate_and_insert_stake(&caller, block, share * <T as Config>::Currency::total_balance(&caller), &mut acc)}9192	sponsor_collection {93		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);94		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;95		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());96		let caller: T::AccountId = account("caller", 0, SEED);97		let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());98		let collection = create_nft_collection::<T>(caller.clone())?;99	} : {PromototionPallet::<T>::sponsor_collection(RawOrigin::Signed(pallet_admin.clone()).into(), collection)?}100101	stop_sponsoring_collection {102		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);103		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;104		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());105		let caller: T::AccountId = account("caller", 0, SEED);106		let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());107		let collection = create_nft_collection::<T>(caller.clone())?;108		PromototionPallet::<T>::sponsor_collection(RawOrigin::Signed(pallet_admin.clone()).into(), collection)?;109	} : {PromototionPallet::<T>::stop_sponsoring_collection(RawOrigin::Signed(pallet_admin.clone()).into(), collection)?}110111	sponsor_contract {112		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);113		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;114115		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());116		let address = H160::from_low_u64_be(SEED as u64);117		let data: Vec<u8> = (0..20 as u8).collect();118		<EvmMigrationPallet<T>>::begin(RawOrigin::Root.into(), address)?;119		<EvmMigrationPallet<T>>::finish(RawOrigin::Root.into(), address, data)?;120	} : {PromototionPallet::<T>::sponsor_conract(RawOrigin::Signed(pallet_admin.clone()).into(), address)?}121122	stop_sponsoring_contract {123		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);124		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;125126		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());127		let address = H160::from_low_u64_be(SEED as u64);128		let data: Vec<u8> = (0..20 as u8).collect();129		<EvmMigrationPallet<T>>::begin(RawOrigin::Root.into(), address)?;130		<EvmMigrationPallet<T>>::finish(RawOrigin::Root.into(), address, data)?;131		PromototionPallet::<T>::sponsor_conract(RawOrigin::Signed(pallet_admin.clone()).into(), address)?;132	} : {PromototionPallet::<T>::stop_sponsoring_contract(RawOrigin::Signed(pallet_admin.clone()).into(), address)?}133}
after · pallets/app-promotion/src/benchmarking.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#![cfg(feature = "runtime-benchmarks")]1819use super::*;20use crate::Pallet as PromototionPallet;2122use sp_runtime::traits::Bounded;23use sp_std::vec;2425use frame_benchmarking::{benchmarks, account};2627use frame_system::{Origin, RawOrigin};28use pallet_unique::benchmarking::create_nft_collection;29use pallet_evm_migration::Pallet as EvmMigrationPallet;3031// trait BenchmarkingConfig: Config + pallet_unique::Config { }3233// impl<T: Config + pallet_unique::Config> BenchmarkingConfig for T { }3435const SEED: u32 = 0;36benchmarks! {37	where_clause{38		where T:  Config + pallet_unique::Config + pallet_evm_migration::Config ,39		T::BlockNumber: From<u32> + Into<u32>,40		<<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum + From<u128>41	}42	// start_app_promotion {4344	// } : {PromototionPallet::<T>::start_app_promotion(RawOrigin::Root.into(), None)?}4546	// stop_app_promotion{47	// 	PromototionPallet::<T>::start_app_promotion(RawOrigin::Root.into(), Some(25.into()))?;48	// } : {PromototionPallet::<T>::stop_app_promotion(RawOrigin::Root.into())?}4950	set_admin_address {51		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);52		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());53	} : {PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin))?}5455	payout_stakers{56		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);57		let share = Perbill::from_rational(1u32, 100);58		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;59		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());60		let staker: T::AccountId = account("caller", 0, SEED);61		let stakers: Vec<T::AccountId> = (0..100).map(|index| account("staker", index, SEED)).collect();62		stakers.iter().for_each(|staker| {63			<T as Config>::Currency::make_free_balance_be(&staker,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());64		});65		let _ = <T as Config>::Currency::make_free_balance_be(&staker,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());66		let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(staker.clone()).into(), share * <T as Config>::Currency::total_balance(&staker))?;67	} : {PromototionPallet::<T>::payout_stakers(RawOrigin::Signed(pallet_admin.clone()).into(), Some(1))?}6869	stake {70		let caller = account::<T::AccountId>("caller", 0, SEED);71		let share = Perbill::from_rational(1u32, 10);72		let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());73	} : {PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?}7475	unstake {76		let caller = account::<T::AccountId>("caller", 0, SEED);77		let share = Perbill::from_rational(1u32, 20);78		let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());79		(0..10).map(|_| PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))).collect::<Result<Vec<_>, _>>()?;8081	} : {PromototionPallet::<T>::unstake(RawOrigin::Signed(caller.clone()).into())?}8283	// recalculate_and_insert_stake{84	// 	let caller = account::<T::AccountId>("caller", 0, SEED);85	// 	let share = Perbill::from_rational(1u32, 10);86	// 	let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());87	// 	let _ = PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))?;88	// 	let block = <T::RelayBlockNumberProvider as BlockNumberProvider>::current_block_number();89	// 	let mut acc = <BalanceOf<T>>::default();90	// } : {PromototionPallet::<T>::recalculate_and_insert_stake(&caller, block, share * <T as Config>::Currency::total_balance(&caller), &mut acc)}9192	sponsor_collection {93		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);94		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;95		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());96		let caller: T::AccountId = account("caller", 0, SEED);97		let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());98		let collection = create_nft_collection::<T>(caller.clone())?;99	} : {PromototionPallet::<T>::sponsor_collection(RawOrigin::Signed(pallet_admin.clone()).into(), collection)?}100101	stop_sponsoring_collection {102		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);103		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;104		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());105		let caller: T::AccountId = account("caller", 0, SEED);106		let _ = <T as Config>::Currency::make_free_balance_be(&caller,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());107		let collection = create_nft_collection::<T>(caller.clone())?;108		PromototionPallet::<T>::sponsor_collection(RawOrigin::Signed(pallet_admin.clone()).into(), collection)?;109	} : {PromototionPallet::<T>::stop_sponsoring_collection(RawOrigin::Signed(pallet_admin.clone()).into(), collection)?}110111	sponsor_contract {112		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);113		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;114115		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());116		let address = H160::from_low_u64_be(SEED as u64);117		let data: Vec<u8> = (0..20 as u8).collect();118		<EvmMigrationPallet<T>>::begin(RawOrigin::Root.into(), address)?;119		<EvmMigrationPallet<T>>::finish(RawOrigin::Root.into(), address, data)?;120	} : {PromototionPallet::<T>::sponsor_conract(RawOrigin::Signed(pallet_admin.clone()).into(), address)?}121122	stop_sponsoring_contract {123		let pallet_admin = account::<T::AccountId>("admin", 0, SEED);124		PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;125126		let _ = <T as Config>::Currency::make_free_balance_be(&pallet_admin,  Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());127		let address = H160::from_low_u64_be(SEED as u64);128		let data: Vec<u8> = (0..20 as u8).collect();129		<EvmMigrationPallet<T>>::begin(RawOrigin::Root.into(), address)?;130		<EvmMigrationPallet<T>>::finish(RawOrigin::Root.into(), address, data)?;131		PromototionPallet::<T>::sponsor_conract(RawOrigin::Signed(pallet_admin.clone()).into(), address)?;132	} : {PromototionPallet::<T>::stop_sponsoring_contract(RawOrigin::Signed(pallet_admin.clone()).into(), address)?}133}
modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -70,16 +70,11 @@
 };
 
 pub const LOCK_IDENTIFIER: [u8; 8] = *b"appstake";
+
 const PENDING_LIMIT_PER_BLOCK: u32 = 3;
 
 type BalanceOf<T> =
 	<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
-
-// const SECONDS_TO_BLOCK: u32 = 6;
-// const DAY: u32 = 60 * 60 * 24 / SECONDS_TO_BLOCK;
-// const WEEK: u32 = 7 * DAY;
-// const TWO_WEEK: u32 = 2 * WEEK;
-// const YEAR: u32 = DAY * 365;
 
 #[frame_support::pallet]
 pub mod pallet {
@@ -115,9 +110,9 @@
 		#[pallet::constant]
 		type PendingInterval: Get<Self::BlockNumber>;
 
-		/// In chain blocks.
-		#[pallet::constant]
-		type Day: Get<Self::BlockNumber>; // useless
+		// /// In chain blocks.
+		// #[pallet::constant]
+		// type Day: Get<Self::BlockNumber>; // useless
 
 		#[pallet::constant]
 		type Nominal: Get<BalanceOf<Self>>;
@@ -150,6 +145,9 @@
 			/// Amount of accrued interest
 			BalanceOf<T>,
 		),
+		Stake(T::AccountId, BalanceOf<T>),
+		Unstake(T::AccountId, BalanceOf<T>),
+		SetAdmin(T::AccountId),
 	}
 
 	#[pallet::error]
@@ -205,9 +203,9 @@
 		ValueQuery,
 	>;
 
-	/// A block when app-promotion has started .I think this is redundant, because we only need `NextInterestBlock`.
-	#[pallet::storage]
-	pub type StartBlock<T: Config> = StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
+	// /// A block when app-promotion has started .I think this is redundant, because we only need `NextInterestBlock`.
+	// #[pallet::storage]
+	// pub type StartBlock<T: Config> = StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
 
 	// /// Next target block when interest is recalculated
 	// #[pallet::storage]
@@ -257,50 +255,14 @@
 		#[pallet::weight(T::WeightInfo::set_admin_address())]
 		pub fn set_admin_address(origin: OriginFor<T>, admin: T::CrossAccountId) -> DispatchResult {
 			ensure_root(origin)?;
+
 			<Admin<T>>::set(Some(admin.as_sub().to_owned()));
 
+			Self::deposit_event(Event::SetAdmin(admin.as_sub().to_owned()));
+
 			Ok(())
 		}
-
-		// #[pallet::weight(T::WeightInfo::start_app_promotion())]
-		// pub fn start_app_promotion(
-		// 	origin: OriginFor<T>,
-		// 	promotion_start_relay_block: Option<T::BlockNumber>,
-		// ) -> DispatchResult
-		// where
-		// 	<T as frame_system::Config>::BlockNumber: From<u32>,
-		// {
-		// 	ensure_root(origin)?;
-
-		// 	// Start app-promotion mechanics if it has not been yet initialized
-		// 	if <StartBlock<T>>::get() == 0u32.into() {
-		// 		let start_block = promotion_start_relay_block
-		// 			.unwrap_or(T::RelayBlockNumberProvider::current_block_number());
-
-		// 		// Set promotion global start block
-		// 		<StartBlock<T>>::set(start_block);
-
-		// 		<NextInterestBlock<T>>::set(start_block + T::RecalculationInterval::get());
-		// 	}
-
-		// 	Ok(())
-		// }
 
-		// #[pallet::weight(T::WeightInfo::stop_app_promotion())]
-		// pub fn stop_app_promotion(origin: OriginFor<T>) -> DispatchResult
-		// where
-		// 	<T as frame_system::Config>::BlockNumber: From<u32>,
-		// {
-		// 	ensure_root(origin)?;
-
-		// 	if <StartBlock<T>>::get() != 0u32.into() {
-		// 		<StartBlock<T>>::set(T::BlockNumber::default());
-		// 		<NextInterestBlock<T>>::set(T::BlockNumber::default());
-		// 	}
-
-		// 	Ok(())
-		// }
-
 		#[pallet::weight(T::WeightInfo::stake())]
 		pub fn stake(staker: OriginFor<T>, amount: BalanceOf<T>) -> DispatchResult {
 			let staker_id = ensure_signed(staker)?;
@@ -350,6 +312,9 @@
 			);
 
 			StakesPerAccount::<T>::mutate(&staker_id, |stakes| *stakes += 1);
+
+			Self::deposit_event(Event::Stake(staker_id, amount));
+
 			Ok(())
 		}
 
@@ -392,6 +357,8 @@
 
 			StakesPerAccount::<T>::remove(&staker_id);
 
+			Self::deposit_event(Event::Unstake(staker_id, total_staked));
+
 			Ok(None.into())
 		}
 
@@ -527,13 +494,13 @@
 			// 		}
 			// 	}
 			// }
-			
+
 			{
 				let mut stakers_number = stakers_number.unwrap_or(20);
-				let  last_id = RefCell::new(None);
+				let last_id = RefCell::new(None);
 				let income_acc = RefCell::new(BalanceOf::<T>::default());
 				let amount_acc = RefCell::new(BalanceOf::<T>::default());
-				
+
 				let flush_stake = || -> DispatchResult {
 					if let Some(last_id) = &*last_id.borrow() {
 						if !income_acc.borrow().is_zero() {
@@ -573,7 +540,7 @@
 					};
 					*last_id.borrow_mut() = Some(current_id.clone());
 					if current_recalc_block >= next_recalc_block_for_stake {
-						*amount_acc.borrow_mut() += amount;  
+						*amount_acc.borrow_mut() += amount;
 						Self::recalculate_and_insert_stake(
 							&current_id,
 							staked_block,
@@ -588,7 +555,6 @@
 				}
 				flush_stake()?;
 			}
-
 
 			Ok(())
 		}
modifiedpallets/app-promotion/src/types.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/types.rs
+++ b/pallets/app-promotion/src/types.rs
@@ -5,7 +5,7 @@
 
 use pallet_balances::{BalanceLock, Config as BalancesConfig, Pallet as PalletBalances};
 use pallet_common::CollectionHandle;
-use pallet_unique::{Event as UniqueEvent, Error as UniqueError};
+
 use sp_runtime::DispatchError;
 use up_data_structs::{CollectionId, SponsorshipState};
 use sp_std::borrow::ToOwned;
@@ -53,36 +53,11 @@
 		sponsor_id: Self::AccountId,
 		collection_id: Self::CollectionId,
 	) -> DispatchResult {
-		let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
-		target_collection.check_is_internal()?;
-		target_collection.set_sponsor(sponsor_id.clone())?;
-
-		Self::deposit_event(UniqueEvent::<T>::CollectionSponsorSet(
-			collection_id,
-			sponsor_id.clone(),
-		));
-
-		ensure!(
-			target_collection.confirm_sponsorship(&sponsor_id)?,
-			UniqueError::<T>::ConfirmUnsetSponsorFail
-		);
-
-		Self::deposit_event(UniqueEvent::<T>::SponsorshipConfirmed(
-			collection_id,
-			sponsor_id,
-		));
-
-		target_collection.save()
+		Self::force_set_sponsor(sponsor_id, collection_id)
 	}
 
 	fn remove_collection_sponsor(collection_id: Self::CollectionId) -> DispatchResult {
-		let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
-		target_collection.check_is_internal()?;
-		target_collection.sponsorship = SponsorshipState::Disabled;
-
-		Self::deposit_event(UniqueEvent::<T>::CollectionSponsorRemoved(collection_id));
-
-		target_collection.save()
+		Self::force_remove_collection_sponsor(collection_id)
 	}
 
 	fn get_sponsor(
modifiedpallets/unique/CHANGELOG.mddiffbeforeafterboth
--- a/pallets/unique/CHANGELOG.md
+++ b/pallets/unique/CHANGELOG.md
@@ -3,22 +3,27 @@
 All notable changes to this project will be documented in this file.
 
 <!-- bureaucrate goes here -->
+
+## [v0.1.4] 2022-09-5
+
+### Added
+
 ## [v0.1.3] 2022-08-16
 
 ### Other changes
 
-- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a
+-   build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a
 
-- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf8
+-   build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf8
 
-- refactor: Remove `#[transactional]` from extrinsics 7fd36cea2f6e00c02c67ccc1de9649ae404efd31
+-   refactor: Remove `#[transactional]` from extrinsics 7fd36cea2f6e00c02c67ccc1de9649ae404efd31
 
 Every extrinsic now runs in transaction implicitly, and
 `#[transactional]` on pallet dispatchable is now meaningless
 
 Upstream-Change: https://github.com/paritytech/substrate/issues/10806
 
-- refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d975
+-   refactor: Switch to new prefix removal methods 26734e9567589d75cdd99e404eabf11d5a97d975
 
 New methods allows to call `remove_prefix` with limit multiple times
 in the same block
@@ -27,10 +32,12 @@
 
 Upstream-Change: https://github.com/paritytech/substrate/pull/11490
 
-- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
+-   build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
 
 ## [v0.1.1] - 2022-07-25
+
 ### Added
-- Method for creating `ERC721Metadata` compatible NFT collection.
-- Method for creating `ERC721Metadata` compatible ReFungible collection.
-- Method for creating ReFungible collection.
+
+-   Method for creating `ERC721Metadata` compatible NFT collection.
+-   Method for creating `ERC721Metadata` compatible ReFungible collection.
+-   Method for creating ReFungible collection.
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
--- a/pallets/unique/Cargo.toml
+++ b/pallets/unique/Cargo.toml
@@ -9,7 +9,7 @@
 license = 'GPLv3'
 name = 'pallet-unique'
 repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = "0.1.3"
+version = "0.1.4"
 
 [package.metadata.docs.rs]
 targets = ['x86_64-unknown-linux-gnu']
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -1103,3 +1103,35 @@
 		}
 	}
 }
+
+impl<T: Config> Pallet<T> {
+	pub fn force_set_sponsor(sponsor: T::AccountId, collection_id: CollectionId) -> DispatchResult {
+		let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
+		target_collection.check_is_internal()?;
+		target_collection.set_sponsor(sponsor.clone())?;
+
+		Self::deposit_event(Event::<T>::CollectionSponsorSet(
+			collection_id,
+			sponsor.clone(),
+		));
+
+		ensure!(
+			target_collection.confirm_sponsorship(&sponsor)?,
+			Error::<T>::ConfirmUnsetSponsorFail
+		);
+
+		Self::deposit_event(Event::<T>::SponsorshipConfirmed(collection_id, sponsor));
+
+		target_collection.save()
+	}
+
+	pub fn force_remove_collection_sponsor(collection_id: CollectionId) -> DispatchResult {
+		let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
+		target_collection.check_is_internal()?;
+		target_collection.sponsorship = SponsorshipState::Disabled;
+
+		Self::deposit_event(Event::<T>::CollectionSponsorRemoved(collection_id));
+
+		target_collection.save()
+	}
+}
modifiedruntime/common/config/pallets/app_promotion.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/app_promotion.rs
+++ b/runtime/common/config/pallets/app_promotion.rs
@@ -22,7 +22,7 @@
 use frame_support::{parameter_types, PalletId};
 use sp_arithmetic::Perbill;
 use up_common::{
-	constants::{DAYS, UNIQUE, RELAY_DAYS},
+	constants::{ UNIQUE, RELAY_DAYS},
 	types::Balance,
 };
 
@@ -32,7 +32,7 @@
 	pub const RecalculationInterval: BlockNumber = 20;
 	pub const PendingInterval: BlockNumber = 10;
 	pub const Nominal: Balance = UNIQUE;
-	pub const Day: BlockNumber = DAYS;
+	// pub const Day: BlockNumber = DAYS;
 	pub IntervalIncome: Perbill = Perbill::from_rational(RecalculationInterval::get(), RELAY_DAYS) * Perbill::from_rational(5u32, 10_000);
 }
 
@@ -42,7 +42,7 @@
 	pub const RecalculationInterval: BlockNumber = RELAY_DAYS;
 	pub const PendingInterval: BlockNumber = 7 * RELAY_DAYS;
 	pub const Nominal: Balance = UNIQUE;
-	pub const Day: BlockNumber = RELAY_DAYS;
+	// pub const Day: BlockNumber = RELAY_DAYS;
 	pub IntervalIncome: Perbill = Perbill::from_rational(5u32, 10_000);
 }
 
@@ -56,7 +56,7 @@
 	type RelayBlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
 	type RecalculationInterval = RecalculationInterval;
 	type PendingInterval = PendingInterval;
-	type Day = Day;
+	// type Day = Day;
 	type Nominal = Nominal;
 	type IntervalIncome = IntervalIncome;
 	type Event = Event;