pub trait XcmFeeTrader {
// Required methods
fn compute_fee(
weight: Weight,
asset_location: &Location,
) -> Result<u128, DispatchError>;
fn get_asset_price(asset_location: &Location) -> Option<u128>;
fn set_asset_price(
_asset_location: Location,
_value: u128,
) -> Result<(), DispatchError>;
fn remove_asset(_asset_location: Location) -> Result<(), DispatchError>;
}Expand description
Trait for computing XCM fees and managing asset pricing. This allows pallets to delegate fee calculation to an external system (e.g., pallet-xcm-weight-trader) instead of maintaining their own storage.
Required Methods§
Sourcefn compute_fee(
weight: Weight,
asset_location: &Location,
) -> Result<u128, DispatchError>
fn compute_fee( weight: Weight, asset_location: &Location, ) -> Result<u128, DispatchError>
Compute the fee amount for a given weight and asset location.
The fee should be calculated based on the weight and asset pricing configured for the given asset location.
Sourcefn get_asset_price(asset_location: &Location) -> Option<u128>
fn get_asset_price(asset_location: &Location) -> Option<u128>
Get the current price/fee-per-second for an asset, if configured. Returns None if the asset is not configured.
Sourcefn set_asset_price(
_asset_location: Location,
_value: u128,
) -> Result<(), DispatchError>
fn set_asset_price( _asset_location: Location, _value: u128, ) -> Result<(), DispatchError>
Set the price/configuration for an asset.
Sourcefn remove_asset(_asset_location: Location) -> Result<(), DispatchError>
fn remove_asset(_asset_location: Location) -> Result<(), DispatchError>
Remove the price/configuration for an asset.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.