diff --git a/runtime/darwinia/src/migration.rs b/runtime/darwinia/src/migration.rs index 0ade34422..41643c08a 100644 --- a/runtime/darwinia/src/migration.rs +++ b/runtime/darwinia/src/migration.rs @@ -43,6 +43,8 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { fn migrate() -> frame_support::weights::Weight { // substrate use pallet_balances::Locks; + use sp_core::H160; + use sp_std::str::FromStr; [ ("0xabcf7060a68f62624f7569ada9d78b5a5db0782a", b"phrelect"), @@ -63,6 +65,13 @@ fn migrate() -> frame_support::weights::Weight { } }); + const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; + // PINK equals to the 0x404 in the pallet-evm runtime. + const ADDRESS: &str = "0x0000000000000000000000000000000000000404"; + if let Ok(addr) = H160::from_str(ADDRESS) { + EVM::create_account(addr, REVERT_BYTECODE.to_vec()); + } + // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(0, 16) + RuntimeBlockWeights::get().max_block } diff --git a/runtime/darwinia/src/pallets/asset_manager.rs b/runtime/darwinia/src/pallets/asset_manager.rs index 347ea88f0..0cfbc4a86 100644 --- a/runtime/darwinia/src/pallets/asset_manager.rs +++ b/runtime/darwinia/src/pallets/asset_manager.rs @@ -102,20 +102,18 @@ impl From for AssetType { // We simply hash the `AssetType` and take the lowest 128 bits. impl From for crate::AssetId { fn from(asset: AssetType) -> crate::AssetId { - use sp_runtime::traits::Hash; - match asset { - AssetType::Xcm(id) => - if id == UsdtLocation::get() { - 1027 - } else { - let mut result: [u8; 8] = [0_u8; 8]; - let hash: sp_core::H256 = id.using_encoded(dc_primitives::Hashing::hash); + AssetType::Xcm(id) if id == UsdtLocation::get() => 1027, + AssetType::Xcm(id) if id == PinkLocation::get() => 1028, + AssetType::Xcm(id) => { + use sp_runtime::traits::Hash; - result.copy_from_slice(&hash.as_fixed_bytes()[0..8]); + let mut result: [u8; 8] = [0_u8; 8]; + let hash: sp_core::H256 = id.using_encoded(dc_primitives::Hashing::hash); + result.copy_from_slice(&hash.as_fixed_bytes()[0..8]); - u64::from_le_bytes(result) - }, + u64::from_le_bytes(result) + }, } } } @@ -131,11 +129,17 @@ impl Into> for AssetType { frame_support::parameter_types! { /// 1000 is AssetHub paraId. /// 50 is pallet-assets index on AssetHub. - /// 1984 is the id of Test USDT on AssetHub(Polkadot). + /// 1984 is the id of USDT on AssetHub(Polkadot). pub UsdtLocation: MultiLocation = MultiLocation::new( 1, X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)) ); + + /// 23 is the id of PINK on AssetHub(Polkadot). + pub PinkLocation: MultiLocation = MultiLocation::new( + 1, + X3(Parachain(1000), PalletInstance(50), GeneralIndex(23)) + ); } impl pallet_asset_manager::Config for Runtime { diff --git a/runtime/darwinia/src/pallets/evm.rs b/runtime/darwinia/src/pallets/evm.rs index 93530fe38..1b64ae3fd 100644 --- a/runtime/darwinia/src/pallets/evm.rs +++ b/runtime/darwinia/src/pallets/evm.rs @@ -48,7 +48,7 @@ where Self(Default::default()) } - pub fn used_addresses() -> [sp_core::H160; 17] { + pub fn used_addresses() -> [sp_core::H160; 18] { [ addr(0x01), addr(0x02), @@ -63,6 +63,7 @@ where addr(0x401), addr(0x402), // For KTON asset. addr(0x403), // For Tether USDT. + addr(0x404), // For PINK. addr(0x600), addr(0x601), addr(0x602),