Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Migrate pallet-assets (#260)
Browse files Browse the repository at this point in the history
* Anchor polkadot-v0.9.36

* Companion for paritytech/cumulus#1860

* Companion for paritytech/cumulus#1876

* Companion for paritytech/cumulus#1904

* Companion for paritytech/substrate#12310

* Companion for paritytech/substrate#12740

* Bump array-bytes to 6.0.0

* Companion for paritytech/substrate#12868

* Companion for paritytech/cumulus#1930

* Companion for paritytech/cumulus#1905

* Companion for paritytech/cumulus#1880

* Companion for paritytech/cumulus#1997

* Companion for paritytech/cumulus#1559

* Prepare messages-substrate

* Companion for paritytech/substrate#12684

* Companion for paritytech/substrate#12740

* Fix compile  paritytech/substrate#12740

* Compile done

* Format

* Add call index

* Compile done

* Fix CI

* Bump moonbeam

* Fix CI

* Try fix tests

* Use into instead of `Compact`

* Patch substrate & Fix compile

* Fix try-runtime

* Remove parity-util-mem

* Companion for paritytech/substrate#12310

* Update state processor

* Add type link

* Fix review issues

* Format

---------

Co-authored-by: Guantong <[email protected]>
  • Loading branch information
boundless-forest and Guantong authored Feb 8, 2023
1 parent ead3449 commit b69b7b5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
pallet_assets::migration::v1::MigrateToV1<Runtime>,
>;

/// Darwinia proposal base fee.
Expand Down
2 changes: 1 addition & 1 deletion tool/state-processor/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ where
sufficients: Default::default(),
accounts: Default::default(),
approvals: Default::default(),
is_frozen: false,
status: Default::default(),
};

log::info!("increase `EVM::AccountCodes`'s `sufficients` and set `Assets::Account`, `System::Account`, `AccountMigration::KtonAccounts` and `AccountMigration::Accounts`");
Expand Down
7 changes: 6 additions & 1 deletion tool/state-processor/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,15 @@ fn asset_creation() {
&blake2_128_concat_to_string(KTON_ID.encode()),
&mut details,
);
assert!(details.accounts > 0);
assert_eq!(details.owner, ROOT);
assert!(details.supply != 0);
assert_eq!(details.deposit, 0);
assert_eq!(details.min_balance, 1);
assert_eq!(details.is_sufficient, true);
assert_eq!(details.sufficients, details.accounts);
assert!(details.accounts > 0);
assert_eq!(details.approvals, 0);
assert_eq!(details.status, AssetStatus::Live);
});
}

Expand Down
15 changes: 14 additions & 1 deletion tool/state-processor/src/type_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,20 @@ pub struct AssetDetails {
pub accounts: u32,
pub sufficients: u32,
pub approvals: u32,
pub is_frozen: bool,
pub status: AssetStatus,
}

// https://github.com/paritytech/substrate/blob/polkadot-v0.9.36/frame/assets/src/types.rs#L35
#[derive(Debug, Encode, Decode, PartialEq)]
pub enum AssetStatus {
Live,
Frozen,
Destroying,
}
impl Default for AssetStatus {
fn default() -> Self {
AssetStatus::Live
}
}

// https://github.dev/paritytech/substrate/blob/polkadot-v0.9.30/frame/assets/src/types.rs#L115
Expand Down

0 comments on commit b69b7b5

Please sign in to comment.