Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion currencies/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl ExtBuilder {
.unwrap();

orml_tokens::GenesisConfig::<Runtime> {
endowed_accounts: self
balances: self
.endowed_accounts
.into_iter()
.filter(|(_, currency_id, _)| *currency_id != NATIVE_CURRENCY_ID)
Expand Down
12 changes: 5 additions & 7 deletions tokens/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,13 @@ pub mod module {

#[pallet::genesis_config]
pub struct GenesisConfig<T: Config> {
pub endowed_accounts: Vec<(T::AccountId, T::CurrencyId, T::Balance)>,
pub balances: Vec<(T::AccountId, T::CurrencyId, T::Balance)>,
}

#[cfg(feature = "std")]
impl<T: Config> Default for GenesisConfig<T> {
fn default() -> Self {
GenesisConfig {
endowed_accounts: vec![],
}
GenesisConfig { balances: vec![] }
}
}

Expand All @@ -270,16 +268,16 @@ pub mod module {
fn build(&self) {
// ensure no duplicates exist.
let unique_endowed_accounts = self
.endowed_accounts
.balances
.iter()
.map(|(account_id, currency_id, _)| (account_id, currency_id))
.collect::<std::collections::BTreeSet<_>>();
assert!(
unique_endowed_accounts.len() == self.endowed_accounts.len(),
unique_endowed_accounts.len() == self.balances.len(),
"duplicate endowed accounts in genesis."
);

self.endowed_accounts
self.balances
.iter()
.for_each(|(account_id, currency_id, initial_balance)| {
assert!(
Expand Down
2 changes: 1 addition & 1 deletion tokens/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ impl ExtBuilder {
.unwrap();

tokens::GenesisConfig::<Runtime> {
endowed_accounts: self.endowed_accounts,
balances: self.endowed_accounts,
}
.assimilate_storage(&mut t)
.unwrap();
Expand Down