Fix linked map for trait types and Option (#1809)

* Fix linked map for traits.

* Fix Option<_> variant.

*  Improve naming a tad

* Rebuild runtime

* Encapsulate private data in the inner module.

* Bump impl version.

* Fix deriving codec in srml-example.

* Fix derivation without importing parity-codec-derive.

* Fix config() for map.
This commit is contained in:
Tomasz Drwięga
2019-02-18 19:23:00 +01:00
committed by Gav Wood
parent 72bb8ef4c5
commit 9a2f1b2007
12 changed files with 238 additions and 148 deletions
+6
View File
@@ -63,6 +63,10 @@ decl_storage! {
// `fn getter_name(key: KeyType) -> ValueType` for map items.
Dummy get(dummy) config(): Option<T::Balance>;
// A map that has enumerable entries.
Bar get(bar) config(): linked_map T::AccountId => T::Balance;
// this one uses the default, we'll demonstrate the usage of 'mutate' API.
Foo get(foo) config(): T::Balance;
}
@@ -292,6 +296,8 @@ mod tests {
t.extend(balances::GenesisConfig::<Test>::default().build_storage().unwrap().0);
t.extend(GenesisConfig::<Test>{
dummy: 42,
// we configure the map with (key, value) pairs.
bar: vec![(1, 2), (2, 3)],
foo: 24,
}.build_storage().unwrap().0);
t.into()