Gelato Network
Search…
⌃K

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. 1.
    From Gelato Balance
  2. 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 OpsTaskCreator like so. Learn more about OpsTaskCreator functions
contract Counter is OpsTaskCreator {
constructor(address _ops, address _fundsOwner) OpsTaskCreator(_ops, _fundsOwner) {}
function depositForCounter() external payable {
_depositFunds(msg.value, ETH);
}
}
OpsTaskCreator 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 OpsReady.
contract CounterWT is OpsReady {
uint256 public count;
uint256 public lastExecuted;
constructor(address _ops, address _taskCreator)
OpsReady(_ops, _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 OpsReady 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.