mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Direct XCM ExportMessage fees for different bridges to different receiver accounts (#2021)
This commit is contained in:
@@ -248,7 +248,7 @@ impl<Config: config::Config> ExecuteXcm<Config::RuntimeCall> for XcmExecutor<Con
|
||||
for asset in fees.inner() {
|
||||
Config::AssetTransactor::withdraw_asset(&asset, &origin, None)?;
|
||||
}
|
||||
Config::FeeManager::handle_fee(fees, None);
|
||||
Config::FeeManager::handle_fee(fees, None, FeeReason::ChargeFees);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -851,7 +851,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
|
||||
destination,
|
||||
xcm,
|
||||
)?;
|
||||
self.take_fee(fee, FeeReason::Export(network))?;
|
||||
self.take_fee(fee, FeeReason::Export { network, destination })?;
|
||||
Config::MessageExporter::deliver(ticket)?;
|
||||
Ok(())
|
||||
},
|
||||
@@ -962,7 +962,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
|
||||
} else {
|
||||
self.holding.try_take(fee.into()).map_err(|_| XcmError::NotHoldingFees)?.into()
|
||||
};
|
||||
Config::FeeManager::handle_fee(paid, Some(&self.context));
|
||||
Config::FeeManager::handle_fee(paid, Some(&self.context), reason);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ use xcm::prelude::*;
|
||||
|
||||
/// Handle stuff to do with taking fees in certain XCM instructions.
|
||||
pub trait FeeManager {
|
||||
/// Determine if a fee which would normally payable should be waived.
|
||||
/// Determine if a fee should be waived.
|
||||
fn is_waived(origin: Option<&MultiLocation>, r: FeeReason) -> bool;
|
||||
|
||||
/// Do something with the fee which has been paid. Doing nothing here silently burns the
|
||||
/// fees.
|
||||
fn handle_fee(fee: MultiAssets, context: Option<&XcmContext>);
|
||||
fn handle_fee(fee: MultiAssets, context: Option<&XcmContext>, r: FeeReason);
|
||||
}
|
||||
|
||||
/// Context under which a fee is paid.
|
||||
@@ -42,7 +42,7 @@ pub enum FeeReason {
|
||||
/// When the `QueryPallet` instruction is called.
|
||||
QueryPallet,
|
||||
/// When the `ExportMessage` instruction is called (and includes the network ID).
|
||||
Export(NetworkId),
|
||||
Export { network: NetworkId, destination: InteriorMultiLocation },
|
||||
/// The `charge_fees` API.
|
||||
ChargeFees,
|
||||
/// When the `LockAsset` instruction is called.
|
||||
@@ -55,5 +55,6 @@ impl FeeManager for () {
|
||||
fn is_waived(_: Option<&MultiLocation>, _: FeeReason) -> bool {
|
||||
false
|
||||
}
|
||||
fn handle_fee(_: MultiAssets, _: Option<&XcmContext>) {}
|
||||
|
||||
fn handle_fee(_: MultiAssets, _: Option<&XcmContext>, _: FeeReason) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user