Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions runtime/bifrost/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ xcm-executor = { git = "https://github.com/paritytech/polkadot", default-feature

# Bifrost
pallet-vesting = { package = "bifrost-vesting", path = "../../pallets/vesting", default-features = false }
bifrost-runtime-common = { package = "bifrost-runtime-common", path = "../common", default-features = false }

# orml
orml-currencies = { version = "0.4.1-dev", default-features = false }
Expand Down Expand Up @@ -134,6 +135,7 @@ std = [
"orml-currencies/std",
"orml-traits/std",
"orml-tokens/std",
"bifrost-runtime-common/std",
]
with-tracing = ["frame-executive/with-tracing"]

Expand Down
23 changes: 19 additions & 4 deletions runtime/bifrost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ use sp_version::RuntimeVersion;

/// Constant values used within the runtime.
pub mod constants;
use bifrost_runtime_common::xcm_impl::{
BifrostAssetMatcher, BifrostCurrencyIdConvert, BifrostFilteredAssets, BifrostXcmTransactFilter,
};
use constants::{currency::*, time::*};
use cumulus_primitives_core::ParaId as CumulusParaId;
use frame_support::traits::OnRuntimeUpgrade;
use frame_system::EnsureRoot;
use node_primitives::{Amount, CurrencyId, Moment, Nonce, TokenSymbol};
Expand All @@ -77,6 +81,7 @@ use xcm_builder::{
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
};
use xcm_executor::{Config, XcmExecutor};
use xcm_support::BifrostCurrencyAdapter;

// Weights used in the runtime.
mod weights;
Expand Down Expand Up @@ -309,6 +314,7 @@ parameter_types! {
pub const KsmLocation: MultiLocation = X1(Parent);
pub const RelayNetwork: NetworkId = NetworkId::Kusama;
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
pub SelfParaChainId: CumulusParaId = ParachainInfo::parachain_id();
pub Ancestry: MultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));
}

Expand Down Expand Up @@ -380,16 +386,25 @@ pub type Barrier = (
AllowTopLevelPaidExecutionFrom<All<MultiLocation>>,
// ^^^ Parent & its unit plurality gets free execution
AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,
BifrostXcmTransactFilter<All<MultiLocation>>,
);

pub type BifrostAssetTransactor = BifrostCurrencyAdapter<
Tokens,
BifrostAssetMatcher<CurrencyId, BifrostCurrencyIdConvert<SelfParaChainId>>,
AccountId,
LocationToAccountId,
CurrencyId,
BifrostCurrencyIdConvert<SelfParaChainId>,
>;

pub struct XcmConfig;
impl Config for XcmConfig {
// How to withdraw and deposit an asset.
type AssetTransactor = LocalAssetTransactor;
type AssetTransactor = BifrostAssetTransactor;
type Barrier = Barrier;
type Call = Call;
type IsReserve = NativeAsset;
type IsTeleporter = NativeAsset;
type IsReserve = BifrostFilteredAssets;
type IsTeleporter = BifrostFilteredAssets;
// <- should be enough to allow teleportation of ROC
type LocationInverter = LocationInverter<Ancestry>;
type OriginConverter = XcmOriginToTransactDispatchOrigin;
Expand Down