From 6d117685ad5f9c2a29ca6941c65459e85f27d7a1 Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Thu, 17 Oct 2024 11:44:39 +0200 Subject: [PATCH] Remove duplicate function (#1315) --- contracts/src/Assets.sol | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/contracts/src/Assets.sol b/contracts/src/Assets.sol index f2320e5772..d1fcbcb0b6 100644 --- a/contracts/src/Assets.sol +++ b/contracts/src/Assets.sol @@ -194,36 +194,6 @@ library Assets { emit IGateway.TokenSent(token, sender, destinationChain, destinationAddress, amount); } - function _sendForeignTokenCosts( - ParaID destinationChain, - uint128 destinationChainFee, - uint128 maxDestinationChainFee - ) internal view returns (Costs memory costs) { - AssetsStorage.Layout storage $ = AssetsStorage.layout(); - if ($.assetHubParaID == destinationChain) { - costs.foreign = $.assetHubReserveTransferFee; - } else { - // Reduce the ability for users to perform arbitrage by exploiting a - // favourable exchange rate. For example supplying Ether - // and gaining a more valuable amount of DOT on the destination chain. - // - // Also prevents users from mistakenly sending more fees than would be required - // which has negative effects like draining AssetHub's sovereign account. - // - // For safety, `maxDestinationChainFee` should be less valuable - // than the gas cost to send tokens. - if (destinationChainFee > maxDestinationChainFee) { - revert InvalidDestinationFee(); - } - - // If the final destination chain is not AssetHub, then the fee needs to additionally - // include the cost of executing an XCM on the final destination parachain. - costs.foreign = $.assetHubReserveTransferFee + destinationChainFee; - } - // We don't charge any extra fees beyond delivery costs - costs.native = 0; - } - // @dev Transfer Polkadot-native tokens back to Polkadot function _sendForeignToken( bytes32 foreignID, @@ -240,7 +210,7 @@ library Assets { Token(token).burn(sender, amount); ticket.dest = $.assetHubParaID; - ticket.costs = _sendForeignTokenCosts(destinationChain, destinationChainFee, maxDestinationChainFee); + ticket.costs = _sendTokenCosts(destinationChain, destinationChainFee, maxDestinationChainFee); // Construct a message payload if (destinationChain == $.assetHubParaID && destinationAddress.isAddress32()) {