-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
feat: introduce SuperchainERC20 redesign + ICrosschainERC20 #12321
feat: introduce SuperchainERC20 redesign + ICrosschainERC20 #12321
Conversation
* feat: add superchain erc20 bridge * fix: interfaces and versions
* refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors
* test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes
* chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]>
--------- Co-authored-by: agusduha <[email protected]>
* refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]>
fix: update redesign with dev
* fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message
* feat: add crosschain erc20 interface * fix: refactor interfaces
Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
* fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20
What is the |
packages/contracts-bedrock/scripts/checks/semver-natspec/main.go
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/snapshots/abi/OptimismSuperchainERC20.json
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/src/L2/interfaces/IOptimismSuperchainERC20Factory.sol
Outdated
Show resolved
Hide resolved
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.
Just a skim of the diff with a few small comments
packages/contracts-bedrock/scripts/checks/semver-natspec/main.go
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/src/L2/interfaces/IOptimismSuperchainERC20.sol
Show resolved
Hide resolved
packages/contracts-bedrock/src/L2/interfaces/ICrosschainERC20.sol
Outdated
Show resolved
Hide resolved
* fix: refactor common errors * fix: remove unused version
…ory-merge-conflicts fix: superchain erc20 factory merge conflicts
Regarding usage of interfaces, will leave it to @smartcontracts to make it simple + straight forward with ensuring that its done correctly. Given there is already a list of ignored files that don't follow the standard, this PR does not need to worry about fixing existing issues or following a particular style, as long as CI passes. ethereum-optimism/design-docs#135 will help to further the efforts of ensuring that the interfaces are used consistently |
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.
Test coverage is very thorough
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.
Test coverage is very thorough
cb2066b
|
||
/// @notice Mapping of the deployed OptimismSuperchainERC20 to the remote token address. | ||
/// This is used to keep track of the token deployments. | ||
mapping(address _localToken => address remoteToken_) public deployments; |
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.
Naming nits:
- Is there a benefit for using underscores in named mappings? The name can't be used anywhere AFAIK and is only for readability, so may as well remove the underscores
- Naming the second arg in a mapping always seemed redundant to me, because it's the same as the variable. In other words, it feels confusing to me that
remoteToken_
anddeployments
are the same thing—doesn't this mean we're giving two variable names to the same value? Using:
mapping(address _localToken => address) public deployments;
or
mapping(address _localToken => address) public remoteTokens;
feels more clear to me
|
||
uint256 source = IL2ToL2CrossDomainMessenger(MESSENGER).crossDomainMessageSource(); | ||
emit CrosschainMinted(_to, _amount); |
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.
another naming nit, should this be present tense of CrosschainMint
for consistency with the commong methodName/EventNames
used in ERC20s of transfer/Transfer
and mint/Mint
? Guessing we've bikeshed on this before, so this (like my other comments so far) is not super important
|
||
emit RelayERC20(_from, _to, _amount, source); | ||
emit CrosschainBurnt(_from, _amount); |
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.
…-optimism#12321) * feat: add superchain erc20 bridge (ethereum-optimism#61) * feat: add superchain erc20 bridge * fix: interfaces and versions * refactor: optimism superchain erc20 redesign (ethereum-optimism#62) * refactor: use oz upgradeable erc20 as dependency * chore: update interfaces * fix: tests based on changes * refactor: remove op as dependency * feat: add check for supererc20 bridge on modifier * chore: update tests and interfaces * chore: update stack vars name on test * chore: remove empty gitmodules file * chore: update superchain weth errors * test: add superchain erc20 bridge tests (ethereum-optimism#65) * test: add superchain erc20 bridge tests * test: add optimism superchain erc20 beacon tests * test: remove unnecessary test * test: tests fixes * test: tests fixes * chore: update missing bridge on natspec (ethereum-optimism#69) * chore: update missing bridge on natspec * fix: natspecs --------- Co-authored-by: agusduha <[email protected]> * fix: remove superchain erc20 base (ethereum-optimism#70) * refactor: update isuperchainweth (ethereum-optimism#71) --------- Co-authored-by: agusduha <[email protected]> * feat: rename mint/burn and add SuperchainERC20 (ethereum-optimism#74) * refactor: rename mint and burn functions on superchain erc20 * chore: rename optimism superchain erc20 to superchain erc20 * feat: create optimism superchain erc20 contract * chore: update natspec and errors * fix: superchain erc20 tests * refactor: make superchain erc20 abstract * refactor: move storage and erc20 metadata functions to implementation * chore: update interfaces * chore: update superchain erc20 events * fix: tests * fix: natspecs * fix: add semmver lock and snapshots * fix: remove unused imports * fix: natspecs --------- Co-authored-by: 0xDiscotech <[email protected]> * fix: refactor zero check (ethereum-optimism#76) * fix: pre pr * fix: semver natspec check failure (ethereum-optimism#79) * fix: semver natspec check failure * fix: ignore mock contracts in semver natspec script * fix: error message * feat: add crosschain erc20 interface (ethereum-optimism#80) * feat: add crosschain erc20 interface * fix: refactor interfaces * fix: superchain bridge natspec (ethereum-optimism#83) * fix: superchain weth natspec (ethereum-optimism#84) Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]> * fix: stop inheriting superchain interfaces (ethereum-optimism#85) * fix: stop inheriting superchain interfaces * fix: move events and erros into the implementation * fix: make superchainERC20 inherits from crosschainERC20 * fix: superchain bridge rename (ethereum-optimism#86) * fix: fee vault compiler error (ethereum-optimism#87) * fix: remove unused imports * fix: refactor common errors (ethereum-optimism#90) * fix: refactor common errors * fix: remove unused version * fix: reuse unauthorized error (ethereum-optimism#92) * fix: superchain erc20 factory conflicts * fix: rename crosschain functions (ethereum-optimism#94) --------- Co-authored-by: Disco <[email protected]> Co-authored-by: 0xng <[email protected]> Co-authored-by: 0xParticle <[email protected]> Co-authored-by: gotzenx <[email protected]>
Description
The main idea is migrating the
sendERC20
andrelayERC20
functions from theSuperchainERC20
standard to a newSuperchainERC20Bridge
. Also introducingICrosschainERC20
interface for mint/burn functions to be cross-chain neutral and extensible to other L2s.Specs:
ethereum-optimism/specs#384
ethereum-optimism/specs#413
Tests
SuperchainERC20Bridge
testsAdditional context
The
SuperchainERC20Bridge
is a new predeploy.Metadata
Closes #12322