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
2 changes: 1 addition & 1 deletion runtime/asgard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ impl EnsureOrigin<Origin> for EnsureConfirmAsMultiSig {

impl bifrost_salp::Config for Runtime {
type BancorPool = Bancor;
type BifrostXcmExecutor = BifrostXcmAdaptor<XcmRouter, XcmWeight>;
type BifrostXcmExecutor = BifrostXcmAdaptor<XcmRouter, XcmWeight, WeightToFee>;
type DepositToken = NativeCurrencyId;
type Event = Event;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
Expand Down
2 changes: 1 addition & 1 deletion runtime/dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ impl EnsureOrigin<Origin> for EnsureConfirmAsMultiSig {

impl bifrost_salp::Config for Runtime {
type BancorPool = Bancor;
type BifrostXcmExecutor = BifrostXcmAdaptor<XcmRouter, XcmWeight>;
type BifrostXcmExecutor = BifrostXcmAdaptor<XcmRouter, XcmWeight, WeightToFee>;
type DepositToken = NativeCurrencyId;
type Event = Event;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
Expand Down
14 changes: 10 additions & 4 deletions xcm-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use xcm::{
use xcm_executor::traits::{Convert as xcmConvert, MatchesFungible, TransactAsset};
pub use xcm_executor::XcmExecutor;
mod traits;
use frame_support::weights::WeightToFeePolynomial;
pub use node_primitives::XcmBaseWeight;
pub use traits::{BifrostXcmExecutor, HandleDmpMessage, HandleUmpMessage, HandleXcmpMessage};

Expand Down Expand Up @@ -151,10 +152,15 @@ impl<
}
}

pub struct BifrostXcmAdaptor<XcmSender, BaseXcmWeight>(PhantomData<(XcmSender, BaseXcmWeight)>);
pub struct BifrostXcmAdaptor<XcmSender, BaseXcmWeight, WeightToFee>(
PhantomData<(XcmSender, BaseXcmWeight, WeightToFee)>,
);

impl<XcmSender: SendXcm, BaseXcmWeight: Get<u64>> BifrostXcmExecutor
for BifrostXcmAdaptor<XcmSender, BaseXcmWeight>
impl<
XcmSender: SendXcm,
BaseXcmWeight: Get<u64>,
WeightToFee: WeightToFeePolynomial<Balance = u128>,
> BifrostXcmExecutor for BifrostXcmAdaptor<XcmSender, BaseXcmWeight, WeightToFee>
{
fn transact_weight(weight: u64) -> u64 {
return weight + 4 * BaseXcmWeight::get();
Expand All @@ -169,7 +175,7 @@ impl<XcmSender: SendXcm, BaseXcmWeight: Get<u64>> BifrostXcmExecutor
let mut message = Xcm::WithdrawAsset {
assets: vec![MultiAsset::ConcreteFungible {
id: MultiLocation::Null,
amount: Self::transact_weight(weight) as u128,
amount: WeightToFee::calc(&Self::transact_weight(weight)),
}],
effects: vec![Order::BuyExecution {
fees: MultiAsset::All,
Expand Down