I have a standard ERC-20 Token contract deployed on a private blockchain. How can I create a simple smart contract that relays the transfer function to my token contract so the relay contract pays for the gas instead of the sender. I looked online but the guides are too complex and unclear.
Contracts cannot pay for gas, this is the source of the complexity.
If your token is a standard ERC20 your options are limited too.
I can provide you some pointers but we don't have a comprehensive guide to set up a relaying system.
- You can implement this with ERC2771Forwarder, and with ERC2771Context in the target contract (your token in this case).
- If your target contract does not have ERC2771Context, your users would need a smart contract wallet with ERC2771Context. Alternatively, using ERC-4337.
- Defender Relayer can provide the backend components you would need to relay transactions.