-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SuperchainERC20: Redesign #12322
Comments
I would like to draw your attention to a security issue with your token standard that will definitely affect your users and cause them to lose their funds permanently. Here is the description: https://dexaran820.medium.com/known-problems-of-erc20-token-standard-e98887b9532c Here is a security statement: https://callisto.network/erc-20-standard-security-department-statement/ Security flawERC-20 standard contains a security flaw: lack of error handling on its The ERC-20 standard was created in 2015, at that time there was a 1024-call-stack-depth bug. So in order to make tokens unaffected by the earlydays EVM bug there were two transacting methods implemented in ERC-20 standard: (1) 1024-call-stack-depth bug was fixed in Tangerine whistle hardfork at block 2463000 in 2016. At this point the As the result, ERC-20 standard implement still has two transferring patterns, one is designed to transfer tokens between externally owned addresses and the other is designed to deposit token to contracts. The Also it is impossible to prevent incorrect ERC-20 deposits to contracts which were never designed to receive or hold tokens such as token contracts themselves (they are supposed to BE tokens, not to HOLD tokens). Keep in mind that this is only an issue of the ERC-20 standard. If you will send an asset to a contract which is not designed to receive it then the following will happen:
The history of the problem
The scale of the problem: $80,000,000 are lost due to this problemI've built a script that calculates the amount of ERC-20 tokens which were lost because of this well-known and fixable problem which persists since 2017. As of 8 October 2024 there were $83,000,000 worth of ERC-20 tokens lost: https://dexaran.github.io/erc20-losses/ Security disclosureYou are about to build your ecosystem on top of the ERC-20 standard which contains a serious security flaw, which caused $80,000,000 loss to Ethereum token users due to lack of error handling in the Your users are guaranteed to lose tokens if you will not fix it. RecommendationsIt is possible to restrict the function transfer(address _to, uint256 _value) public override returns (bool success)
{
require(!_to.isContract(), "Transfers to contracts are not allowed.");
balances[msg.sender] = balances[msg.sender] - _value;
balances[_to] = balances[_to] + _value;
emit Transfer(msg.sender, _to, _value);
return true;
} Alternatively you can disable transfers to the contract of the token itself. This will not fix all the problems however as other contracts will be able to receive ERC-20 tokens without handling the deposit transaction. As you can see there are plenty of LINK, USDC, CRO tokens in the USDT contract address on Ethereum chain, all these tokens are unrecoverably lost due to the flaw in ERC-20 standard: https://etherscan.io/address/0xdac17f958d2ee523a2206206994597c13d831ec7 function transfer(address _to, uint256 _value) public override returns (bool success)
{
require(!_to != address(this), "Transfers to contracts are not allowed.");
balances[msg.sender] = balances[msg.sender] - _value;
balances[_to] = balances[_to] + _value;
emit Transfer(msg.sender, _to, _value);
return true;
} You can use alternative standards, like I've designed ERC-223 to address this specific issue, ethereum/EIPs#223, in the original thread it was written in the Motivation section that this standard is supposed to solve the problem of lost money and millions of dollars were lost at the moment of it's creation in 2018. You can take a look at ERC-1363 as it does not override the logic of the |
Hi @Dexaran ! Thanks for the suggestion, this standard is agnostic and should work on top of erc20s and any other token standard. |
ethereum-optimism/specs#384
ethereum-optimism/specs#413
The text was updated successfully, but these errors were encountered: