Implement null weight trader (#2957)

This commit is contained in:
Gavin Wood
2021-04-29 15:35:07 +02:00
committed by GitHub
parent 1ef8eac8ec
commit ce457a91e1
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -25,6 +25,7 @@ use super::{MultiLocation, Xcm};
pub enum Error { pub enum Error {
Undefined, Undefined,
Overflow, Overflow,
/// The operation is intentionally unsupported.
Unimplemented, Unimplemented,
UnhandledXcmVersion, UnhandledXcmVersion,
UnhandledXcmMessage, UnhandledXcmMessage,
@@ -61,3 +61,10 @@ pub trait WeightTrader: Sized {
/// Default implementation refunds nothing. /// Default implementation refunds nothing.
fn refund_weight(&mut self, _weight: Weight) -> MultiAsset { MultiAsset::None } 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)
}
}