git.delta.rocks / unique-network / refs/commits / c748379d3a67

difftreelog

source

runtime/common/config/orml.rs3.0 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use frame_support::{parameter_types, traits::Everything};18use frame_system::EnsureSigned;19use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};20use pallet_foreign_assets::CurrencyIdConvert;21use sp_runtime::traits::Convert;22use staging_xcm::latest::{Junction::*, Junctions::*, MultiLocation, Weight};23use staging_xcm_executor::XcmExecutor;24use up_common::{25	constants::*,26	types::{AccountId, Balance},27};28use up_data_structs::CollectionId;2930use crate::{31	runtime_common::config::xcm::{SelfLocation, UniversalLocation, Weigher, XcmExecutorConfig},32	RelayChainBlockNumberProvider, Runtime, RuntimeEvent,33};3435// Signed version of balance36pub type Amount = i128;3738parameter_types! {39	pub const MinVestedTransfer: Balance = 10 * UNIQUE;40	pub const MaxVestingSchedules: u32 = 28;4142	pub const BaseXcmWeight: Weight = Weight::from_parts(100_000_000, 1000); // ? TODO: recheck this43	pub const MaxAssetsForTransfer: usize = 2;44}4546parameter_type_with_key! {47	pub ParachainMinFee: |_location: MultiLocation| -> Option<u128> {48		Some(100_000_000_000)49	};50}5152pub struct AccountIdToMultiLocation;53impl Convert<AccountId, MultiLocation> for AccountIdToMultiLocation {54	fn convert(account: AccountId) -> MultiLocation {55		X1(AccountId32 {56			network: None,57			id: account.into(),58		})59		.into()60	}61}6263impl orml_vesting::Config for Runtime {64	type RuntimeEvent = RuntimeEvent;65	type Currency = pallet_balances::Pallet<Runtime>;66	type MinVestedTransfer = MinVestedTransfer;67	type VestedTransferOrigin = EnsureSigned<AccountId>;68	type WeightInfo = ();69	type MaxVestingSchedules = MaxVestingSchedules;70	type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;71}7273impl orml_xtokens::Config for Runtime {74	type RuntimeEvent = RuntimeEvent;75	type Balance = Balance;76	type CurrencyId = CollectionId;77	type CurrencyIdConvert = CurrencyIdConvert<Self>;78	type AccountIdToMultiLocation = AccountIdToMultiLocation;79	type SelfLocation = SelfLocation;80	type XcmExecutor = XcmExecutor<XcmExecutorConfig<Self>>;81	type Weigher = Weigher;82	type BaseXcmWeight = BaseXcmWeight;83	type MaxAssetsForTransfer = MaxAssetsForTransfer;84	type MinXcmFee = ParachainMinFee;85	type MultiLocationsFilter = Everything;86	type ReserveProvider = AbsoluteReserveProvider;87	type UniversalLocation = UniversalLocation;88}