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
)
This allows guaranteed execution on the destination chain and also allows dapps to charge gas fees from users.
Import
Firstly, anyCall needs to be imported as a payable function as below:
The specific fees can be calculated with this helper function in the anyCall contract:
_appID can simply be 0 as it's only used for specific dapps with special setting.
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