mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
Use RuntimeHoldReason for the NIS pallet HoldReason (#7017)
* Use RuntimeHoldReason for the NIS pallet HoldReason * Update substrate * Fixes * Fixes * Fixes * Fixes * Move encoding test to tests.rs
This commit is contained in:
@@ -284,7 +284,7 @@ impl pallet_balances::Config for Runtime {
|
||||
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
||||
type FreezeIdentifier = ();
|
||||
type MaxFreezes = ConstU32<1>;
|
||||
type HoldIdentifier = HoldReason;
|
||||
type HoldIdentifier = RuntimeHoldReason;
|
||||
type MaxHolds = ConstU32<1>;
|
||||
}
|
||||
|
||||
@@ -875,7 +875,7 @@ parameter_types! {
|
||||
Decode,
|
||||
RuntimeDebug,
|
||||
MaxEncodedLen,
|
||||
scale_info::TypeInfo,
|
||||
TypeInfo,
|
||||
)]
|
||||
pub enum ProxyType {
|
||||
Any,
|
||||
@@ -1196,27 +1196,7 @@ parameter_types! {
|
||||
pub const ThawThrottle: (Perquintill, BlockNumber) = (Perquintill::from_percent(25), 5);
|
||||
pub storage NisTarget: Perquintill = Perquintill::zero();
|
||||
pub const NisPalletId: PalletId = PalletId(*b"py/nis ");
|
||||
pub const NisHoldReason: HoldReason = HoldReason::Nis(HoldReasonNis::NftReceipt);
|
||||
}
|
||||
|
||||
/// A reason for placing a hold on funds.
|
||||
#[derive(
|
||||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, Debug, TypeInfo,
|
||||
)]
|
||||
pub enum HoldReason {
|
||||
/// Some reason of the NIS pallet.
|
||||
#[codec(index = 38)]
|
||||
Nis(HoldReasonNis),
|
||||
}
|
||||
|
||||
/// A reason for the NIS pallet placing a hold on funds.
|
||||
#[derive(
|
||||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, MaxEncodedLen, Debug, TypeInfo,
|
||||
)]
|
||||
pub enum HoldReasonNis {
|
||||
/// The NIS Pallet has reserved it for a non-fungible receipt.
|
||||
#[codec(index = 0)]
|
||||
NftReceipt = 0,
|
||||
pub const NisHoldReason: RuntimeHoldReason = RuntimeHoldReason::Nis(pallet_nis::HoldReason::NftReceipt);
|
||||
}
|
||||
|
||||
impl pallet_nis::Config for Runtime {
|
||||
@@ -1416,7 +1396,7 @@ construct_runtime! {
|
||||
Tips: pallet_tips::{Pallet, Call, Storage, Event<T>} = 36,
|
||||
|
||||
// NIS pallet.
|
||||
Nis: pallet_nis::{Pallet, Call, Storage, Event<T>} = 38,
|
||||
Nis: pallet_nis::{Pallet, Call, Storage, Event<T>, HoldReason} = 38,
|
||||
// pub type NisCounterpartInstance = pallet_balances::Instance2;
|
||||
NisCounterpartBalances: pallet_balances::<Instance2> = 45,
|
||||
|
||||
@@ -2152,6 +2132,16 @@ sp_api::impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod encoding_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn nis_hold_reason_encoding_is_correct() {
|
||||
assert_eq!(NisHoldReason::get().encode(), [38, 0]);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "try-runtime"))]
|
||||
mod remote_tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user