Trait xcm_executor::traits::WeightTrader
source · pub trait WeightTrader: Sized {
fn new() -> Self;
fn buy_weight(
&mut self,
weight: Weight,
payment: Assets
) -> Result<Assets, XcmError>;
fn refund_weight(&mut self, _weight: Weight) -> Option<MultiAsset> { ... }
}Expand description
Charge for weight in order to execute XCM.
A WeightTrader may also be put into a tuple, in which case the default behavior of
buy_weight and refund_weight would be to attempt to call each tuple element’s own
implementation of these two functions, in the order of which they appear in the tuple,
returning early when a successful result is returned.
Required Methods§
sourcefn buy_weight(
&mut self,
weight: Weight,
payment: Assets
) -> Result<Assets, XcmError>
fn buy_weight(
&mut self,
weight: Weight,
payment: Assets
) -> Result<Assets, XcmError>
Purchase execution weight credit in return for up to a given payment. If less of the
payment is required then the surplus is returned. If the payment cannot be used to pay
for the weight, then an error is returned.
Provided Methods§
sourcefn refund_weight(&mut self, _weight: Weight) -> Option<MultiAsset>
fn refund_weight(&mut self, _weight: Weight) -> Option<MultiAsset>
Attempt a refund of weight into some asset. The caller does not guarantee that the weight was
purchased using buy_weight.
Default implementation refunds nothing.