【发布时间】:2019-06-14 13:33:16
【问题描述】:
在基板中实现运行时模块时,给定以下存储
decl_storage! {
trait Store for Module<T: Trait> as CatAuction {
Kitties get(kitties): map T::Hash => Kitty<T::Hash, T::Balance>;
KittyOwner get(owner_of): map T::Hash => Option<T::AccountId>;
OwnedKitties get(kitties_owned): map T::AccountId => T::Hash;
pub AllKittiesCount get(all_kitties_cnt): u64;
Nonce: u64;
// if you want to initialize value in storage, use genesis block
}
}
pub在AllKittiesCount前面的目的是什么?因为不管有没有pub,polkadot UI 还是可以查询到的,就好像它是一个公共变量一样。
【问题讨论】:
-
我们是否告诉您在教程中的某处使用
pub?或者这只是一个附带问题? -
@ShawnTabrizi 遍历decl_storage! doc,说基本存储可以这样扩展:
#vis #name get(#getter) config(#field_name) build(#closure): #type = #default;#vis: Set the visibility of the structure. pub or nothing...