简体   繁体   English

为什么这些以太坊合约没有席卷 USDT?

[英]Why are these Ethereum Contracts not sweeping USDT?

I have an Eth contract, called the controller, which is used to:我有一个名为 controller 的 Eth 合约,用于:

  1. Generate new eth deposit addresses, one for each user, which is an eth contract as well.生成新的 eth 存款地址,每个用户一个,这也是一个 eth 合约。
  2. Sweep these deposit contracts when a user deposits eth or erc20 token to them.当用户向他们存入 eth 或 erc20 代币时,扫描这些存款合约。 The funds end up in another central eth account.资金最终进入另一个中央 eth 账户。

A number of erc20 tokens seem to work perfectly, but USDT deposit transactions get reverted: https://etherscan.io/address/0x3cd5a0dc36a8f22011193f2a03910aa8260e64db许多 erc20 代币似乎运行良好,但 USDT 存款交易被恢复: https://etherscan.io/address/0x3cd5a0dc36a8f22011193f2a03910aa8260e64db

Without the original source code for these contracts (although I have the JSON ABI), it is hard to say:如果没有这些合约的原始源代码(虽然我有 JSON ABI),很难说:

  1. Why it fails for USDT.为什么 USDT 失败。
  2. If these actually can support USDT, or what it would involve to do so.如果这些真的可以支持 USDT,或者这样做会涉及什么。

If anyone can point in the right direction, it will be appreciated!如果有人能指出正确的方向,将不胜感激!

Controller contract: 0xEb818C6a48cCd60A8078aaa20997cC3CB2538C9E Controller 合约:0xEb818C6a48cCd60A8078aaa20997cC3CB2538C9E

Another contract involved linked to controller, called defaultSweeper: 0x8e7ABAF1316A0edB985e494F572Fdf148e8a7E93另一个涉及到 controller 的合同,称为 defaultSweeper: 0x8e7ABAF1316A0edB985e494F572Fdf148e8a7E93

EDIT: It seems that USDT contract is missing some erc20 methods.编辑:似乎 USDT 合约缺少一些 erc20 方法。 Like transfer See: https://erc20-verifier.openzeppelin.com/ Why is this?transfer见: https://erc20-verifier.openzeppelin.com/这是为什么?

Tether contract was deployed before the ERC20 standard was finalized.在 ERC20 标准最终确定之前部署了 Tether 合约。 Some functions don't follow the specs, for example transfer should return a boolean and it doesn't.有些函数不符合规范,例如 transfer 应该返回 boolean 而它没有。

Recent versions of solc will check the returned data size is correct (since 0.5 I think).最近版本的 solc 将检查返回的数据大小是否正确(我认为是 0.5)。

My guess is that your contract was compiled with a recent version of solidity and it uses the standard ERC20 interface.我的猜测是你的合约是用最新版本的solidity编译的,它使用标准的ERC20接口。 And it fails because Tether returns nothing and it is expecting a bool value.它失败了,因为 Tether 什么都不返回,它期待一个 bool 值。

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. Tether 应该升级其合约,或者必须修改 controller 合约以不检查合约大小。 See SafeERC20 from OpenZepplin, they implemented a wrapper around ERC20 that allows interfacing with tokens that are not compliant with the standard.请参阅OpenZepplin的 SafeERC20,他们实现了围绕 ERC20 的包装器,允许与不符合标准的令牌进行交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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