underlying.transferFrom in compound docs for lending, throws this error: ProviderError: Error: Transaction reverted without a reason string

I’m trying to lend to the compound protocol in an App I’m building.
Also following the compound doc & guide here: Compound Blog Post
After forking the mainnet locally and impersonating an address with large USDT, I’m now trying to lend to the compound protocol.

In my test, this line underlying.transferFrom always fails with this error: ProviderError: Error: Transaction reverted without a reason string
Any suggestions on what could be the reason.

I’ve asked on the compound discord, and gotten no reply.
Also done lots of research, couldn’t find a similar issue… don’t know what else to do.

Dev Environment: Hardhat
OS: Windows 10

So, after days of struggling with this i found these pointers.

  • The USDT contract seems for some reason not to comply with the eip20 standard.
    It doesn’t return a bool, so my interface for all erc20 contracts didn’t match with their function.
    Immediately i tested with DAI which was eip20 compliant, it worked.
  • Also at some point, while forking the mainnet, my signer account(account i was testing with) didnt have the token(enough USDT) i was trying to supply to compound.

I mean, the USDT contract issue is frustrating, hope someone else finds this useful.:relieved:

Yes, USDT is like that.

The SafeERC20 library from Open Zeppelin lets you use the same code to work with both USDT and with compliant ERC20’s.

ERC 20 - OpenZeppelin Docs