David Mihal Profile picture
5 Mar, 10 tweets, 3 min read
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.
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…
Speaking of, you'll need ERC1820 deployed to any chain that uses ERC777s.

This is already deployed to all major EVM chains, but if you're building in Hardhat, you should add this package to ensure that ERC1820 is available in your test chain.

npmjs.com/package/hardha…
A few little quirks of ERC777 that developers should know:

1. All 777s have 18 decimals, 777 uses the granularity() function instead. So if you're wrapping an ERC20 with less than 18 decimals, you need to do some quick conversion.
2. The transfer() function will send tokens to any address, but the send() function will fail if you're sending to a contract that doesn't support ERC777 hooks.

3. The mint function also will fail if you're sending to an unsupported contract.
4. As we've discussed many times, ERC777 transfers can introduce re-entrancy vulnerabilities. So make sure your transfers use the Check-Effects-Interactions pattern, and use re-entrancy guards if necessary.

Don't be the next LendFme!
That wraps up my developer tips!

So what are the next steps for ERC777?

The transition to Layer 2 is a big opportunity to finally embrace the many improvements ERC777 has to offer and make dapps easier for end users.
ERC777 has already been added to the Arbitrum bridge, and I've got an open PR to add it to Optimism.

If you've got thoughts about L2 bridges, feel free to take a look!

github.com/ethereum-optim…
I hope these tweets this week have been helpful!

If you're a developer, I'd recommend learning more about ERC777 and how it can improve your projects.

And if any of you have any thoughts or questions, feel free to reach out! 🙂

• • •

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

4 Mar
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.
Read 15 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!