mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 08:47:57 +00:00
removed pallet::getter from example pallets (#3371)
part of #3326 @ggwpez @kianenigma @shawntabrizi --------- Signed-off-by: Matteo Muraca <mmuraca247@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -90,9 +90,7 @@ pub mod pallet {
|
||||
///
|
||||
/// In this template, we are declaring a storage item called `Something` that stores a single
|
||||
/// `u32` value. Learn more about runtime storage here: <https://docs.substrate.io/build/runtime-storage/>
|
||||
/// The [`getter`] macro generates a function to conveniently retrieve the value from storage.
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn something)]
|
||||
pub type Something<T> = StorageValue<_, u32>;
|
||||
|
||||
/// Events that functions in this pallet can emit.
|
||||
@@ -187,7 +185,7 @@ pub mod pallet {
|
||||
let _who = ensure_signed(origin)?;
|
||||
|
||||
// Read a value from storage.
|
||||
match Pallet::<T>::something() {
|
||||
match Something::<T>::get() {
|
||||
// Return an error if the value has not been set.
|
||||
None => Err(Error::<T>::NoneValue.into()),
|
||||
Some(old) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{mock::*, Error, Event};
|
||||
use crate::{mock::*, Error, Event, Something};
|
||||
use frame_support::{assert_noop, assert_ok};
|
||||
|
||||
#[test]
|
||||
@@ -9,7 +9,7 @@ fn it_works_for_default_value() {
|
||||
// Dispatch a signed extrinsic.
|
||||
assert_ok!(TemplateModule::do_something(RuntimeOrigin::signed(1), 42));
|
||||
// Read pallet storage and assert an expected result.
|
||||
assert_eq!(TemplateModule::something(), Some(42));
|
||||
assert_eq!(Something::<Test>::get(), Some(42));
|
||||
// Assert that the correct event was deposited
|
||||
System::assert_last_event(Event::SomethingStored { something: 42, who: 1 }.into());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user