-
Notifications
You must be signed in to change notification settings - Fork 261
Deploy assets using Superchain ERC20 #1050
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
Conversation
✅ Deploy Preview for docs-optimism ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Warning Rate limit exceeded@bradleycamacho has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 33 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. WalkthroughThe changes in this pull request include the addition of a new key-value pair in the JSON metadata file for SuperchainERC20 and the creation of a new documentation file detailing the deployment process for assets using the SuperchainERC20 standard. Additionally, the existing SuperchainERC20 documentation has been updated to include links to the new guide and a warning about interoperability requirements with the SuperchainERC20Bridge. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 6
🧹 Outside diff range and nitpick comments (4)
pages/stack/interop/deploy-superchain-erc20.mdx (2)
1-5
: Enhance the description metadata.The current description is somewhat redundant with the title. Consider making it more specific about what readers will learn.
-description: Learn about the basic details of deploying assets on SuperchainERC20 +description: Learn how to deploy and bridge tokens using the SuperchainERC20 standard across multiple chains
90-93
: Enhance link descriptions in the next steps section.Make the links more descriptive to better indicate what readers will learn.
## Next steps -* Explore the [SuperchainERC20 specifications](https://specs.optimism.io/interop/token-bridging.html) for in-depth implementation details. -* Watch the [Superchain interop design video walkthrough](https://www.youtube.com/watch?v=FKc5RgjtGes) for a visual explanation of the concepts. -* Review the [Superchain Interop Explainer](explainer) for answers to common questions about interoperability. +* Learn about token bridging protocols in the [SuperchainERC20 technical specifications](https://specs.optimism.io/interop/token-bridging.html). +* Understand the architecture through our [30-minute video walkthrough of Superchain interop design](https://www.youtube.com/watch?v=FKc5RgjtGes). +* Get answers to frequently asked questions in the [Superchain Interop Explainer](explainer).pages/stack/interop/superchain-erc20.mdx (2)
Line range hint
1-24
: Documentation style improvements neededPlease make the following adjustments to align with the documentation guidelines:
Header case:
- Change "How it works" to "How it works"
- Change "Major components" to "Major components"
- Change "Implementation details" to "Implementation details"
- Change "Next steps" to "Next steps"
Replace personal pronouns:
- "their tokens" could be replaced with "the tokens"
Technical term capitalization:
- Ensure consistent capitalization of "Superchain", "SuperchainERC20", and "Interop" throughout the document
Also applies to: 82-83
82-83
: Improve sentence structure in the new link sectionThe current sentence could be more direct and clearer. Consider revising to:
-For step-by-step information on implementing SuperchainERC20, see [Deploy assets using SuperchainERC20](/stack/interop/deploy-superchain-erc20) +For step-by-step implementation instructions, see [Deploy assets using SuperchainERC20](/stack/interop/deploy-superchain-erc20).The revision:
- Makes the sentence more concise
- Adds missing period
- Removes redundant mention of "SuperchainERC20" since it's clear from context
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
pages/stack/interop/_meta.json
(1 hunks)pages/stack/interop/deploy-superchain-erc20.mdx
(1 hunks)pages/stack/interop/superchain-erc20.mdx
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
pages/stack/interop/deploy-superchain-erc20.mdx (1)
Pattern **/*.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:
- Use sentence case, capitalizing only the first word.
- 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.
- 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/superchain-erc20.mdx (1)
Pattern **/*.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:
- Use sentence case, capitalizing only the first word.
- 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.
- 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.
"
🪛 LanguageTool
pages/stack/interop/deploy-superchain-erc20.mdx
[style] ~16-~16: Consider using a more formal alternative.
Context: ...he SuperchainERC20Bridge
. If you want more information about the SuperchainERC20 standard
, s...
(MORE_INFO)
[uncategorized] ~28-~28: Loose punctuation mark.
Context: ...t methods, such as: * Create2Deployer
: A smart contract that enables deploying...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~29-~29: Loose punctuation mark.
Context: ...sses. * OptimismSuperchainERC20Factory
: A factory contract designed for L1-nati...
(UNLIKELY_OPENING_PUNCTUATION)
[grammar] ~59-~59: After the number ‘two’, use a plural noun. Did you mean “functions”?
Context: ...nal message information. We'll use two function for bridging: * sendERC20
: initializ...
(CD_NNU)
[uncategorized] ~61-~61: Loose punctuation mark.
Context: ...wo function for bridging: * sendERC20
: initializes a cross-chain transfer of a...
(UNLIKELY_OPENING_PUNCTUATION)
[misspelling] ~61-~61: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...t does not "create" an additional asset in regards to supply. * relayERC20
: process incomin...
(IN_OR_WITH_REGARDS_TO_OF)
[uncategorized] ~62-~62: Loose punctuation mark.
Context: ...set in regards to supply. * relayERC20
: process incoming messages from the L2to...
(UNLIKELY_OPENING_PUNCTUATION)
🪛 GitHub Check: lint
pages/stack/interop/deploy-superchain-erc20.mdx
[warning] 28-28:
Incorrect list-item indent: add 2 spaces
[warning] 29-29:
Incorrect list-item indent: add 2 spaces
[warning] 61-61:
Incorrect list-item indent: add 2 spaces
[warning] 62-62:
Incorrect list-item indent: add 2 spaces
🔇 Additional comments (1)
pages/stack/interop/_meta.json (1)
5-6
: LGTM! The metadata entry is well-structured.
The new entry follows the existing naming conventions and is logically placed after the related SuperchainERC20 documentation entry.
Let's verify the existence of the referenced documentation file:
✅ Verification successful
Documentation file exists and matches the metadata entry ✅
The deploy-superchain-erc20.mdx
file is present in the expected location at pages/stack/interop/
, confirming that the metadata entry correctly references an existing documentation file.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify that the corresponding documentation file exists
fd --type f "deploy-superchain-erc20.mdx" pages/stack/interop/
Length of output: 110
@zainbacchus this is ready for your review whenever you have a second! |
Hi @zainbacchus! Reminder this needs a review if we wanna go live by DevCon |
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (4)
pages/stack/interop/deploy-superchain-erc20.mdx (4)
4-4
: Enhance the description to be more specific.The current description is too generic. Consider revising to better reflect the guide's purpose.
-description: Learn about the basic details of deploying assets on SuperchainERC20 +description: Learn how to deploy and bridge assets across chains using the SuperchainERC20 standard
28-29
: Fix list item indentation.The markdown list items need proper indentation for consistent formatting.
-* `Create2Deployer`: A smart contract that enables deploying contracts with predictable addresses. -* `OptimismSuperchainERC20Factory`: A factory contract designed for L1-native tokens to ensure uniform deployments across chains. + * `Create2Deployer`: A smart contract that enables deploying contracts with predictable addresses. + * `OptimismSuperchainERC20Factory`: A factory contract designed for L1-native tokens to ensure uniform deployments across chains.🧰 Tools
🪛 LanguageTool
[uncategorized] ~28-~28: Loose punctuation mark.
Context: ...t methods, such as: *Create2Deployer
: A smart contract that enables deploying...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~29-~29: Loose punctuation mark.
Context: ...sses. *OptimismSuperchainERC20Factory
: A factory contract designed for L1-nati...(UNLIKELY_OPENING_PUNCTUATION)
🪛 GitHub Check: lint
[warning] 28-28:
Incorrect list-item indent: add 2 spaces
[warning] 29-29:
Incorrect list-item indent: add 2 spaces
46-53
: Enhance interface documentation with NatSpec comments.The interface should include comprehensive documentation for better developer understanding.
interface ICrosschainERC20 { + /// @notice Mints tokens to an account. Only callable by the authorized bridge. + /// @param _account The address to mint tokens to + /// @param _amount The amount of tokens to mint function crosschainMint(address _account, uint256 _amount) external; + /// @notice Burns tokens from an account. Only callable by the authorized bridge. + /// @param _account The address to burn tokens from + /// @param _amount The amount of tokens to burn function crosschainBurn(address _account, uint256 _amount) external; + /// @notice Emitted when tokens are minted through cross-chain transfer + /// @param _to The address receiving the tokens + /// @param _amount The amount of tokens minted event CrosschainMint(address indexed _to, uint256 _amount); + + /// @notice Emitted when tokens are burned for cross-chain transfer + /// @param _from The address tokens are burned from + /// @param _amount The amount of tokens burned event CrosschainBurn(address indexed _from, uint256 _amount); }
59-59
: Fix grammatical error.-We'll use two function for bridging: +We'll use two functions for bridging:🧰 Tools
🪛 LanguageTool
[grammar] ~59-~59: After the number ‘two’, use a plural noun. Did you mean “functions”?
Context: ...nal message information. We'll use two function for bridging: *sendERC20
: initializ...(CD_NNU)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
pages/stack/interop/deploy-superchain-erc20.mdx
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
pages/stack/interop/deploy-superchain-erc20.mdx (1)
Pattern **/*.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:
- Use sentence case, capitalizing only the first word.
- 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.
- 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.
"
🪛 LanguageTool
pages/stack/interop/deploy-superchain-erc20.mdx
[style] ~16-~16: Consider using a more formal alternative.
Context: ...he SuperchainERC20Bridge
. If you want more information about the SuperchainERC20 standard
, s...
(MORE_INFO)
[uncategorized] ~28-~28: Loose punctuation mark.
Context: ...t methods, such as: * Create2Deployer
: A smart contract that enables deploying...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~29-~29: Loose punctuation mark.
Context: ...sses. * OptimismSuperchainERC20Factory
: A factory contract designed for L1-nati...
(UNLIKELY_OPENING_PUNCTUATION)
[grammar] ~59-~59: After the number ‘two’, use a plural noun. Did you mean “functions”?
Context: ...nal message information. We'll use two function for bridging: * sendERC20
: initializ...
(CD_NNU)
[uncategorized] ~61-~61: Loose punctuation mark.
Context: ...wo function for bridging: * sendERC20
: initializes a cross-chain transfer of a...
(UNLIKELY_OPENING_PUNCTUATION)
[misspelling] ~61-~61: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...t does not "create" an additional asset in regards to supply. * relayERC20
: process incomin...
(IN_OR_WITH_REGARDS_TO_OF)
[uncategorized] ~62-~62: Loose punctuation mark.
Context: ...set in regards to supply. * relayERC20
: process incoming messages from the L2to...
(UNLIKELY_OPENING_PUNCTUATION)
🪛 GitHub Check: lint
pages/stack/interop/deploy-superchain-erc20.mdx
[warning] 18-18:
Blocked character found: (’) at index 165
[warning] 28-28:
Incorrect list-item indent: add 2 spaces
[warning] 29-29:
Incorrect list-item indent: add 2 spaces
[warning] 61-61:
Incorrect list-item indent: add 2 spaces
[warning] 62-62:
Incorrect list-item indent: add 2 spaces
🔇 Additional comments (1)
pages/stack/interop/deploy-superchain-erc20.mdx (1)
67-87
:
Add essential security checks to bridge functions.
The implementation should include proper validation to ensure secure token transfers.
function sendERC20(SuperchainERC20 _token, address _to, uint256 _amount, uint256 _chainId) external returns (bytes32 msgHash_) {
+ require(_to != address(0), "Invalid recipient");
+ require(_amount > 0, "Amount must be positive");
+ require(_chainId != block.chainid, "Cannot bridge to same chain");
+
_token.crosschainBurn(msg.sender, _amount);
bytes memory _message = abi.encodeCall(this.relayERC20, (_token, msg.sender, _to, _amount));
msgHash_ = L2ToL2CrossDomainMessenger.sendMessage(_chainId, address(this), _message);
emit SentERC20(address(_token), msg.sender, _to, _amount, _chainId);
}
function relayERC20(SuperchainERC20 _token, address _from, address _to, uint256 _amount) external {
- require(msg.sender == address(L2ToL2CrossChainMessenger));
- require(L2ToL2CrossChainMessenger.crossDomainMessageSender() == address(this));
+ require(msg.sender == address(L2ToL2CrossChainMessenger), "Unauthorized messenger");
+ require(L2ToL2CrossChainMessenger.crossDomainMessageSender() == address(this), "Unauthorized sender");
+ require(_to != address(0), "Invalid recipient");
+ require(_amount > 0, "Amount must be positive");
uint256 _source = L2ToL2CrossChainMessenger.crossDomainMessageSource();
_token.crosschainMint(_to, _amount);
emit RelayedERC20(address(_token), _from, _to, _amount, _source);
}
Likely invalid or redundant comment.
General feedback, for any code pls point the user to the relevant specs section https://specs.optimism.io/interop/token-bridging.html#implementation |
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
pages/stack/interop/deploy-superchain-erc20.mdx (2)
1-5
: Enhance the description to be more specific.The current description is somewhat redundant with the title. Consider revising it to better describe the guide's contents:
-description: Learn about the basic details of deploying assets on SuperchainERC20 +description: Step-by-step guide for deploying and bridging assets using SuperchainERC20 across the Superchain
16-16
: Use more formal language in documentation.Consider revising the sentence to use a more formal tone:
-If you want more information about the `SuperchainERC20 standard`, see our [`SuperchainERC20` standard explainer](/stack/interop/superchain-erc20) +For more information about the `SuperchainERC20`, refer to the [`SuperchainERC20` explainer](/stack/interop/superchain-erc20)🧰 Tools
🪛 LanguageTool
[style] ~16-~16: Consider using a more formal alternative.
Context: ...heSuperchainERC20Bridge
. If you want more information about theSuperchainERC20 standard
, s...(MORE_INFO)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
pages/stack/interop/deploy-superchain-erc20.mdx
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
pages/stack/interop/deploy-superchain-erc20.mdx (1)
Pattern **/*.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:
- Use sentence case, capitalizing only the first word.
- 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.
- 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.
"
🪛 LanguageTool
pages/stack/interop/deploy-superchain-erc20.mdx
[style] ~16-~16: Consider using a more formal alternative.
Context: ...he SuperchainERC20Bridge
. If you want more information about the SuperchainERC20 standard
, s...
(MORE_INFO)
[uncategorized] ~28-~28: Loose punctuation mark.
Context: ...t methods, such as: * Create2Deployer
: A smart contract that enables deploying...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~29-~29: Loose punctuation mark.
Context: ...sses. * OptimismSuperchainERC20Factory
: A factory contract designed for L1-nati...
(UNLIKELY_OPENING_PUNCTUATION)
[grammar] ~39-~39: After the number ‘two’, use a plural noun. Did you mean “functions”?
Context: ...unctions and two events. We'll use two function for bridging: * sendERC20
: initializ...
(CD_NNU)
[uncategorized] ~41-~41: Loose punctuation mark.
Context: ...wo function for bridging: * sendERC20
: initializes a cross-chain transfer of a...
(UNLIKELY_OPENING_PUNCTUATION)
[misspelling] ~41-~41: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...t does not "create" an additional asset in regards to supply. * relayERC20
: process incomin...
(IN_OR_WITH_REGARDS_TO_OF)
[uncategorized] ~42-~42: Loose punctuation mark.
Context: ...set in regards to supply. * relayERC20
: process incoming messages from the L2to...
(UNLIKELY_OPENING_PUNCTUATION)
🔇 Additional comments (2)
pages/stack/interop/deploy-superchain-erc20.mdx (2)
10-14
: LGTM!
The title follows sentence case guidelines, and the callout effectively communicates the development status.
48-51
: LGTM!
The next steps section provides clear guidance with appropriate resources.
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.
lgtm
Closes https://github.com/ethereum-optimism/devrel/issues/381
This doc explains how to deploy assests using the
SuperchainERC20
standard.The issue had minimal collateral, so there may be pieces missing; especially regarding code examples and how we want to message this as a company. I've left various comments where I think specific review is needed.