mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 18:31:05 +00:00
HoldReason: Improve usage (#13869)
* HoldReason: Improve usage `HoldReason` was switched recently to use the `composite_enum` attribute that will merge the enums from all pallets in the runtime to `RuntimeHoldReason`. `pallet-nis` was still requiring that the variant was passed as constant to call `hold`. The proper implementation is to use the `HoldReason` from inside the pallet directly when calling `hold`. This is done by adding a `RuntimeHoldReason` as type to the `Config` trait and requiring that `Currency` is using the same reason. Besides that the pr changes the name `HoldIdentifier` in `pallet_balances::Config` to `RuntimeHoldReason`. * Update frame/nis/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review comment * Fixes --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -207,7 +207,7 @@ impl<T: Config<I>, I: 'static> fungible::Mutate<T::AccountId> for Pallet<T, I> {
|
||||
impl<T: Config<I>, I: 'static> fungible::MutateHold<T::AccountId> for Pallet<T, I> {}
|
||||
|
||||
impl<T: Config<I>, I: 'static> fungible::InspectHold<T::AccountId> for Pallet<T, I> {
|
||||
type Reason = T::HoldIdentifier;
|
||||
type Reason = T::RuntimeHoldReason;
|
||||
|
||||
fn total_balance_on_hold(who: &T::AccountId) -> T::Balance {
|
||||
Self::account(who).reserved
|
||||
|
||||
@@ -257,8 +257,8 @@ pub mod pallet {
|
||||
/// Use of reserves is deprecated in favour of holds. See `https://github.com/paritytech/substrate/pull/12951/`
|
||||
type ReserveIdentifier: Parameter + Member + MaxEncodedLen + Ord + Copy;
|
||||
|
||||
/// The ID type for holds.
|
||||
type HoldIdentifier: Parameter + Member + MaxEncodedLen + Ord + Copy;
|
||||
/// The overarching hold reason.
|
||||
type RuntimeHoldReason: Parameter + Member + MaxEncodedLen + Ord + Copy;
|
||||
|
||||
/// The ID type for freezes.
|
||||
type FreezeIdentifier: Parameter + Member + MaxEncodedLen + Ord + Copy;
|
||||
@@ -437,7 +437,7 @@ pub mod pallet {
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
T::AccountId,
|
||||
BoundedVec<IdAmount<T::HoldIdentifier, T::Balance>, T::MaxHolds>,
|
||||
BoundedVec<IdAmount<T::RuntimeHoldReason, T::Balance>, T::MaxHolds>,
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ impl Config for Test {
|
||||
type MaxReserves = ConstU32<2>;
|
||||
type ReserveIdentifier = TestId;
|
||||
type WeightInfo = ();
|
||||
type HoldIdentifier = TestId;
|
||||
type RuntimeHoldReason = TestId;
|
||||
type FreezeIdentifier = TestId;
|
||||
type MaxFreezes = ConstU32<2>;
|
||||
type MaxHolds = ConstU32<2>;
|
||||
|
||||
Reference in New Issue
Block a user