1234567891011121314151617use frame_support::{18 parameter_types,19 traits::{Contains, Everything},20};21use frame_system::EnsureSigned;22use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};23use sp_runtime::traits::Convert;24use xcm::v1::{Junction::*, Junctions::*, MultiLocation, NetworkId};25use xcm::latest::Weight;26use xcm_builder::LocationInverter;27use xcm_executor::XcmExecutor;28use sp_std::{vec, vec::Vec};29use pallet_foreign_assets::{CurrencyId, NativeCurrency};30use crate::{31 Runtime, RuntimeEvent, RelayChainBlockNumberProvider,32 runtime_common::config::{33 xcm::{34 SelfLocation, Weigher, XcmConfig, Ancestry,35 xcm_assets::{CurrencyIdConvert},36 },37 pallets::TreasuryAccountId,38 substrate::{MaxLocks, MaxReserves},39 },40};4142use up_common::{43 types::{AccountId, Balance},44 constants::*,45};464748pub type Amount = i128;4950parameter_types! {51 pub const MinVestedTransfer: Balance = 10 * UNIQUE;52 pub const MaxVestingSchedules: u32 = 28;5354 pub const BaseXcmWeight: Weight = 100_000_000; 55 pub const MaxAssetsForTransfer: usize = 2;56}5758parameter_type_with_key! {59 pub ParachainMinFee: |_location: MultiLocation| -> Option<u128> {60 Some(100_000_000_000)61 };62}6364parameter_type_with_key! {65 pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {66 match currency_id {67 CurrencyId::NativeAssetId(symbol) => match symbol {68 NativeCurrency::Here => 0,69 NativeCurrency::Parent=> 0,70 },71 _ => 100_00072 }73 };74}7576pub fn get_all_module_accounts() -> Vec<AccountId> {77 vec![TreasuryAccountId::get()]78}7980pub struct DustRemovalWhitelist;81impl Contains<AccountId> for DustRemovalWhitelist {82 fn contains(a: &AccountId) -> bool {83 get_all_module_accounts().contains(a)84 }85}8687pub struct AccountIdToMultiLocation;88impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {89 fn convert(account: AccountId) -> MultiLocation {90 X1(AccountId32 {91 network: NetworkId::Any,92 id: account.into(),93 })94 .into()95 }96}9798impl orml_vesting::Config for Runtime {99 type RuntimeEvent = RuntimeEvent;100 type Currency = pallet_balances::Pallet<Runtime>;101 type MinVestedTransfer = MinVestedTransfer;102 type VestedTransferOrigin = EnsureSigned<AccountId>;103 type WeightInfo = ();104 type MaxVestingSchedules = MaxVestingSchedules;105 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;106}107108impl orml_tokens::Config for Runtime {109 type RuntimeEvent = RuntimeEvent;110 type Balance = Balance;111 type Amount = Amount;112 type CurrencyId = CurrencyId;113 type WeightInfo = ();114 type ExistentialDeposits = ExistentialDeposits;115 type OnDust = orml_tokens::TransferDust<Runtime, TreasuryAccountId>;116 type OnSlash = ();117 type OnTransfer = ();118 type OnDeposit = ();119 type MaxLocks = MaxLocks;120 type MaxReserves = MaxReserves;121 122 type DustRemovalWhitelist = DustRemovalWhitelist;123 124 type ReserveIdentifier = ();125 type OnNewTokenAccount = ();126 type OnKilledTokenAccount = ();127}128129impl orml_xtokens::Config for Runtime {130 type RuntimeEvent = RuntimeEvent;131 type Balance = Balance;132 type CurrencyId = CurrencyId;133 type CurrencyIdConvert = CurrencyIdConvert;134 type AccountIdToMultiLocation = AccountIdToMultiLocation;135 type SelfLocation = SelfLocation;136 type XcmExecutor = XcmExecutor<XcmConfig<Self>>;137 type Weigher = Weigher;138 type BaseXcmWeight = BaseXcmWeight;139 type LocationInverter = LocationInverter<Ancestry>;140 type MaxAssetsForTransfer = MaxAssetsForTransfer;141 type MinXcmFee = ParachainMinFee;142 type MultiLocationsFilter = Everything;143 type ReserveProvider = AbsoluteReserveProvider;144}