> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gelato.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# SyncFee Deprecation

> Information about the deprecation of SyncFee payment methods

<Danger>
  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**.
</Danger>

<Card title="Migration Examples Repository" icon="github" href="https://github.com/gelatodigital/gelato-migration-erc2271-syncfee">
  Complete migration examples with contracts, deployment scripts, and step-by-step code.
</Card>

## 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

```solidity theme={null}
// 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
    }
}
```

## Recommended Migration Path

### Use Sponsored Transactions

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

<Card title="Sponsor Gas with Gas Tank" icon="gas-pump" href="/gasless-with-relay/how-to-guides/sponsoredcalls/overview">
  Learn how to sponsor transactions for your users
</Card>

### 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:

```solidity theme={null}
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:

```typescript theme={null}
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

<Steps>
  <Step title="Update Your Contract">
    1. Remove `GelatoRelayContext` inheritance
    2. Remove `_transferRelayFee()` calls
    3. Remove `onlyGelatoRelay` modifier
    4. Add your own token collection logic if needed
  </Step>

  <Step title="Update Your Frontend">
    1. Replace `callWithSyncFee` with `sendTransaction`
    2. If collecting tokens, add the token transfer logic to your contract call
  </Step>

  <Step title="Fund Your Gas Tank">
    Deposit funds in your Gas Tank to sponsor transactions for your users.

    <Card title="Gas Tank" icon="gas-pump" href="/paymaster-&-bundler/gastank/overview">
      Learn how to manage your Gas Tank
    </Card>
  </Step>
</Steps>

## Need Help?

If you have questions about migrating from SyncFee, please reach out through our [GitHub](https://github.com/gelatodigital).
