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

Commit

Permalink
Implement null weight trader (#2957)
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork committed Apr 29, 2021
1 parent ed71f32 commit 9d73c53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions xcm/src/v0/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use super::{MultiLocation, Xcm};
pub enum Error {
Undefined,
Overflow,
/// The operation is intentionally unsupported.
Unimplemented,
UnhandledXcmVersion,
UnhandledXcmMessage,
Expand Down
7 changes: 7 additions & 0 deletions xcm/xcm-executor/src/traits/weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,10 @@ pub trait WeightTrader: Sized {
/// Default implementation refunds nothing.
fn refund_weight(&mut self, _weight: Weight) -> MultiAsset { MultiAsset::None }
}

impl WeightTrader for () {
fn new() -> Self { () }
fn buy_weight(&mut self, _: Weight, _: Assets) -> Result<Assets, Error> {
Err(Error::Unimplemented)
}
}

0 comments on commit 9d73c53

Please sign in to comment.