Skip to main content
Gelato is deprecating the SyncFee payment methods. The old callWithSyncFee and GelatoRelayContext patterns will no longer be available, and Gelato will not provide a replacement. To continue collecting fees from users, you must implement token collection as part of your custom contract logic and use sponsored transactions.

Migration Examples Repository

Complete migration examples with contracts, deployment scripts, and step-by-step code.

What’s Being Deprecated?

The following patterns will no longer be supported:
  • callWithSyncFee SDK method
  • GelatoRelayContext contract inheritance
  • _transferRelayFee() function
  • onlyGelatoRelay modifier
  • Automatic fee data encoding in calldata
// DEPRECATED - Will no longer work
import {GelatoRelayContext} from "@gelatonetwork/relay-context/contracts/GelatoRelayContext.sol";

contract MyContract is GelatoRelayContext {
    function myFunction() external onlyGelatoRelay {
        // Your logic here
        _transferRelayFee(); // No longer supported
    }
}

Use Sponsored Transactions

We recommend migrating to sponsored transactions using the Gas Tank. This provides a better user experience and simpler implementation.

Sponsor Gas with Gas Tank

Learn how to sponsor transactions for your users

Collect Tokens in Your Contract Logic

If you need to collect tokens from users to cover costs, implement this as part of your custom contract logic:
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract MyContract {
    address public feeCollector;

    function myFunction(
        address feeToken,
        uint256 feeAmount
    ) external {
        // Collect tokens from user to your fee collector
        // User must have approved the contract first
        IERC20(feeToken).transferFrom(msg.sender, feeCollector, feeAmount);

        // Your business logic here
    }
}
Then sponsor the transaction using Gelato’s Gas Tank:
import { createGelatoEvmRelayerClient } from '@gelatocloud/gasless';
import { encodeFunctionData } from 'viem';
import { baseSepolia } from 'viem/chains';

const relayer = createGelatoEvmRelayerClient({
  apiKey: process.env.GELATO_API_KEY,
  testnet: true
});

const data = encodeFunctionData({
  abi: contractAbi,
  functionName: 'myFunction',
  args: [feeTokenAddress, feeAmount]
});

const id = await relayer.sendTransaction({
  chainId: baseSepolia.id,
  to: contractAddress,
  data,
});

Migration Steps

1

Update Your Contract

  1. Remove GelatoRelayContext inheritance
  2. Remove _transferRelayFee() calls
  3. Remove onlyGelatoRelay modifier
  4. Add your own token collection logic if needed
2

Update Your Frontend

  1. Replace callWithSyncFee with sendTransaction
  2. If collecting tokens, add the token transfer logic to your contract call
3

Fund Your Gas Tank

Deposit funds in your Gas Tank to sponsor transactions for your users.

Gas Tank

Learn how to manage your Gas Tank

Need Help?

If you have questions about migrating from SyncFee, please reach out through our Discord or GitHub.