You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Something we can't do at the moment is to use the same module with two instance with two different configuration. If one module wants 2 balances for example it is not possible.
I propose a way to do that:
pubtraitBalance{}mod balances {pubstructInstance0;pubstructInstance1;pubtraitTrait<Instance = Instance0>{}pubstructModule<T:Trait<Instance>,Instance = Instance0>{_p: core::marker::PhantomData<(T,Instance)>,}impl<T:Trait<Instance>,Instance>super::BalanceforModule<T,Instance>{}}// A module using two balancesmod example1 {pubtraitTrait{typebalance:super::Balance;typebalance1:super::Balance;}}// A module that is bound to the default balances// The same way as the old way, no breakagemod example2 {pubtraitTrait:super::balances::Trait{}}// A module that is bound to the instance1 balancesmod example3 {pubtraitTrait:super::balances::Trait<super::balances::Instance1>{}}structRuntime;// Default instance implementation is same as the old way,// no breakageimpl balances::TraitforRuntime{}impl balances::Trait<balances::Instance1>forRuntime{}impl example1::TraitforRuntime{// same as the old way, no breakagetypebalance = balances::Module<Self>;typebalance1 = balances::Module<Self, balances::Instance1>;}impl example2::TraitforRuntime{}impl example3::TraitforRuntime{}fnmain(){let _ = Runtime;}
To do so we need to modify decl_module! to be able to declare such a module.
If this is wanted I would like to work on it.