I cloned this template. There is a code like this:
decl_storage! {
trait Store for Module<T: Trait> as TemplateModule {
Something get(fn something): Option<u32>;
}
}
What does Something get(fn something): Option<u32>;
mean?
Especially what is Something
before get(fn something)
?
Apparently this macro accepts custom syntax, as documented in https://substrate.dev/rustdocs/v2.0.0-rc5/frame_support/macro.decl_storage.html:
Basic storage can be extended as such:
#vis #name get(fn #getter) config(#field_name) build(#closure): #type = #default;
- #vis: Set the visibility of the structure. pub or nothing.
- #name: Name of the storage item, used as a prefix in storage.
- [optional] get(fn #getter): Implements the function #getter to Module.
- [optional] config(#field_name): field_name is optional if get is set. Will include the item in GenesisConfig.
- [optional] build(#closure): Closure called with storage overlays.
- #type: Storage type.
- [optional] #default: Value returned when none.
So in your Something
is the name of the storage item, used as a prefix in storage.