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
ERC777 mint fails when target is a smart contract not ERC1820 registered #2226
Comments
Hello @Amxx, thanks for discussing this issue! That check is very much intentional and a non-optional part of the ERC777 specification: not having it would make the token contract non-compliant. Quoting from the spec:
This is what This is a similar mechanism to the one used by ERC721 in |
Most smart contract wallets, Argent included, implement Some people might think this situation is ok, I strongly believe it is NOT. We are talking money legos, but this incompatibility, which is not known by most users, caused me too burn (testnet) BTC, because some project commited to ERC777, and my wallet was not doing the registration. Not fixing that will have bad consequences both for the ERC777 based project and for the smart contract wallets as users will not be ok with losing funds due to over-conservative standards. ERC777 is already disliked by many people after the latest "hacks" caused by the reentry ERC777 enabled (even though 777 is not strictly to blame) ... if you care about 777 you should really make sure you don't give more opportunity for people to blame losing money on it. |
I noticed this behaviour when working with the pToken contract on ropsten. I'm depositing BTC to the address provided by pToken and their bridge is, in exchange, supposed to deposit pBTC on my account. This operation corresponds to a
_mint
, by the bridge, of token on my account.This operation fails when using smart contracts wallet as a target, despite me implementing a non-reverting
tokensReceived
method on my smart contract. See trace.This is caused by the
_callTokensReceived
method, which searches the ERC1820Registry for aERC777Recipient
associated to the account address. In my case the wallet is not registered in the ERC1820Registry so thegetInterfaceImplementer
call returnsaddress(0)
. The following check is then a verification that the address is not a (deployed) contract, which then causes the transaction to revert.Most smart contracts wallets are not ERC1820 registered. My argent wallet is not, and I suspect that most other wallets aren't. Registering all of them would be expensive in terms of gas AND blockchain storage.
A solution would be, whenever the ERC1820Registry doesn't have an implementer address, to call the targeted address directly rather than reverting.
becomes
This would cause contracts with a non reverting
fallback()
to accept tokens, but would also give a chance for wallets like argents to be made compatible by "just" adding a staticcall mechanism for thetokensReceived
method at the wallet level, without having to go through ERC1820 registration.Also, I believe this limitation should be more publicly discussed, as it is making some of the largest userbases in the DeFi ecosystem incompatible with the "Money Legos" people are building using ERC777
The text was updated successfully, but these errors were encountered: