[SOLVED] Transaction has been reverted by the EVM


please what’s causing this problem and how can i solve it please?

I got the error while trying TransferFrom function.

it looks like contractAddress is null

But I added the contract address on my code, please what am I to do to get rid of the error?

Can you paste that failed transaction hash here.

It looks like you’re doing this transaction on Etherscan (or another chain explorer), what contract address is this? And make sure any parameters you’re using are correct.

transaction hash: 0x9bde3d048971d2124a1e9b2e0f216b7d396e2c2947f2949b9b9286901e1f42fc

yea, i’m using Etherscan…
I’m using usdt contract…

async function gas(){  

  const web3Provider = await Moralis.enableWeb3({

    provider: "walletconnect"

  });

  const signer = web3Provider.getSigner();

  const contract = new ethers.Contract("0xdAC17F958D2ee523a2206206994597C13D831ec7", ABI, signer);

  let res = await contract.approve("0xdAC17F958D2ee523a2206206994597C13D831ec7", 1000000 ,{

    gasPrice: ethers.utils.parseUnits("5","gwei").toString(),

    gasLimit: 48525

  })

}

please here is my lines of codes… trying to interact with usdt approve function, then use its transferFrom function on its explorer

I got the error while trying TransferFrom function.

So approve works fine but transferFrom doesn’t? Can you post your transferFrom code.

I’m confused why you posted the Etherscan screenshot but you’re trying to do it from code.

I do have the transferFrom code, but I made use of the contract transferFrom function on etherscan explorer

const { transferFrom } = useWeb3Contract({

  // chain: "eth",

  contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",

  // contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",

  functionName: "transferFrom",

    abi: ABI,

    params: {

      _to: account,

      _from: "0x0....",

      _value: 1000000,

    }

  }

  );

my transferFrom code

Did you approve an amount to be spent previously? Does your wallet that’s calling this function have an allowance to spend from the from account?

What is the error you’re getting from running this transferFrom code (not from Etherscan)?

async function gas(){  

  const web3Provider = await Moralis.enableWeb3({

    provider: "walletconnect"

  });

  const signer = web3Provider.getSigner();

  const contract = new ethers.Contract("0xdAC17F958D2ee523a2206206994597C13D831ec7", ABI, signer);

  let res = await contract.approve("0xdAC17F958D2ee523a2206206994597C13D831ec7", 1000000 ,{

    gasPrice: ethers.utils.parseUnits("5","gwei").toString(),

    gasLimit: 48525

  })

}

// Moralis.Units.ETH("0.01")

const Web3Api = useMoralisWeb3Api();

const allowace = async () => {

  // Get token allowace on ETH

  const options = {

    // token holder

    _owner: user,

    // uniswap v3 router 2 contract address

    _spender: "0x0....",

    // ENS token contract address

    contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",

  };

  const allowance = await Web3Api.token.getTokenAllowance(options);

  console.log(allowance);

};

useEffect(() => {

  console.log("error", error);

}, [error]);

// const { account } = useMoralis();

// async function transferFromCon() {

  const { transferFrom } = useWeb3Contract({

  // chain: "eth",

  contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",

  // contractAddress: "0xdAC17F958D2ee523a2206206994597C13D831ec7",

  functionName: "transferFrom",

    abi: ABI,

    params: {

      _to: user,

      _from: "0x0....",

      _value: 1000000,

    },

  },

  // console.log(transferFrom)

  );

sorry for the late reply, please here are my codes

Please I really need help on this

in this transaction:

https://etherscan.io/tx/0xfc01727067946c28cd464f6068a129aa89deef223d625dcad90c8c5aa1b0501b

it looks like it approved 1 WEI for USDT

and in that transaction that failed:

https://etherscan.io/tx/0x9bde3d048971d2124a1e9b2e0f216b7d396e2c2947f2949b9b9286901e1f42fc

it looks like it tried to transfer 100000 WEI for USDT

and it is not possible to do that

yea, i solved it… thanks

1 Like

how did you solve it?