git.delta.rocks / unique-network / refs/commits / 620331699fb8

difftreelog

feat(app-promo) added `FreezeIdentifier` to runtime impl

PraetorP2023-05-22parent: #af51a41.patch.diff
in: master
Added `MaxFreezes` to `pallet_balances::Config`

3 files changed

modifiedpallets/app-promotion/src/lib.rsdiffbeforeafterboth
--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -826,7 +826,11 @@
 
 		///  Migrates lock state into freeze one
 		///
-		///  # Arguments
+		/// # Permissions
+		///
+		/// * Sudo
+		///
+		///   # Arguments
 		///
 		/// * `origin`: Must be `Signed`.
 		/// * `stakers`: Accounts to be upgraded.
@@ -836,7 +840,7 @@
 			origin: OriginFor<T>,
 			stakers: Vec<T::AccountId>,
 		) -> DispatchResult {
-			ensure_signed(origin)?;
+			ensure_root(origin)?;
 
 			stakers
 				.into_iter()
modifiedruntime/common/config/pallets/app_promotion.rsdiffbeforeafterboth
before · runtime/common/config/pallets/app_promotion.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/>.1617use crate::{18	runtime_common::config::pallets::{TreasuryAccountId, RelayChainBlockNumberProvider},19	Runtime, Balances, BlockNumber, Unique, RuntimeEvent, EvmContractHelpers,20};2122use frame_support::{parameter_types, PalletId};23use sp_arithmetic::Perbill;24use up_common::{25	constants::{UNIQUE, DAYS, RELAY_DAYS},26	types::Balance,27};2829parameter_types! {30	pub const AppPromotionId: PalletId = PalletId(*b"appstake");31	pub const RecalculationInterval: BlockNumber = RELAY_DAYS;32	pub const PendingInterval: BlockNumber = 7 * DAYS;33	pub const Nominal: Balance = UNIQUE;34	pub IntervalIncome: Perbill = Perbill::from_rational(5u32, 10_000);35}3637impl pallet_app_promotion::Config for Runtime {38	type PalletId = AppPromotionId;39	type CollectionHandler = Unique;40	type ContractHandler = EvmContractHelpers;41	type Currency = Balances;42	type WeightInfo = pallet_app_promotion::weights::SubstrateWeight<Self>;43	type TreasuryAccountId = TreasuryAccountId;44	type RelayBlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;45	type RecalculationInterval = RecalculationInterval;46	type PendingInterval = PendingInterval;47	type Nominal = Nominal;48	type IntervalIncome = IntervalIncome;49	type RuntimeEvent = RuntimeEvent;50}
after · runtime/common/config/pallets/app_promotion.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/>.1617use crate::{18	runtime_common::config::pallets::{TreasuryAccountId, RelayChainBlockNumberProvider},19	Runtime, Balances, BlockNumber, Unique, RuntimeEvent, EvmContractHelpers,20};2122use frame_support::{parameter_types, PalletId};23use sp_arithmetic::Perbill;24use up_common::{25	constants::{UNIQUE, DAYS, RELAY_DAYS},26	types::Balance,27};2829parameter_types! {30	pub const AppPromotionId: PalletId = PalletId(*b"appstake");31	pub const RecalculationInterval: BlockNumber = RELAY_DAYS;32	pub const PendingInterval: BlockNumber = 7 * DAYS;33	pub const Nominal: Balance = UNIQUE;34	pub const HoldAndFreezeIdentifier: [u8; 16] = *b"appstakeappstake";35	pub IntervalIncome: Perbill = Perbill::from_rational(5u32, 10_000);36}3738impl pallet_app_promotion::Config for Runtime {39	type PalletId = AppPromotionId;40	type CollectionHandler = Unique;41	type ContractHandler = EvmContractHelpers;42	type Currency = Balances;43	type WeightInfo = pallet_app_promotion::weights::SubstrateWeight<Self>;44	type TreasuryAccountId = TreasuryAccountId;45	type RelayBlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;46	type RecalculationInterval = RecalculationInterval;47	type PendingInterval = PendingInterval;48	type Nominal = Nominal;49	type IntervalIncome = IntervalIncome;50	type RuntimeEvent = RuntimeEvent;51	type FreezeIdentifier = HoldAndFreezeIdentifier;52}
modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -132,6 +132,7 @@
 	pub const ExistentialDeposit: u128 = EXISTENTIAL_DEPOSIT;
 	pub const MaxLocks: u32 = 50;
 	pub const MaxReserves: u32 = 50;
+	pub const MaxFreezes: u32 = 20;
 }
 
 impl pallet_balances::Config for Runtime {
@@ -150,7 +151,7 @@
 	type HoldIdentifier = [u8; 16];
 	type FreezeIdentifier = [u8; 16];
 	type MaxHolds = ();
-	type MaxFreezes = ();
+	type MaxFreezes = MaxFreezes;
 }
 
 parameter_types! {