Skip to content
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

design-doc: mirror standard #36

Closed
wants to merge 2 commits into from
Closed

design-doc: mirror standard #36

wants to merge 2 commits into from

Conversation

0xParticle
Copy link
Contributor

Description

This document presents the SuperchainERC20 Mirror Standard, which enables existing tokens deployed through OptimismMintableERC20 Factory in L2 (also called legacy tokens) to be interoperable without any liquidity migration process.

@tynes tynes mentioned this pull request Jun 20, 2024
Below, we show what the implementation of the mirror contract would look like.

```solidity
contract Mirror is Superc20 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this references the design in ethereum-optimism/specs#71, can we assume general consensus on the design in that PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

an we assume general consensus on the design in that PR?

I was going to ask a similar question, and I think the answer is no we cannot assume general consensus, since that PR is a bit stale with a lot of open comments. It feels like that PR is a prerequisite for this one + interoperable ether (#25), so I would suggest reprioritizing the SuperchainERC20 standard so we can finalize that first

return LEGACY_TOKEN.balanceOf(account);
}

function transfer(address recipient, uint256 amount) public override returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to have the flow that shows a cross chain transfer, perhaps as a mermaid diagram. My current understanding, assuming the mirror token is already deployed on both domains:

  • holding OptimismMintableERC20Token
  • call mirror transfer to self
  • call mirror superchain erc20 sendERC20 per interop: token standard specs#71 (comment), this burns the token
  • on remote domain, send the executing transaction that mints the token

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 I would suggest removing code from this design doc, and replace it with diagrams showing the user flows and data flows. Per the design doc template:

As a rule of thumb, including code snippets (except for defining an external API) is likely too low level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just created some basic flows in Figma: https://www.figma.com/board/IXC6WnDaqrheplxbCZpw3l/%5BExternal%5D-Mirror-Standard?node-id=0-1&t=3tsA67ghaqocKaRv-1

will migrate these to Mermaid after discussion


### Deployment

Deploying mirror versions will require introducing a new predeploy for`SuperchainERC20` factory. This factory would accomplish the following:
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens to the existing OptimismMintableERC20Factory on L1 and L2?

Copy link
Contributor Author

@0xParticle 0xParticle Jun 25, 2024

Choose a reason for hiding this comment

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

There is no need to modify or deprecate the OptimismMintableERC20Factory, but we can discuss if there is any considerable advantage of doing so.

- Designed to enable same-address deployments across OP Chains.
- Address predictability for each token, we should know the corresponding Mirror.
- Simple Factory code.
- It may serve to create both `SuperchainERC20` standard tokens and mirror versions.
Copy link
Contributor

Choose a reason for hiding this comment

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

It sounds like this is uncertain, we should finalize the design here before merging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current Factory design doc only covers Mirror, but we think it can be extended. We can discuss this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So yes, agree we should cover and solve this before merging

@tynes
Copy link
Contributor

tynes commented Jun 25, 2024

We will want to describe how to do withdrawals back to L1 using this standard

@tynes tynes mentioned this pull request Jun 26, 2024
@tynes
Copy link
Contributor

tynes commented Jul 31, 2024

Closing this in favor of the convert approach

@tynes tynes closed this Jul 31, 2024
@tynes tynes deleted the feat/mirror-standard branch July 31, 2024 23:21
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.

4 participants