Migrate remaining old decl_* macros to the new pallet attribute macros (#12271)

* Migrate remaining old decl_* macros to the new pallet attribute macros

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

* Apply review suggestions

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

* Apply review suggestions

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

* use pallet::storage

* Fix dev rpc test

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

* Fix service tests

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

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
Qinxuan Chen
2022-09-22 16:53:51 +08:00
committed by GitHub
parent 8a43b42ab1
commit a395fec070
10 changed files with 206 additions and 107 deletions
+4 -4
View File
@@ -36,7 +36,7 @@ mod pallet_test {
#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(_);
pub struct Pallet<T>(PhantomData<T>);
#[pallet::config]
pub trait Config: frame_system::Config {
@@ -46,21 +46,21 @@ mod pallet_test {
}
#[pallet::storage]
#[pallet::getter(fn heartbeat_after)]
#[pallet::getter(fn value)]
pub(crate) type Value<T: Config> = StorageValue<_, u32, OptionQuery>;
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::weight(0)]
pub fn set_value(origin: OriginFor<T>, n: u32) -> DispatchResult {
let _sender = frame_system::ensure_signed(origin)?;
let _sender = ensure_signed(origin)?;
Value::<T>::put(n);
Ok(())
}
#[pallet::weight(0)]
pub fn dummy(origin: OriginFor<T>, _n: u32) -> DispatchResult {
let _sender = frame_system::ensure_none(origin)?;
let _sender = ensure_none(origin)?;
Ok(())
}