Paying for your transactions

When Gelato executes your transaction it needs to pay the transaction fees. The fees can be paid in one of two ways:

  1. From Gelato Balance

  2. Transaction pays for itself

Gelato currently accepts payment in the native network token or its wrapped version for each network that Automate supports. For example, on Ethereum you can pay either in ETH or WETH and on Polygon either in MATiC or WMATIC - and so on for all the other networks we support.

Gelato Balance

This is the easiest option. You simply deposit some tokens into Gelato for each of the network(s) on which you want to execute transactions. Each time an execution occurs, Gelato will deduct the costs from your Gelato Balance to cover the gas costs. In the future we will introduce a small Gelato fee.

If your Gelato Balance is too low to cover the costs of your transaction it will not execute until you top-up your balance. We provide a notification service for you to receive alerts when your balance is running low.

Deposit funds via UI

You can deposit funds into your Gelato Balance on the fund's page.

Deposit funds via smart contract

If your smart contract will be the one creating tasks, it would need its own Gelato balance to pay for the task executions.

If you would like to have your smart contract deposit funds at any point of time into it's Gelato balance, inherit AutomateTaskCreator like so. Learn more about AutomateTaskCreator functions

contract Counter is AutomateTaskCreator {
    
    constructor(address _automate, address _fundsOwner) AutomateTaskCreator(_automate, _fundsOwner) {}

    function depositForCounter() external payable {
        _depositFunds(msg.value, ETH);
    }
}

AutomateTaskCreator exposes withdrawFunds function to allow fundsOwner to withdraw from the contract's Gelato balance.

Transaction pays for itself

You can also choose not to pre-deposit funds into your Gelato balance and have your function pay the fee during executions.

This can be done by inheriting AutomateReady.

contract CounterWT is AutomateReady {
    uint256 public count;
    uint256 public lastExecuted;

    constructor(address _automate, address _taskCreator)
        AutomateReady(_automate, _taskCreator)
    {}

    receive() external payable {}

    function increaseCount(uint256 amount) external onlyDedicatedMsgSender {
        count += amount;
        lastExecuted = block.timestamp;

        (uint256 fee, address feeToken) = _getFeeDetails();

        _transfer(fee, feeToken);
    }
}

In the increaseCount function, we use _transfer inherited from AutomateReady to pay Gelato.

_transfer has two parameters, fee and feeToken which has to be queried from the Automate contract by using getFeeDetails()

feeToken is set when creating your task on the Gelato Automate UI.

Last updated

Change request #272: W3F context including gelato args