1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#![cfg_attr(not(feature = "std"), no_std)]
use eq_primitives::AccountGetter;
use frame_support::{decl_module, decl_storage, traits::Get};
use sp_runtime::{traits::AccountIdConversion, ModuleId};
pub trait Trait<I = DefaultInstance>: system::Trait {
type ModuleId: Get<ModuleId>;
}
decl_storage! {
trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as EqDistribution {}
}
decl_module! {
pub struct Module<T: Trait<I>, I: Instance=DefaultInstance> for enum Call where origin: T::Origin {
const ModuleId: ModuleId = T::ModuleId::get();
}
}
impl<T: Trait<I>, I: Instance> Module<T, I> {
pub fn account_id() -> T::AccountId {
T::ModuleId::get().into_account()
}
}
impl<T: Trait<I>, I: Instance> AccountGetter<T::AccountId> for Module<T, I> {
fn get_account_id() -> T::AccountId {
Self::account_id()
}
}