简体   繁体   中英

Why are these Ethereum Contracts not sweeping USDT?

I have an Eth contract, called the controller, which is used to:

  1. Generate new eth deposit addresses, one for each user, which is an eth contract as well.
  2. Sweep these deposit contracts when a user deposits eth or erc20 token to them. The funds end up in another central eth account.

A number of erc20 tokens seem to work perfectly, but USDT deposit transactions get reverted: https://etherscan.io/address/0x3cd5a0dc36a8f22011193f2a03910aa8260e64db

Without the original source code for these contracts (although I have the JSON ABI), it is hard to say:

  1. Why it fails for USDT.
  2. If these actually can support USDT, or what it would involve to do so.

If anyone can point in the right direction, it will be appreciated!

Controller contract: 0xEb818C6a48cCd60A8078aaa20997cC3CB2538C9E

Another contract involved linked to controller, called defaultSweeper: 0x8e7ABAF1316A0edB985e494F572Fdf148e8a7E93

EDIT: It seems that USDT contract is missing some erc20 methods. Like transfer See: https://erc20-verifier.openzeppelin.com/ Why is this?

Tether contract was deployed before the ERC20 standard was finalized. Some functions don't follow the specs, for example transfer should return a boolean and it doesn't.

Recent versions of solc will check the returned data size is correct (since 0.5 I think).

My guess is that your contract was compiled with a recent version of solidity and it uses the standard ERC20 interface. And it fails because Tether returns nothing and it is expecting a bool value.

There isn't much you can do. Either Tether should upgrade its contract or the controller contract has to be modified to do not check the contract size. See SafeERC20 from OpenZepplin, they implemented a wrapper around ERC20 that allows interfacing with tokens that are not compliant with the standard.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM