mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 18:21:02 +00:00
Pallet Assets: Create new asset classes from genesis config (#9742)
* Pallet Assets: Allow creating asset classes from genesis config * Add accounts and metadata to genesis config * whitespace fixes * Update more chainspecs * Run rustfmt over code * More formatting fixes * Update frame/assets/src/lib.rs Improve error message Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Update frame/assets/src/lib.rs Improve error message Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -144,9 +144,26 @@ pub(crate) fn hooks() -> Vec<Hook> {
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
let config: pallet_assets::GenesisConfig<Test> = pallet_assets::GenesisConfig {
|
||||
assets: vec![
|
||||
// id, owner, is_sufficient, min_balance
|
||||
(999, 0, true, 1),
|
||||
],
|
||||
metadata: vec![
|
||||
// id, name, symbol, decimals
|
||||
(999, "Token Name".into(), "TOKEN".into(), 10),
|
||||
],
|
||||
accounts: vec![
|
||||
// id, account_id, balance
|
||||
(999, 1, 100),
|
||||
],
|
||||
};
|
||||
|
||||
config.assimilate_storage(&mut storage).unwrap();
|
||||
|
||||
let mut ext: sp_io::TestExternalities = storage.into();
|
||||
ext.execute_with(|| System::set_block_number(1));
|
||||
ext
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user