Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
PriceForSiblingDelivery replaced by `runtime::common::PriceForParac…
Browse files Browse the repository at this point in the history
…hainDelivery` (#3012)
  • Loading branch information
bkontur authored Aug 15, 2023
1 parent 234b821 commit 6ff38fa
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions pallets/xcmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use frame_support::{
traits::{EnsureOrigin, Get},
weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight},
};
use polkadot_runtime_common::xcm_sender::ConstantPrice;
use polkadot_runtime_common::xcm_sender::PriceForParachainDelivery;
use rand_chacha::{
rand_core::{RngCore, SeedableRng},
ChaChaRng,
Expand Down Expand Up @@ -107,7 +107,7 @@ pub mod pallet {
type ControllerOriginConverter: ConvertOrigin<Self::RuntimeOrigin>;

/// The price for delivering an XCM to a sibling parachain destination.
type PriceForSiblingDelivery: PriceForSiblingDelivery;
type PriceForSiblingDelivery: PriceForParachainDelivery;

/// The weight information of this pallet.
type WeightInfo: WeightInfo;
Expand Down Expand Up @@ -1137,22 +1137,6 @@ impl<T: Config> XcmpMessageSource for Pallet<T> {
}
}

pub trait PriceForSiblingDelivery {
fn price_for_sibling_delivery(id: ParaId, message: &Xcm<()>) -> MultiAssets;
}

impl PriceForSiblingDelivery for () {
fn price_for_sibling_delivery(_: ParaId, _: &Xcm<()>) -> MultiAssets {
MultiAssets::new()
}
}

impl<T: Get<MultiAssets>> PriceForSiblingDelivery for ConstantPrice<T> {
fn price_for_sibling_delivery(_: ParaId, _: &Xcm<()>) -> MultiAssets {
T::get()
}
}

/// Xcm sender for sending to a sibling parachain.
impl<T: Config> SendXcm for Pallet<T> {
type Ticket = (ParaId, VersionedXcm<()>);
Expand All @@ -1168,7 +1152,7 @@ impl<T: Config> SendXcm for Pallet<T> {
MultiLocation { parents: 1, interior: X1(Parachain(id)) } => {
let xcm = msg.take().ok_or(SendError::MissingArgument)?;
let id = ParaId::from(*id);
let price = T::PriceForSiblingDelivery::price_for_sibling_delivery(id, &xcm);
let price = T::PriceForSiblingDelivery::price_for_parachain_delivery(id, &xcm);
let versioned_xcm = T::VersionWrapper::wrap_version(&d, xcm)
.map_err(|()| SendError::DestinationUnsupported)?;
Ok(((id, versioned_xcm), price))
Expand Down

0 comments on commit 6ff38fa

Please sign in to comment.