Gelato Network

Restricting msg.sender

Dedicated msg.sender

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 OpsReady
OpsReady 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"

Switching off using your dedicated msg.sender

Although we recommend that you use the dedicated msg.sender feature you can switch it off and have Gelato Automate will execute your task directly. In the Automate app you can switch this off by opening the Advanced settings options when creating a task:
Advanced settings options