Closed HenriqueNogara closed 5 months ago
This PR updates our staking pallet to use the new macros. This also makes our code easier to compare to the substrate code.
Most relevant changes:
Adds two new associated types (MaxUnlockingChunksand MaxNominations);
MaxUnlockingChunks
MaxNominations
All Polymesh custom types were moved to pallets/staking/src/types.rs;
pallets/staking/src/types.rs
All pallet definitions were moved to pallets/staking/src/pallet/mod.rs, this includes Config, Storage, Event, Error, Hooks and Call;
pallets/staking/src/pallet/mod.rs
All functions that are not extrinsics were moved to pallets/staking/src/pallet/impls.rs;
pallets/staking/src/pallet/impls.rs
The StakingLedger struct is now generic over T: Config;
StakingLedger
T: Config
The Nominations struct is now generic over T: Config, and Nominations::targets is now a BoundedVec not a Vec;
Nominations
Nominations::targets
BoundedVec
Vec
The inner function slashable_balance_of_fn was renamed weight_of_fn;
slashable_balance_of_fn
weight_of_fn
The inner function collect_exposure was renamed collect_exposures;
collect_exposure
collect_exposures
Adds two error variants: BoundNotMet, TooManyNominators;
BoundNotMet
TooManyNominators
Note: on_runtime_upgrade was removed;
on_runtime_upgrade
This PR updates our staking pallet to use the new macros. This also makes our code easier to compare to the substrate code.
Most relevant changes:
Adds two new associated types (
MaxUnlockingChunks
andMaxNominations
);All Polymesh custom types were moved to
pallets/staking/src/types.rs
;All pallet definitions were moved to
pallets/staking/src/pallet/mod.rs
, this includes Config, Storage, Event, Error, Hooks and Call;All functions that are not extrinsics were moved to
pallets/staking/src/pallet/impls.rs
;The
StakingLedger
struct is now generic overT: Config
;The
Nominations
struct is now generic overT: Config
, andNominations::targets
is now aBoundedVec
not aVec
;The inner function
slashable_balance_of_fn
was renamedweight_of_fn
;The inner function
collect_exposure
was renamedcollect_exposures
;Adds two error variants:
BoundNotMet
,TooManyNominators
;Note:
on_runtime_upgrade
was removed;changelog
new features
modified external API
BoundNotMet
,TooManyNominators
to the staking pallet Error;