Fees Paid on Source Chain
anyCall V6 allows execution gas fees to be paid on the source chain instead of the destination chain.
If you want to pay fees on the source chain, simply set _flags as 2 in the anyCall function.
function anyCall( address _to, bytes calldata _data, address _fallback, uint256 _toChainID, uint256 _flags )
Import
Firstly, anyCall needs to be imported as a payable function as below:
interface CallProxy{
function anyCall(
address _to,
bytes calldata _data,
address _fallback,
uint256 _toChainID,
uint256 _flags
) payable external;
}The specific fees can be calculated with this helper function in the anyCall contract:
The formula is a default fee + fee per byte in the calldata: baseFees + _dataLength * feesPerByte
How is fee paid?
After calculating the correct amount of fees to paid with the helped function, the fee should be paid as msg.value (The native gas token)
Then anyCall can be called with {value:msg.value} to pay fee on source chain.
CallProxy(anycallcontract).anyCall{value: msg.value}
Last updated