Skip to content

Convert erc20 to serc20 tutorial #1403

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

Merged
merged 13 commits into from
Feb 21, 2025
Merged

Convert erc20 to serc20 tutorial #1403

merged 13 commits into from
Feb 21, 2025

Conversation

bradleycamacho
Copy link
Member

No description provided.

@bradleycamacho bradleycamacho requested a review from a team as a code owner February 21, 2025 16:26
Copy link

netlify bot commented Feb 21, 2025

Deploy Preview for docs-optimism ready!

Name Link
🔨 Latest commit 50ab076
🔍 Latest deploy log https://app.netlify.com/sites/docs-optimism/deploys/67b8ed1a3c5c6f000862c497
😎 Deploy Preview https://deploy-preview-1403--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 site configuration.

Copy link
Contributor

coderabbitai bot commented Feb 21, 2025

📝 Walkthrough

Walkthrough

This pull request updates several documentation pages in the interop tutorials section. Two new tutorial cards have been added to the overview page: one for "Deploying crosschain event composability (contests)" (a duplicate of an existing card) and another for "Creating custom SuperchainERC20 tokens." The custom SuperchainERC20 tutorial page has been revised to clarify the process of upgrading an ERC20 token, now described as "teleporting" across the Superchain interop cluster. New sections have been added detailing the creation of a basic ERC20 contract and its extension with the SuperchainERC20 interface, including code examples for crosschainMint and crosschainBurn. Additionally, the deploy tutorial has updated its navigation links from relative to absolute paths.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant OV as Tutorials Overview Page
    participant TS as Tutorial (SuperchainERC20)
    
    U->>OV: Load Tutorials Overview
    OV->>U: Display list of tutorial cards
    U->>OV: Click "Creating custom SuperchainERC20 tokens" card
    OV->>U: Redirect to /stack/interop/tutorials/custom-superchain-erc20
    U->>TS: View detailed tutorial with code snippets
Loading

Possibly related PRs

Suggested reviewers

  • zainbacchus
  • krofax
  • sbvegan

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
pages/stack/interop/tutorials/convert-erc20.mdx (2)

23-33: Enhance punctuation for improved clarity.

At line 25, consider adding a comma after "First" to enhance readability. For example, change to: "First, let's chat about what your token will look like by the end of the conversion:".

🧰 Tools
🪛 LanguageTool

[uncategorized] ~24-~24: Possible missing comma found.
Context: ...c20). ## SuperchainERC20 requirements First let's chat about what your token will l...

(AI_HYDRA_LEO_MISSING_COMMA)


148-152: Next steps section is well-organized.

The bullet points are clear, actionable, and conform to the required style. For uniformity, consider ending the last bullet with a period.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01555aa and 11ab864.

📒 Files selected for processing (2)
  • pages/stack/interop/tutorials.mdx (1 hunks)
  • pages/stack/interop/tutorials/convert-erc20.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.mdx`: "ALWAYS review Markdown content THOROUGHLY with ...

**/*.mdx: "ALWAYS review Markdown content THOROUGHLY with the following criteria:

  • Use proper nouns in place of personal pronouns like 'We' and 'Our' to maintain consistency in communal documentation.
  • Avoid gender-specific language and use the imperative form.
  • Monitor capitalization for emphasis. Avoid using all caps, italics, or bold for emphasis.
  • Ensure proper nouns are capitalized in sentences.
  • Apply the Oxford comma.
  • Use proper title case for buttons, tab names, page names, and links. Sentence case should be used for body content and short phrases, even in links.
  • Use correct spelling and grammar at all times (IMPORTANT).
  • For H1, H2, and H3 headers:
    1. Use sentence case, capitalizing only the first word.
    2. Preserve the capitalization of proper nouns, technical terms, and acronyms as defined in the 'nouns.txt' file located in the root directory of the project.
    3. Do not automatically lowercase words that appear in the 'nouns.txt' file, regardless of their position in the header.
  • Flag any headers that seem to inconsistently apply these rules for manual review.
  • When reviewing capitalization, always refer to the 'nouns.txt' file for the correct capitalization of proper nouns and technical terms specific to the project.
    "
  • pages/stack/interop/tutorials.mdx
  • pages/stack/interop/tutorials/convert-erc20.mdx
🪛 LanguageTool
pages/stack/interop/tutorials/convert-erc20.mdx

[uncategorized] ~24-~24: Possible missing comma found.
Context: ...c20). ## SuperchainERC20 requirements First let's chat about what your token will l...

(AI_HYDRA_LEO_MISSING_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - docs-optimism
  • GitHub Check: Header rules - docs-optimism
  • GitHub Check: Pages changed - docs-optimism
🔇 Additional comments (12)
pages/stack/interop/tutorials.mdx (1)

32-33: New tutorial card addition is correctly implemented.

The new card titled "Converting an ERC20 into a SuperchainERC20" is added with consistent formatting and a proper link reference. Please verify that its style and behavior match those of the other cards.

pages/stack/interop/tutorials/convert-erc20.mdx (11)

1-5: Front matter metadata is well configured.

The title, language, and description fields follow the project’s conventions and accurately describe the tutorial.


7-9: Import statements are clear and concise.

The imports for the Callout and Steps components are correctly stated and support the MDX content structure.


10-13: Callout component usage is effective.

The Callout clearly informs users about the production readiness of the SuperchainERC20 standard and notes the current development status of the OP Stack interoperability upgrade.


15-15: Header is appropriately styled.

The header "# Convert an ERC20 token into a SuperchainERC20 token" uses sentence case as required and clearly communicates the tutorial’s subject.


17-22: Introduction section is clear and informative.

The tutorial introduction effectively outlines the objective and provides helpful links, such as the guided walkthrough video and documentation reference.


34-57: Basic ERC20 contract snippet is well integrated.

The code snippet demonstrating a basic ERC20 contract is correctly formatted and easy to follow.


58-60: Section introduction for the new interface is clear.

The header and accompanying text for adding the new SuperchainERC20 interface are concise and follow MDX styling best practices.


61-89: Solidity snippet implementing the SuperchainERC20 interface is accurate.

The code correctly imports the required contracts, defines the new contract, and implements the supportsInterface function. Everything is clear and well documented.


91-94: Section for crosschain functions is clearly introduced.

The text explains the purpose of the crosschainMint and crosschainBurn functions effectively and appropriately links to additional documentation.


95-145: Verify event declarations for crosschain functions.

The code snippet emits CrosschainMint and CrosschainBurn events; however, their declarations are not shown. To ensure the contract compiles successfully, consider adding event declarations such as:

+    event CrosschainMint(address indexed to, uint256 amount, address indexed bridge);
+    event CrosschainBurn(address indexed from, uint256 amount, address indexed bridge);

If these events are declared elsewhere, please verify the visibility; otherwise, adding them here would improve clarity and completeness.


146-147: Steps component is correctly structured.

The Steps component is properly used and closed, preserving the integrity of the MDX content.

Copy link
Collaborator

@sbvegan sbvegan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just missing a link here

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
pages/stack/interop/tutorials/custom-superchain-erc20.mdx (4)

30-31: Ensure token naming consistency.
The bullet under “What you'll learn” currently refers to deploying “custom ERC20 tokens” while the overall tutorial and title focus on “SuperchainERC20 tokens.” Consider revising the bullet to reference “custom SuperchainERC20 tokens” to maintain consistency throughout the document.


35-36: Refine introductory phrasing.
The statement “At a high level you will:” would read more smoothly with a comma: “At a high level, you will:” This minor grammatical improvement can enhance readability.

🧰 Tools
🪛 LanguageTool

[typographical] ~36-~36: Consider adding a comma after this introductory phrase.
Context: ...entation, or write your own. At a high level you will: ### Create a basic ...

(AS_A_NN_COMMA)


121-127: Include event declarations for clarity.
The code examples emit events (CrosschainMint and CrosschainBurn) without showing their declarations. To assist readers—especially those new to Solidity—it would be beneficial to either include a brief event declaration in the snippet or add an explanatory note with a reference to where these events are defined.


274-274: Polish link call-to-action punctuation.
In the sentence “For more details see the explainer,” adding a comma after “For more details” (i.e. “For more details, see the explainer”) could improve readability and adhere to standard punctuation practices.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11ab864 and 50ab076.

📒 Files selected for processing (3)
  • pages/stack/interop/tutorials.mdx (1 hunks)
  • pages/stack/interop/tutorials/custom-superchain-erc20.mdx (3 hunks)
  • pages/stack/interop/tutorials/deploy-superchain-erc20.mdx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • pages/stack/interop/tutorials/deploy-superchain-erc20.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • pages/stack/interop/tutorials.mdx
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.mdx`: "ALWAYS review Markdown content THOROUGHLY with ...

**/*.mdx: "ALWAYS review Markdown content THOROUGHLY with the following criteria:

  • Use proper nouns in place of personal pronouns like 'We' and 'Our' to maintain consistency in communal documentation.
  • Avoid gender-specific language and use the imperative form.
  • Monitor capitalization for emphasis. Avoid using all caps, italics, or bold for emphasis.
  • Ensure proper nouns are capitalized in sentences.
  • Apply the Oxford comma.
  • Use proper title case for buttons, tab names, page names, and links. Sentence case should be used for body content and short phrases, even in links.
  • Use correct spelling and grammar at all times (IMPORTANT).
  • For H1, H2, and H3 headers:
    1. Use sentence case, capitalizing only the first word.
    2. Preserve the capitalization of proper nouns, technical terms, and acronyms as defined in the 'nouns.txt' file located in the root directory of the project.
    3. Do not automatically lowercase words that appear in the 'nouns.txt' file, regardless of their position in the header.
  • Flag any headers that seem to inconsistently apply these rules for manual review.
  • When reviewing capitalization, always refer to the 'nouns.txt' file for the correct capitalization of proper nouns and technical terms specific to the project.
    "
  • pages/stack/interop/tutorials/custom-superchain-erc20.mdx
🪛 LanguageTool
pages/stack/interop/tutorials/custom-superchain-erc20.mdx

[typographical] ~36-~36: Consider adding a comma after this introductory phrase.
Context: ...entation, or write your own. At a high level you will: ### Create a basic ...

(AS_A_NN_COMMA)

🪛 Gitleaks (8.21.2)
pages/stack/interop/tutorials/custom-superchain-erc20.mdx

146-146: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules - docs-optimism
  • GitHub Check: Header rules - docs-optimism
  • GitHub Check: Pages changed - docs-optimism
🔇 Additional comments (4)
pages/stack/interop/tutorials/custom-superchain-erc20.mdx (4)

19-20: Clarify upgrade process description.
The introductory paragraph clearly explains how an ERC20 token is “upgraded” to a SuperchainERC20 token that can “teleport” across the interop cluster. To improve clarity, consider explicitly noting whether “upgrade” and “teleport” refer to sequential steps or if “teleport” is simply a descriptive metaphor for cross-chain migration.


21-23: Enhance deployment method explanation.
The paragraph on ensuring fungibility by enforcing the same contract address across chains is concise and informative. Optionally, you might add a brief explanation or a link regarding “deterministic deployment methods” to assist readers who are less familiar with the concept.


121-138: Review hard-coded bridge address in cross-chain functions.
In the crosschainMint and crosschainBurn functions, the caller is verified against a hard-coded address (0x4200000000000000000000000000000000000028). While this is likely intentional (to restrict access to the SuperchainTokenBridge), please verify that it is not inadvertently exposing sensitive configuration data or resembling an API key. If it is a fixed public constant, consider adding a comment to explain its origin and ensure that it is maintained securely.


278-279: Verify external link currency and clarity in next steps.
The “Next steps” section directs users to a guided walkthrough via a tutorial video and to review the Superchain Interop Explainer. Please ensure that the URL for the tutorial video (https://x.com/i/status/1866095114374045969) is current and accessible. Additionally, verify that the language remains consistent and instructional throughout these calls to action.

@bradleycamacho bradleycamacho merged commit 957ea3d into main Feb 21, 2025
8 checks passed
@bradleycamacho bradleycamacho deleted the convert-to-serc20 branch February 21, 2025 21:46
This was referenced Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants