frame_support::pallet_prelude: reexport StorageVersion (#11408)

* frame_support::pallet_prelude: reexport StorageVersion

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* cargo fmt

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
Qinxuan Chen
2022-05-18 02:28:34 +08:00
committed by GitHub
parent f64470529e
commit 8bce841d70
16 changed files with 44 additions and 51 deletions
+9 -9
View File
@@ -114,7 +114,7 @@ use codec::{Encode, HasCompact};
use frame_support::{
dispatch::Dispatchable,
ensure,
traits::{Contains, Currency, Get, Randomness, ReservableCurrency, StorageVersion, Time},
traits::{Contains, Currency, Get, Randomness, ReservableCurrency, Time},
weights::{DispatchClass, GetDispatchInfo, Pays, PostDispatchInfo, Weight},
};
use frame_system::{limits::BlockWeights, Pallet as System};
@@ -133,9 +133,6 @@ type TrieId = Vec<u8>;
type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
/// The current storage version.
const STORAGE_VERSION: StorageVersion = StorageVersion::new(7);
/// Used as a sentinel value when reading and writing contract memory.
///
/// It is usually used to signal `None` to a contract when only a primitive is allowed
@@ -222,6 +219,14 @@ pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
/// The current storage version.
const STORAGE_VERSION: StorageVersion = StorageVersion::new(7);
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
#[pallet::without_storage_info]
pub struct Pallet<T>(PhantomData<T>);
#[pallet::config]
pub trait Config: frame_system::Config {
/// The time implementation used to supply timestamps to conntracts through `seal_now`.
@@ -353,11 +358,6 @@ pub mod pallet {
type AddressGenerator: AddressGenerator<Self>;
}
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
#[pallet::without_storage_info]
pub struct Pallet<T>(PhantomData<T>);
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T>
where
@@ -28,8 +28,6 @@ use sp_std::{marker::PhantomData, prelude::*};
/// Wrapper for all migrations of this pallet, based on `StorageVersion`.
pub fn migrate<T: Config>() -> Weight {
use frame_support::traits::StorageVersion;
let version = StorageVersion::get::<Pallet<T>>();
let mut weight: Weight = 0;