Account for post dispatch fees

transfer-and-call
Yorke Rhodes 4 months ago
parent 0643b4b2ee
commit 22476311f6
No known key found for this signature in database
GPG Key ID: 9EEACF1DA75C5627
  1. 17
      solidity/contracts/middleware/TransferAndCallRouter.sol

@ -21,17 +21,16 @@ contract TransferAndCall {
IERC20 asset, // not derivable from TokenRouter IERC20 asset, // not derivable from TokenRouter
TokenRouter warpRoute, TokenRouter warpRoute,
CallLib.Call[] calldata calls CallLib.Call[] calldata calls
) public { ) external payable {
asset.transferFrom(msg.sender, address(this), amount); asset.transferFrom(msg.sender, address(this), amount);
address recipient = interchainAccountRouter.getRemoteInterchainAccount( bytes32 self = interchainAccountRouter
.getRemoteInterchainAccount(destination, address(this))
.addressToBytes32();
uint256 warpFee = warpRoute.quoteGasPayment(destination);
warpRoute.transferRemote{value: warpFee}(destination, self, amount);
interchainAccountRouter.callRemote{value: msg.value - warpFee}(
destination, destination,
msg.sender calls
); );
warpRoute.transferRemote(
destination,
recipient.addressToBytes32(),
amount
);
interchainAccountRouter.callRemote(destination, calls);
} }
} }

Loading…
Cancel
Save