-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Migrate remaining old decl_* macros to the new pallet attribute macros #12271
Changes from all commits
7e0ed4c
54afbca
99d9f6a
bf5d62d
7b440c7
a7c9af9
0f5ce13
78521d7
fe4f7c5
c1369b0
eee38f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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>); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I know. This syntax was added as some shortcut. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i would not be against removing these shortcuts if you find it confusing. End of the day, no one writes this line by hand, they just copy some template. |
||||||
|
|
||||||
| #[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(()) | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.