-
Notifications
You must be signed in to change notification settings - Fork 264
Tutorial: Upgrade ERC20 to support interop #1525
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
Closed
qbzzt
wants to merge
35
commits into
ethereum-optimism:main
from
qbzzt:250320-upgrade-erc20-to-superchain
Closed
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
7fbd348
WIP
qbzzt 3697d7d
WIP
qbzzt c1ed880
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
qbzzt a4f98e2
Proxy method works
qbzzt ac5de2c
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
qbzzt 6c6fd85
Added explanation of InteropToken.sol
qbzzt eb9ba15
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
qbzzt 7327294
fixes
qbzzt 0f4388b
WIP
qbzzt c75befd
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
qbzzt 7644214
Need to polish
qbzzt a93acb3
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
qbzzt 0c49dfe
WIP
qbzzt fdc7a7f
Ready for review
qbzzt 33b49ed
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
qbzzt cdebe0f
Lint
qbzzt 11e0b32
Code rabbit suggestions
qbzzt e059449
WIP, some @zainbacchu comments
qbzzt 4b8033b
WIP
qbzzt 921101d
WIP
qbzzt ca937f7
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
qbzzt 3685944
lint
qbzzt 63f4021
Merge branch 'main' into 250320-upgrade-erc20-to-superchain
qbzzt 523dbbc
Multiple changes
qbzzt 5b92cb7
WIP
qbzzt 73f1f9f
WIP
qbzzt 3968ad1
Almost ready
qbzzt cad3ad9
Comments addressed
qbzzt b0b71a2
Lint
qbzzt 9330958
breadcrumbs
qbzzt 25ce3e2
Update pages/stack/interop/tutorials/upgrade-to-superchain-erc20/lock…
qbzzt 4640c8a
Update proxy-upgrade.mdx
qbzzt 1eb5657
Import Card(s)
qbzzt 384c99d
Update pages/stack/interop/tutorials/upgrade-to-superchain-erc20.mdx
qbzzt 9bcaaeb
Code rabbit
qbzzt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
pages/stack/interop/tutorials/upgrade-to-superchain-erc20.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
title: Upgrading ERC20 to SuperchainERC20 | ||
lang: en-US | ||
description: Tutorial on how to take an existing ERC20 and upgrade it to SuperchainERC20. | ||
--- | ||
qbzzt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import { Callout } from 'nextra/components' | ||
import { Steps } from 'nextra/components' | ||
|
||
<Callout> | ||
The SuperchainERC20 standard is ready for production deployments. | ||
Please note that the OP Stack interoperability upgrade, required for crosschain messaging, is currently still in active development. | ||
</Callout> | ||
|
||
# Upgrading ERC20 to SuperchainERC20 | ||
|
||
## Overview | ||
|
||
This guide explains how to upgrade an ERC20 to a [`SuperchainERC20`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainERC20.sol) that can teleport across the [Superchain interop cluster](/stack/interop/explainer#superchain-interop-cluster) using the [`SuperchainTokenBridge`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainTokenBridge.sol) contract. For more information on how it works, [see the explainer](/stack/interop/superchain-erc20). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is |
||
|
||
<Callout type="warning"> | ||
qbzzt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The code on the documentation site is sample code, *not* production code. | ||
This means that we ran it, and it works as advertised. | ||
However, it did not pass through the rigorous audit process that most Optimism code undergoes. | ||
You're welcome to use it, but if you need it for production purposes you should get it audited first. | ||
</Callout> | ||
|
||
{/* | ||
qbzzt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
I put this warning here, when we don't have it on most pages, because this tutorial | ||
has, IMHO, code that is a lot more likely to be used in production. It doesn't just | ||
show what is possible, it does the exact job needed. | ||
|
||
*/} | ||
|
||
There are several ways to upgrade an existing ERC20 for interop, depending on the exact circumstances. Click any of the green rectangles for directions. | ||
qbzzt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```mermaid | ||
graph TB | ||
classDef link fill:#f96 | ||
Deployed{Is there<br/>already an<br/>ERC20 contract<br/>in use?} | ||
Deployed -- No --> New[<a href="./deploy-superchain-erc20">New SuperchainERC20 contract</a>]:::link | ||
Deployed -- Yes --> Proxy{Is the<br/>existing contract</br>behind a<br/>proxy?} | ||
Proxy -- No --> Lockbox[<a href="upgrade-to-superchain-erc20/lockbox">Lockbox contract</a>]:::link | ||
Proxy -- Yes --> Proxy2{Can you<br/>deploy proxies on<br/>the same address<br/>on the other chains?} | ||
Proxy2 -- No --> Bridge[Specialized Bridge<br/>Coming soon] | ||
Proxy2 -- Yes --> Upgrade[<a href="upgrade-to-superchain-erc20/proxy-upgrade">Contract upgrade</a>]:::link | ||
``` | ||
|
||
## Next steps | ||
|
||
qbzzt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Deploy a [SuperchainERC20](./deploy-superchain-erc20) to the Superchain | ||
* [Learn more about SuperchainERC20](/stack/interop/superchain-erc20) | ||
* Build a [revolutionary app](/app-developers/get-started) that uses multiple blockchains within the Superchain |
4 changes: 4 additions & 0 deletions
4
pages/stack/interop/tutorials/upgrade-to-superchain-erc20/_meta.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"lockbox": "Lockboxes for permissionless interop", | ||
"proxy-upgrade": "Contract upgrade" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using
./
in links- this can cause issues when we move files around if the directory structure changes.