Skip to content

Commit e24f895

Browse files
gregdhillxlc
authored andcommitted
harmonize tokens genesis config with pallet_balances (#512)
Signed-off-by: Gregory Hill <[email protected]>
1 parent e99fa83 commit e24f895

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

authority/src/lib.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ pub mod module {
167167
FailedToSchedule,
168168
/// Failed to cancel a task.
169169
FailedToCancel,
170-
/// Failed to fast track a task.
171-
FailedToFastTrack,
172-
/// Failed to delay a task.
173-
FailedToDelay,
174170
}
175171

176172
#[pallet::event]
@@ -285,8 +281,7 @@ pub mod module {
285281
};
286282

287283
T::AuthorityConfig::check_fast_track_schedule(origin, &initial_origin, new_delay)?;
288-
T::Scheduler::reschedule_named((&initial_origin, task_id).encode(), when)
289-
.map_err(|_| Error::<T>::FailedToFastTrack)?;
284+
T::Scheduler::reschedule_named((&initial_origin, task_id).encode(), when)?;
290285

291286
Self::deposit_event(Event::FastTracked(initial_origin, task_id, dispatch_at));
292287
Ok(().into())
@@ -305,8 +300,7 @@ pub mod module {
305300
T::Scheduler::reschedule_named(
306301
(&initial_origin, task_id).encode(),
307302
DispatchTime::After(additional_delay),
308-
)
309-
.map_err(|_| Error::<T>::FailedToDelay)?;
303+
)?;
310304

311305
let now = frame_system::Pallet::<T>::block_number();
312306
let dispatch_at = now.saturating_add(additional_delay);

currencies/src/mock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl ExtBuilder {
167167
.unwrap();
168168

169169
orml_tokens::GenesisConfig::<Runtime> {
170-
endowed_accounts: self
170+
balances: self
171171
.endowed_accounts
172172
.into_iter()
173173
.filter(|(_, currency_id, _)| *currency_id != NATIVE_CURRENCY_ID)

tokens/src/lib.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,13 @@ pub mod module {
262262

263263
#[pallet::genesis_config]
264264
pub struct GenesisConfig<T: Config> {
265-
pub endowed_accounts: Vec<(T::AccountId, T::CurrencyId, T::Balance)>,
265+
pub balances: Vec<(T::AccountId, T::CurrencyId, T::Balance)>,
266266
}
267267

268268
#[cfg(feature = "std")]
269269
impl<T: Config> Default for GenesisConfig<T> {
270270
fn default() -> Self {
271-
GenesisConfig {
272-
endowed_accounts: vec![],
273-
}
271+
GenesisConfig { balances: vec![] }
274272
}
275273
}
276274

@@ -279,16 +277,16 @@ pub mod module {
279277
fn build(&self) {
280278
// ensure no duplicates exist.
281279
let unique_endowed_accounts = self
282-
.endowed_accounts
280+
.balances
283281
.iter()
284282
.map(|(account_id, currency_id, _)| (account_id, currency_id))
285283
.collect::<std::collections::BTreeSet<_>>();
286284
assert!(
287-
unique_endowed_accounts.len() == self.endowed_accounts.len(),
285+
unique_endowed_accounts.len() == self.balances.len(),
288286
"duplicate endowed accounts in genesis."
289287
);
290288

291-
self.endowed_accounts
289+
self.balances
292290
.iter()
293291
.for_each(|(account_id, currency_id, initial_balance)| {
294292
assert!(

tokens/src/mock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl ExtBuilder {
274274
.unwrap();
275275

276276
tokens::GenesisConfig::<Runtime> {
277-
endowed_accounts: self.endowed_accounts,
277+
balances: self.endowed_accounts,
278278
}
279279
.assimilate_storage(&mut t)
280280
.unwrap();

0 commit comments

Comments
 (0)