docs icon indicating copy to clipboard operation
docs copied to clipboard

Upgrade ERC20 tokens for interop

Open qbzzt opened this issue 7 months ago • 3 comments

Description

Tutorial on how to use your existing ERC-20 in the new world of interop.

Tests

N/A

Additional context

N/A

Metadata

Replacing #1525

@bradleycamacho, can you review this? I can't assign you as a reviewer.

qbzzt avatar Apr 16 '25 16:04 qbzzt

Deploy Preview for docs-optimism ready!

Built without sensitive environment variables

Name Link
Latest commit 5fe97190a15ffa4113a459069573da1f25f31d2f
Latest deploy log https://app.netlify.com/projects/docs-optimism/deploys/68463a75bc03170008dfc636
Deploy Preview https://deploy-preview-1577--docs-optimism.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Apr 16 '25 16:04 netlify[bot]

[!WARNING]

Rate limit exceeded

@qbzzt has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 10 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f2c1e7272fca857f85a816183812cb0e1ee95f84 and 5fe97190a15ffa4113a459069573da1f25f31d2f.

📒 Files selected for processing (1)
  • pages/interop/tutorials/upgrade-to-superchain-erc20/contract-upgrade.mdx (1 hunks)
📝 Walkthrough

Walkthrough

This change introduces comprehensive documentation and code for upgrading ERC20 tokens to SuperchainERC20 tokens, enabling cross-chain interoperability within the Superchain ecosystem. It adds new tutorials covering upgrade paths (contract upgrades, lockboxes), updates metadata files to reflect these topics, and provides example Solidity contracts (InteropToken, LockboxSuperchainERC20) and deployment scripts (LockboxDeployer.s.sol). The tutorials guide users through the upgrade process, including environment setup, contract deployment, and verification steps. Minor changes include updates to code snippet hashes and word list entries. No existing exported or public entities are modified; all new functionality is additive.

Sequence Diagram(s)

Contract Upgrade Flow

sequenceDiagram
    participant User
    participant ProxyAdmin
    participant BeaconProxy
    participant UpgradeableBeacon
    participant OldERC20Impl
    participant NewSuperchainERC20Impl

    User->>ProxyAdmin: Initiate upgrade
    ProxyAdmin->>UpgradeableBeacon: Call upgradeTo(newImpl)
    UpgradeableBeacon-->>BeaconProxy: Update implementation address
    User->>BeaconProxy: Interact (e.g., transfer)
    BeaconProxy->>NewSuperchainERC20Impl: Delegate call (now to new impl)

Lockbox Flow (Wrap and Unwrap)

sequenceDiagram
    participant User
    participant LockboxSuperchainERC20
    participant OriginalERC20

    User->>OriginalERC20: approve(lockbox, amount)
    User->>LockboxSuperchainERC20: lockAndMint(amount)
    LockboxSuperchainERC20->>OriginalERC20: transferFrom(user, lockbox, amount)
    LockboxSuperchainERC20-->>User: mint wrapped tokens

    User->>LockboxSuperchainERC20: redeemAndBurn(amount)
    LockboxSuperchainERC20-->>User: burn wrapped tokens
    LockboxSuperchainERC20->>OriginalERC20: transfer(user, amount)

Possibly related PRs

  • ethereum-optimism/docs#1574: Adds tutorials and metadata about building custom bridges for SuperchainERC20 tokens, which is thematically related to the new upgrade and lockbox tutorials introduced in this PR.

Suggested reviewers

  • bradleycamacho
  • krofax

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Apr 16 '25 16:04 coderabbitai[bot]

1 typo but lgtm

I fixed the typo. However, we still need to wait for the legal review of the disclaimer, I think.

qbzzt avatar Apr 17 '25 18:04 qbzzt