Payment Types
Gelato Relay SDK supports various payment types for maximum flexibility
Upon sending messages and signatures to Gelato Relay API, Gelato Executors will acknowledge and execute them as soon as they are ready, hence paying gas fees in native token. Gelato Executors can have their fee costs refunded, plus a small fraction as incentive, in one of the following options:
Payment Type
Description
Synchronous Payment (Type 0)
The target smart contract will pay Gelato Relay's smart contract as the call is forwarded. Payment can be done in feeToken, where it is expected to be a whitelisted payment token.
Asynchronous Gas Tank Payment (Type 1)
The sponsor must hold a balance in one of Gelato's Gas Tank smart contracts. The balance could even be held on a different chainId than the one the transaction is being relayed on (as defined by sponsorChainId). An event is emitted to tell Gelato how much to charge in the future, which shall be acknowledged in an off-chain accounting system. A sponsor signature is expected in order to ensure that the sponsor agrees on being charged up to a maxFee amount.
Synchronous Gas Tank Payment (Type 2)
Similar to Type 1, but sponsor is expected to hold a balance with Gelato on the same chainId where the transaction is executed. Fee deduction happens during the transaction. A sponsor signature is expected in order to ensure that the sponsor agrees on being charged up to a maxFee amount.
Synchronous Pull Fee Payment (Type 3)
In this scenario a sponsor pre-approves the appropriate Gelato Relay's smart contract to spend tokens up so some maximum allowance value. During execution of the transaction, Gelato will credit due fees using IERC20(feeToken).transferFrom(...) in order to pull fees from his/her account. A sponsor signature is expected in order to ensure that the sponsor agrees on being charged up to a maxFee amount.
Payment of type 0 is the simplest one, as it requires no sponsor signature to be provided, but it assumes that the target smart contract refunds msg.sender due amount of fees in feeToken. This may require changes to the internal logic of target smart contract.
Copy link