Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
better documenation about fee handling
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Oct 16, 2024
1 parent 87971b3 commit c7053d1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bridges/snowbridge/primitives/router/src/outbound/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,12 @@ where
ensure!(reserve_assets.len() == 1, TooManyAssets);
let reserve_asset = reserve_assets.get(0).ok_or(AssetResolutionFailed)?;

// If there was a fee specified verify it.
// Enough Fees are collected on Asset Hub, up front and directly from the user, to cover the
// complete cost of the transfer. Any additional fees provided in the XCM program are
// refunded to the beneficairy. We only validate the fee here if its provided to make sure
// the XCM program is well formed. Another way to think about this from an XCM perspective
// would be that the user offered to pay X amount in fees, but we charge 0 of that X amount
// (no fee) and refund X to the user.
if let Some(fee_asset) = fee_asset {
// The fee asset must be the same as the reserve asset.
if fee_asset.id != reserve_asset.id || fee_asset.fun > reserve_asset.fun {
Expand Down Expand Up @@ -374,7 +379,12 @@ where
ensure!(reserve_assets.len() == 1, TooManyAssets);
let reserve_asset = reserve_assets.get(0).ok_or(AssetResolutionFailed)?;

// If there was a fee specified verify it.
// Enough Fees are collected on Asset Hub, up front and directly from the user, to cover the
// complete cost of the transfer. Any additional fees provided in the XCM program are
// refunded to the beneficairy. We only validate the fee here if its provided to make sure
// the XCM program is well formed. Another way to think about this from an XCM perspective
// would be that the user offered to pay X amount in fees, but we charge 0 of that X amount
// (no fee) and refund X to the user.
if let Some(fee_asset) = fee_asset {
// The fee asset must be the same as the reserve asset.
if fee_asset.id != reserve_asset.id || fee_asset.fun > reserve_asset.fun {
Expand Down

0 comments on commit c7053d1

Please sign in to comment.