Context (Verify msg.sender)
anyCall V6 is permissionless so you need to verify the msg.sender on the source chain because anyone can call your destination contract.
This context function exists inside the AnyCallExecutor
contract
Returned Information
address from
: The address on the source chain that called anyCall.uint256 fromChainID
: The source chain id.uint256 nonce
: The total amount of times anyCall has been called.
How to import the context interface
An interface should be created to get the context information, it could be the same interface as the interface for anyCall
.
Getting Context and Verify Sender
Note that the contract address for AnyCallExecutor is different from the address of AnyCallV6Proxy. Use the address of AnyCallExecutor to get Context information.
The address of AnyCallExecutor can be set in constuctor like this
Then context information can be fetched with the following codes and you can use a variable such as verifiedcaller
to verify msg.sender on the source chain is authorized.
Full Example: https://testnet.ftmscan.com/address/0xC939EbeedBdF61f839296cF326e9aE2a84C8022C#code
Last updated