Paying for your transactions

Deprecation Notice: Gelato Functions is set to replace Automate, providing enhanced automation capabilities, access to off-chain data, unified payments across networks, and a performance boost. Migrate your tasks to Gelato Functions before Legacy Automate's end of life on June 30th, 2024 for uninterrupted service.

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.

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()

Last updated