Why not ERC777?
Assumption: This is one of my short and quick articles. There is a assumption over here that you (the reader) is aware of Blockchain, Ethereum, Solidity and Tokens. If you do not understand these terms this article will not be of much help to you. You should dig-up these terms and possibly come back over here.
Background
The Ethereum blockchain is filled with tons and tons of tokens. Pretty much every fungible token is as per the ERC20 Standard (some of them may be ERC223, which is an extension of the ERC20 token standard).
I have been working with loads of such tokens at DeFiZap.com. One of the biggest issue that an ERC20 Token has is that it lacks (of what I would call) hooks / event triggers. Let me explain through an example below:
If Alice were to send Ether to a Smart Contract, the Smart Contract will be made aware of this incoming Ether (through various functions). This made aware nature of the Ether within the Ethereum blockchain is what I call, hooks / event triggers.
However, if Alice were to send Dai to a Smart Contract; the Smart Contract will NOT be made aware of this transfer.
Why not made aware?
To understand why the Smart Contract will NOT be made aware, we will have to understand ONE of the CORE ideas of an ERC20 Token. The long story short version is that the word 'transfer' is actually the root cause (that is how I see it).
Essentially, an ERC20 Tokens does not literally move from one wallet address to another (or smart contract to smart contract); only the so-called owner of the ERC20 is changed inside the Smart Contract that is the issuer of the ERC20. In simple sense, if someone in Monaco has allocated a Ferrari in my name, a transfer would just be like the Ferrari stays there, only the name of the owner of that Ferrari is changed from my name to (lets say) Spider-Man. Now, sadly our dear Friendly Neighbourhood Spider-Man was not informed of this and thus, was NOT made aware.
So what is the issue with that?
As is the case above, since Spider-Man did not know, he did not come to collect the car and drive it off to his own world. Same way, if the Smart Contract or a Wallet is not aware that is owns the ERC20 Token it cannot do anything.
What would the Smart Contract do with it anyway?
While there are tons of uses, one of the most common is to swap it for something else. For eg, converting Dai to cDAI.
HackyWay used currently?
The way the above made aware is currently resolved is (a) allowing the cDAI Smart Contract to use the DAI that I own (through a function known as approve) and (b) informing cDAI (through a function call) that you are now approved to use my DAI, please take it, swap it and issue cDAI to me (and literally, to my name in your ownership register). That means two (2) transactions.
What is the issue?
Bluntly, I do not like 2 transactions.
Why ERC777?
Easy to guess, similar to ERC20, ERC777 is also a standard for developing tokens on the Ethereum Blockchain. The standard has built in provisions for the made aware hooks.
Adoptability
Now, since the first time I read about ERC777 I fell in love with it. I design Smart Contracts that deal with ERC20 and as of now, I have to keep asking my users to approve my smart contract address first and then call a function my smart contract that will do what they need to do.
Hence, I was so much pushing for all token designers to look into ERC777 and use that standard. The odd part is that the standard has been in out since 2017 and yet not 1 token in the market uses ERC777. This made me wonder why, till obviously, I went ahead to work on my own ERC777.
Answer
ERC777 is a larger and comprehensive scheme. One of the drawback of gaining the functionality of the hooks / event triggers is the manner in which the recipient smart contract is designed. Essentially, the recipient smart contract (note!!!, it this drawback is only applicable to smart contracts and NOT to EOA wallets)need to have a function which will listen to such transfer.
Sadly, the world has moved on and no-one in the legacy smart contract world ever designed their contracts with this functionality. Now, since those contracts are not upgradable, they will never be in compliant with ERC777 standard. Thus, with that said, we now know why no one is using the powerful, yet powerless ERC777 coin standard.
Top comments (8)
Great article! We would like to invite you to connect with us since we have built an ERC777 already and as well help other projects if they want to upgrade (swap needed ofc) - you can check gcalliance.io for contact details.
Sure thing. Let me check this out.
The "Ether and ERC20 tokens WooCommerce Payment Gateway" (wordpress.org/plugins/ether-and-er...) plugin uses a Gateway smart contract with a direct ERC777 Reciever support: etherscan.io/address/0xd0E4e3A739A...
It reduces two transactions needed to pay with ERC20 tokens to just one for ERC777.
That contract seems it's not verified with Etherscan. If you wrote it, why not verify and publish?
Hi! Thank you for your interest! You can find a detailed answer here: wordpress.org/support/topic/unveri...
CALL token is an ERC777 (and more)
etherscan.io/address/0xbbe761ea144...
Provable Things p.network/ PNT token etherscan.io/token/0x89Ab32156e46F... is ERC-777 and has existed since June 2020
amazing article!