David Mihal Profile picture
4 Mar, 15 tweets, 6 min read
It's day 4 of ERC-777 week! πŸŽ°πŸŽ‰

While I believe ERC-777 is the best standard for fixing ERC-20, it's certainly not the only one.

Today I'll cover the pros & cons of some other standards:

- ERC-2612 permit()
- ERC-3009 transferWithAuthorization()
- ERC-677 transferAndCall()
The most popular of these is permit(), which was originally created for Dai, and popularized in Uniswap V2.

Permit allows a the user to sign a message before their transaction, giving another contract permission to "pull" tokens. This signature gets included in the main tx.
This is a big improvement over the standard ERC-20 behavior.

First of all, users don't need to send an extra approve() transaction, saving them time and money.

Also, users typically don't give infinite approval, which avoids the recent security issues.
I've been a big supporter of permit(), I think I was even the one that pushed for @MartinLundfall make it an ERC-standard.

Yet, permit still feels like a band-aid on top of the underlying problem, and it still introduces many challenges.

Let's start with the user experience:

While permit() is a big improvement over normal ERC-20 approvals, it's still far from ideal.

Users still need to sign a somewhat-confusing message before their main transaction. Image
Permit uses the EIP-712 signature standard, which has somewhat limited wallet support. @Ledger recently added support for these signatures, but @Trezor still doesn't support it.

Furthermore, contract wallets like @argent can't create these signatures.
This brings me to my next point:
Building front-ends with permit() is complicated.

The frontend needs to first pull data from the contract (nonce, etc) and prepare the ERC-712 signature.

I built a library to simplify this, but it's still difficult. 😩

npmjs.com/package/eth-pe…
And as I mentioned, many wallets don't support permit, so you need to build a fallback system to use normal approvals.

Some apps like @yield have a permit() mode and an approve() mode. Image
Not only are frontends difficult, but writing contracts with permit is difficult as well.

You must add separate functions for with & without permit. That means permit can double the number of functions needed in a smart contract.

Look at the duplicate functions in Uniswap: Image
Plus, the MakerDAO/Dai implementation of permit() is different than the ERC-2612 version used by most other apps.

So if you want to support Dai + other tokens, then you need even more functions in your contract! Image
There are even more difficulties around building using permit, but I'll try not to get too into-the-weeds.

Permit is a great band-aid on top of ERC-20, but it's far from the ideal solution.
The most recent version of USDC introduced transferWithAuthorization. @petejkim standardized this as ERC-3009.

It's another useful standard, but it suffers some of the same drawbacks as permit(), so I won't spend to much time on it.

Finally, there's transferAndCall, standardized by ERC-677 & ERC-1363.

This function is pretty self-explanatory: you transfer a token and the token contract will execute a callback hook on the recipient contract.
This approach is my favorite out of these 3, but it has pretty limited adoption, $LINK is the only major coin I know that implements it.

While I support any effort to fix ERC-20's issues, all 3 of these approaches are incremental improvements.

When we move to L2, let's not take the problems of the past with us.
Let's jump into the future with ERC-777.πŸ’₯πŸš€

Check back tomorrow, when I'll cover ERC-777 for devs!πŸ’»

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with David Mihal

David Mihal Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @dmihal

5 Mar
It's day 5: the final day of ERC-777 week! πŸŽ°πŸŽ‰

This week we've discussed the pros & cons of the ERC-777 token standard. Today I'll cover things that developers should know about to build with ERC-777, and what the next steps are for this standard.
ERC-777 is well supported by the @OpenZeppelin contract templates.

You can easily use their ERC777 template, just like you use the ERC20 template.

One small difference is that ERC777 requires an array for default operators, which I usually set to an empty array. Image
One of the best parts of ERC-777 is building applications using receive hooks.

Contracts that receive ERC777s need to:
- register in the ERC-1820 registry
- implement the tokensReceived() function

I made a simple contract that you can inherit for this:
gist.github.com/dmihal/7020e24…
Read 10 tweets
1 Mar
πŸŽ‰πŸŽ°It's ERC-777 week! πŸŽ°πŸŽ‰

With the upcoming launch of optimistic rollups & some recent hacks, it's time to put some focus back on my favorite token standard!

Every day this week, I'll post a thread about ERC-777 and answer any questions about it

Today: an intro to ERC777 ‡️
I like to think of ERC777 as ERC20 2.0

ERC-777 is a standard for fungible tokens, and it's fully backwards-compatible with ERC-20. It works with any existing wallet, but also adds new features.

For more details, check out this thread I made last year:

Another way to think of ERC-777 is that it makes tokens that work more like Ether.

Have you noticed that you need to approve every token you use with Uniswap, but you never need to approve ETH?

ERC-777 can be transferred & call other functions in one transaction, just like ETH.
Read 8 tweets
29 May 20
/1 DeFi has made incredible progress in the past few years, but it still faces many usability problems.

I'm excited to share my newest project: 🎰DeFi777🎰, which introduces a new pattern for interacting with DeFi protocols.

medium.com/@dmihal/introd…
2/ I built this project for the @ETHGlobal #hackmoney hackathon.

Check out the submission videos Television I threw together:

3 minute version:
5 minute version:
3/ Dapps can be scary and confusing. Users need to install Metamask, navigate confusing popups, set gas parameters, etc.

Argent has done amazing work to simplify this experience, but they've had to build custom integrations for each DeFi protocol.

That's not open or scalable.
Read 10 tweets
18 Apr 20
(1/10) The imBTC/Uniswap hack took advantage of the ERC777 standard, now I'm seeing many people saying that ERC777 is inherently bad or unsafe.

ERC20 is safer than ERC777 in the same way that Bitcoin is safer than Ethereum. It's safe because it's limited.

Here's some thoughts:
(2/12) First of all, for anyone that isn't familiar with ERC-777, you can think of it as ERC-20 2.0. It's a token standard that's backwards compatible with ERC-20, but adds some new features.

eips.ethereum.org/EIPS/eip-777
(3/12) The ERC-20 standard was written in 2015. It's very simple, which has helped it become so popular.

However, it's very "underpowered" for a system that's trying to create "programmable money". Many of Ethereum's UX problems come from limitations of the ERC-20 standard.
Read 12 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!