mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 22:21:07 +00:00
helper macro to create storage types on the fly (#8456)
* helper macro to create storage types on the fly * Update frame/support/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * update lock * fix test; * Fix line width Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
@@ -1036,30 +1036,15 @@ pub mod migrations {
|
||||
|
||||
pub mod v6 {
|
||||
use super::*;
|
||||
use frame_support::{traits::Get, weights::Weight, pallet_prelude::*};
|
||||
|
||||
macro_rules! generate_storage_types {
|
||||
($name:ident => Value<$value:ty>) => {
|
||||
paste::paste! {
|
||||
struct [<$name Instance>];
|
||||
impl frame_support::traits::StorageInstance for [<$name Instance>] {
|
||||
fn pallet_prefix() -> &'static str {
|
||||
"Staking"
|
||||
}
|
||||
const STORAGE_PREFIX: &'static str = stringify!($name);
|
||||
}
|
||||
type $name = StorageValue<[<$name Instance>], $value, ValueQuery>;
|
||||
}
|
||||
}
|
||||
}
|
||||
use frame_support::{traits::Get, weights::Weight, generate_storage_alias};
|
||||
|
||||
// NOTE: value type doesn't matter, we just set it to () here.
|
||||
generate_storage_types!(SnapshotValidators => Value<()>);
|
||||
generate_storage_types!(SnapshotNominators => Value<()>);
|
||||
generate_storage_types!(QueuedElected => Value<()>);
|
||||
generate_storage_types!(QueuedScore => Value<()>);
|
||||
generate_storage_types!(EraElectionStatus => Value<()>);
|
||||
generate_storage_types!(IsCurrentSessionFinal => Value<()>);
|
||||
generate_storage_alias!(Staking, SnapshotValidators => Value<()>);
|
||||
generate_storage_alias!(Staking, SnapshotNominators => Value<()>);
|
||||
generate_storage_alias!(Staking, QueuedElected => Value<()>);
|
||||
generate_storage_alias!(Staking, QueuedScore => Value<()>);
|
||||
generate_storage_alias!(Staking, EraElectionStatus => Value<()>);
|
||||
generate_storage_alias!(Staking, IsCurrentSessionFinal => Value<()>);
|
||||
|
||||
/// check to execute prior to migration.
|
||||
pub fn pre_migrate<T: Config>() -> Result<(), &'static str> {
|
||||
|
||||
Reference in New Issue
Block a user