How to create smart contract using openzeppelin metatx relayer to receive and withdraw usdt erc20 token using metamask?

Here is what I need to do,

  1. Create a smart contract that can use a relayer account from Openzeppelin defender and do the gasless meta transactions. Which I already created and sent some Ethereum too.
  2. The contract can receive USDT erc20 funds, and show balance, and the contract owner can withdraw the funds.
  3. Then use Metamask in a react frontend and call those functions. Here the Metamask account will not pay the gas fees. Instead, the relayer will do.

The contract I created,

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

contract EtherWallet{
    address payable public owner;

    constructor() {
        owner =payable(msg.sender);

    receive() external payable {}

    function withdraw(uint _amount) external {
        require(msg.sender == owner, "Only owner can withdraw");


    function getBalance() external view returns (uint) {
        return address(this).balance;

But not sure how to do this. I need help with all the 3 options.

Hey @Md_Abu_Sayeed_Mondal,

You'll need to follow some extra steps in order to setup, but you are on a good track since you've already identified the steps to follow.

The details on how to create a MinimalForwarder, setup an Autotask webhook and calling from a frontend are well documented in this demo:

Hope it helps!

1 Like

Thanks. From this video, what is a minimalforwarder address?

I'm not sure if I'm misunderstanding your question, but I think you're referring to the address of a deployed MinimalForwarder contract you'll need to deploy.

Were you able to create a contract that could it? If so how I can do the same?

Iā€™m trying to use meta-transactions to transfer ERC-20 USDT tokens from one account to another. But the programming is too complex to understand what to do.
Any advice will be much appreciated.

First off, welcome to the forum @James_Sekatawa_Trent!

Hopefully, the written guide here can help. The functionality for transferring an ERC20 token would be similar -- this guide can show you the basic building blocks so that you can adapt it to a different contract's specific needs.