Skip to content

Commit

Permalink
Format & TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier committed Aug 28, 2023
1 parent d7620c0 commit a22cb12
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
3 changes: 1 addition & 2 deletions pallet/asset-limit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#![deny(missing_docs)]
#![deny(unused_crate_dependencies)]

pub use pallet::*;

#[frame_support::pallet]
pub mod pallet {
// substrate
Expand Down Expand Up @@ -87,3 +85,4 @@ pub mod pallet {
}
}
}
pub use pallet::*;
1 change: 1 addition & 0 deletions runtime/common/src/xcm_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
Expand Down
5 changes: 4 additions & 1 deletion runtime/pangolin/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(5, 5)
}
1 change: 0 additions & 1 deletion runtime/pangolin/src/pallets/asset_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Runtime> for AssetRegistrar {
#[transactional]
fn create_foreign_asset(
Expand Down
12 changes: 4 additions & 8 deletions runtime/pangolin/src/pallets/orml_xtokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ 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
pub struct CurrencyIdtoMultiLocation<AssetXConverter>(sp_std::marker::PhantomData<AssetXConverter>);
impl<AssetXConverter> sp_runtime::traits::Convert<CurrencyId, Option<MultiLocation>>
for CurrencyIdtoMultiLocation<AssetXConverter>
where
AssetXConverter: xcm_executor::traits::Convert<MultiLocation, crate::AssetId>,
AssetXConverter: xcm_executor::traits::Convert<MultiLocation, AssetId>,
{
fn convert(currency: CurrencyId) -> Option<MultiLocation> {
match currency {
Expand Down Expand Up @@ -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<AssetId, xcm_configs::AssetType, AssetManager>,
>;
type MaxAssetsForTransfer = MaxAssetsForTransfer;
// We don't have this case: fee_reserve != non_fee_reserve
Expand Down
4 changes: 2 additions & 2 deletions runtime/pangolin/src/pallets/polkadot_xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -203,7 +203,7 @@ pub type XcmFeesToAccount = xcm_primitives::XcmFeesToAccount<
Assets,
(
xcm_builder::ConvertedConcreteId<
crate::AssetId,
AssetId,
Balance,
xcm_primitives::AsAssetType<
crate::AssetId,
Expand Down

0 comments on commit a22cb12

Please sign in to comment.