Dedicated msg.sender

Adding security by restricting who can execute a particular function

During task creation, you will see an address which will be the msg.sender during your task executions.

If you are the owner of the target contract, we recommend that you have a msg.sender restriction on your smart contract with your dedicated msg.sender whitelisted. This adds additional security as only you, the contract owner can create a task to call your function.

msg.sender restrictions should be added to the function that Gelato will call during execution, not the checker function.

You can have this restriction by inheriting AutomateReady

AutomateReady exposes a modifier onlyDedicatedMsgSender which restricts msg.sender to only task executions created by taskCreator defined in the constructor.

    modifier onlyDedicatedMsgSender() {
        require(msg.sender == dedicatedMsgSender, "Only dedicated msg.sender");

If you would like to have additional callers for your function. You can implement a whitelist like so.

    mapping(address => bool) public whitelisted;

    modifier onlyWhitelisted() {
            whitelisted[msg.sender] || msg.sender == dedicatedMsgSender,
            "Only whitelisted"

Last updated