From a22cb1294fcbcb888f5239f0a06976e9b62d2a2d Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Mon, 28 Aug 2023 09:53:35 +0800 Subject: [PATCH] Format & TODO --- pallet/asset-limit/src/lib.rs | 3 +-- runtime/common/src/xcm_configs.rs | 1 + runtime/pangolin/src/migration.rs | 5 ++++- runtime/pangolin/src/pallets/asset_manager.rs | 1 - runtime/pangolin/src/pallets/orml_xtokens.rs | 12 ++++-------- runtime/pangolin/src/pallets/polkadot_xcm.rs | 4 ++-- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pallet/asset-limit/src/lib.rs b/pallet/asset-limit/src/lib.rs index c3559c2ea..55680bde7 100644 --- a/pallet/asset-limit/src/lib.rs +++ b/pallet/asset-limit/src/lib.rs @@ -25,8 +25,6 @@ #![deny(missing_docs)] #![deny(unused_crate_dependencies)] -pub use pallet::*; - #[frame_support::pallet] pub mod pallet { // substrate @@ -87,3 +85,4 @@ pub mod pallet { } } } +pub use pallet::*; diff --git a/runtime/common/src/xcm_configs.rs b/runtime/common/src/xcm_configs.rs index 0ced26d04..ee4a4a08f 100644 --- a/runtime/common/src/xcm_configs.rs +++ b/runtime/common/src/xcm_configs.rs @@ -207,6 +207,7 @@ impl< } } +// TODO: move to other place. #[derive(Clone, Default, Eq, Debug, PartialEq, Ord, PartialOrd, Encode, Decode, TypeInfo)] pub struct AssetRegistrarMetadata { pub name: Vec, diff --git a/runtime/pangolin/src/migration.rs b/runtime/pangolin/src/migration.rs index 74a0ed87e..0669b0513 100644 --- a/runtime/pangolin/src/migration.rs +++ b/runtime/pangolin/src/migration.rs @@ -47,10 +47,13 @@ fn migrate() -> frame_support::weights::Weight { const REVERT_BYTECODE: [u8; 5] = [0x60, 0x00, 0x60, 0x00, 0xFD]; const USDT_ADDRESS: &str = "0x0000000000000000000000000000000000000403"; + EVM::create_account( H160::from_str(USDT_ADDRESS).expect("USDT_ADDRESS is not a valid address"), REVERT_BYTECODE.to_vec(), ); - RuntimeBlockWeights::get().max_block + // frame_support::weights::Weight::zero() + // RuntimeBlockWeights::get().max_block + ::DbWeight::get().reads_writes(5, 5) } diff --git a/runtime/pangolin/src/pallets/asset_manager.rs b/runtime/pangolin/src/pallets/asset_manager.rs index f2fddd94a..e227d9cd5 100644 --- a/runtime/pangolin/src/pallets/asset_manager.rs +++ b/runtime/pangolin/src/pallets/asset_manager.rs @@ -28,7 +28,6 @@ use xcm::latest::prelude::*; // We instruct how to register the Assets // In this case, we tell it to create an Asset in pallet-assets pub struct AssetRegistrar; - impl pallet_asset_manager::AssetRegistrar for AssetRegistrar { #[transactional] fn create_foreign_asset( diff --git a/runtime/pangolin/src/pallets/orml_xtokens.rs b/runtime/pangolin/src/pallets/orml_xtokens.rs index 916d9f698..6fe92c644 100644 --- a/runtime/pangolin/src/pallets/orml_xtokens.rs +++ b/runtime/pangolin/src/pallets/orml_xtokens.rs @@ -25,12 +25,12 @@ use frame_support::{pallet_prelude::*, traits::*}; use sp_std::prelude::*; // Our currencyId. We distinguish for now between SelfReserve, and Others, defined by their Id. -#[derive(Clone, Eq, Debug, PartialEq, Ord, PartialOrd, Encode, Decode, TypeInfo)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, TypeInfo)] pub enum CurrencyId { // Our native token SelfReserve, // Assets representing other chains native tokens - ForeignAsset(crate::AssetId), + ForeignAsset(AssetId), } // How to convert from CurrencyId to MultiLocation @@ -38,7 +38,7 @@ pub struct CurrencyIdtoMultiLocation(sp_std::marker::PhantomDat impl sp_runtime::traits::Convert> for CurrencyIdtoMultiLocation where - AssetXConverter: xcm_executor::traits::Convert, + AssetXConverter: xcm_executor::traits::Convert, { fn convert(currency: CurrencyId) -> Option { match currency { @@ -73,11 +73,7 @@ impl orml_xtokens::Config for Runtime { type BaseXcmWeight = BaseXcmWeight; type CurrencyId = CurrencyId; type CurrencyIdConvert = CurrencyIdtoMultiLocation< - xcm_primitives::AsAssetType< - crate::AssetId, - pallets::asset_manager::AssetType, - AssetManager, - >, + xcm_primitives::AsAssetType, >; type MaxAssetsForTransfer = MaxAssetsForTransfer; // We don't have this case: fee_reserve != non_fee_reserve diff --git a/runtime/pangolin/src/pallets/polkadot_xcm.rs b/runtime/pangolin/src/pallets/polkadot_xcm.rs index 9a11409ed..bea7f1ba7 100644 --- a/runtime/pangolin/src/pallets/polkadot_xcm.rs +++ b/runtime/pangolin/src/pallets/polkadot_xcm.rs @@ -45,7 +45,7 @@ pub type ForeignFungiblesTransactor = xcm_builder::FungiblesAdapter< // Use this currency when it is a fungible asset matching the given location or name: ( xcm_builder::ConvertedConcreteId< - crate::AssetId, + AssetId, Balance, xcm_primitives::AsAssetType< crate::AssetId, @@ -203,7 +203,7 @@ pub type XcmFeesToAccount = xcm_primitives::XcmFeesToAccount< Assets, ( xcm_builder::ConvertedConcreteId< - crate::AssetId, + AssetId, Balance, xcm_primitives::AsAssetType< crate::AssetId,