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

feat: introduce SuperchainERC20 redesign + ICrosschainERC20 #12321

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ae024a5
feat: add superchain erc20 bridge (#61)
agusduha Sep 25, 2024
2a22161
refactor: optimism superchain erc20 redesign (#62)
0xDiscotech Sep 26, 2024
6aaf905
test: add superchain erc20 bridge tests (#65)
agusduha Sep 27, 2024
11fda67
chore: update missing bridge on natspec (#69)
0xDiscotech Sep 27, 2024
7a69a7e
fix: remove superchain erc20 base (#70)
agusduha Sep 27, 2024
07c9c77
refactor: update isuperchainweth (#71)
0xDiscotech Sep 27, 2024
d9bdad1
feat: rename mint/burn and add SuperchainERC20 (#74)
agusduha Oct 1, 2024
2e507b2
fix: refactor zero check (#76)
agusduha Oct 2, 2024
7fcaf6c
Merge branch 'develop' into fix/redesign-merge-conflicts
agusduha Oct 2, 2024
619f23c
fix: pre pr
agusduha Oct 2, 2024
1981789
Merge pull request #77 from defi-wonderland/fix/redesign-merge-conflicts
agusduha Oct 2, 2024
ae019b8
fix: semver natspec check failure (#79)
agusduha Oct 3, 2024
a5aca61
feat: add crosschain erc20 interface (#80)
agusduha Oct 3, 2024
83757ea
fix: superchain bridge natspec (#83)
agusduha Oct 4, 2024
904a0ce
fix: superchain weth natspec (#84)
agusduha Oct 4, 2024
3ebb1d1
fix: stop inheriting superchain interfaces (#85)
agusduha Oct 4, 2024
1b4317e
fix: superchain bridge rename (#86)
agusduha Oct 7, 2024
10038c3
fix: fee vault compiler error (#87)
agusduha Oct 7, 2024
9f49b43
Merge branch 'develop' into fix/crosschain-merge-conflicts
agusduha Oct 8, 2024
ab1e074
fix: remove unused imports
agusduha Oct 8, 2024
a79bf4e
Merge pull request #88 from defi-wonderland/fix/crosschain-merge-conf…
agusduha Oct 8, 2024
af9694e
fix: refactor common errors (#90)
agusduha Oct 9, 2024
6c46f9b
fix: reuse unauthorized error (#92)
agusduha Oct 10, 2024
736adf3
Merge branch 'develop' into fix/superchain-erc20-factory-merge-conflicts
agusduha Oct 11, 2024
061b1ff
fix: superchain erc20 factory conflicts
agusduha Oct 11, 2024
97fb300
Merge pull request #93 from defi-wonderland/fix/superchain-erc20-fact…
agusduha Oct 11, 2024
71389b6
fix: rename crosschain functions (#94)
agusduha Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ GasBenchMark_L1BlockInterop_SetValuesInterop:test_setL1BlockValuesInterop_benchm
GasBenchMark_L1BlockInterop_SetValuesInterop_Warm:test_setL1BlockValuesInterop_benchmark() (gas: 5099)
GasBenchMark_L1Block_SetValuesEcotone:test_setL1BlockValuesEcotone_benchmark() (gas: 158531)
GasBenchMark_L1Block_SetValuesEcotone_Warm:test_setL1BlockValuesEcotone_benchmark() (gas: 7597)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369245)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967385)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564368)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076583)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369242)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967382)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 564356)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4076571)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467019)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512723)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72618)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72621)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68357)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68921)
Expand Down
2 changes: 2 additions & 0 deletions packages/contracts-bedrock/scripts/Artifacts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ abstract contract Artifacts {
return payable(Predeploys.OPTIMISM_SUPERCHAIN_ERC20_FACTORY);
} else if (digest == keccak256(bytes("OptimismSuperchainERC20Beacon"))) {
return payable(Predeploys.OPTIMISM_SUPERCHAIN_ERC20_BEACON);
} else if (digest == keccak256(bytes("SuperchainTokenBridge"))) {
return payable(Predeploys.SUPERCHAIN_TOKEN_BRIDGE);
}
return payable(address(0));
}
Expand Down
7 changes: 7 additions & 0 deletions packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ contract L2Genesis is Deployer {
setETHLiquidity(); // 25
setOptimismSuperchainERC20Factory(); // 26
setOptimismSuperchainERC20Beacon(); // 27
setSuperchainTokenBridge(); // 28
}
}

Expand Down Expand Up @@ -601,6 +602,12 @@ contract L2Genesis is Deployer {
vm.resetNonce(address(beacon));
}

/// @notice This predeploy is following the safety invariant #1.
/// This contract has no initializer.
function setSuperchainTokenBridge() internal {
_setImplementationCode(Predeploys.SUPERCHAIN_TOKEN_BRIDGE);
}

/// @notice Sets all the preinstalls.
function setPreinstalls() public {
address tmpSetPreinstalls = address(uint160(uint256(keccak256("SetPreinstalls"))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,14 @@ EXCLUDE_CONTRACTS=(
"ILegacyMintableERC20"
"IOptimismMintableERC20"
"IOptimismMintableERC721"
"IOptimismSuperchainERC20"

# Doesn't start with "I"
"MintableAndBurnable"
"KontrolCheatsBase"

# Currently inherit from interface, needs to be fixed.
"IWETH"
"IDelayedWETH"
"ISuperchainWETH"
"IL2ToL2CrossDomainMessenger"
"ICrossL2Inbox"
"ISystemConfigInterop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ var excludeContracts = []string{

// TODO: Interfaces that need to be fixed
"IInitializable", "IPreimageOracle", "ILegacyMintableERC20", "IOptimismMintableERC20",
"IOptimismMintableERC721", "IOptimismSuperchainERC20", "MintableAndBurnable",
"KontrolCheatsBase", "IWETH", "IDelayedWETH", "IL2ToL2CrossDomainMessenger",
"ICrossL2Inbox", "ISystemConfigInterop", "IResolvedDelegateProxy",
"IOptimismMintableERC721", "KontrolCheatsBase", "IWETH", "IDelayedWETH", "ISuperchainWETH",
"IL2ToL2CrossDomainMessenger", "ICrossL2Inbox", "ISystemConfigInterop", "IResolvedDelegateProxy",
}

type ContractDefinition struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ func run() error {
return
}

// Skip mock contracts
if strings.HasPrefix(contractName, "Mock") {
return
}

contractPath := contractFiles[contractName]
if contractPath == "" {
fail("%s: Source file not found", contractName)
fail("%s: Source file not found (For test mock contracts, prefix the name with 'Mock' to ignore this warning)", contractName)
return
}

Expand Down
24 changes: 16 additions & 8 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
"sourceCodeHash": "0xb55e58b5d4912edf05026878a5f5ac8019372212ed2a77843775d595fbf51b84"
},
"src/L2/L2StandardBridgeInterop.sol": {
"initCodeHash": "0x9bc28e8511a4593362c2517ff90b26f9c1ecee382cce3950b47ca08892a872ef",
"sourceCodeHash": "0x6c814f4536d9fb8f384ed2195957f868abd15252e36d6dd243f3d60349a61994"
"initCodeHash": "0xd43d07c2ba5a73af56181c0221c28f3b495851b03cf8e35f9b009857bb9538a6",
"sourceCodeHash": "0x36087332a4365ee172eed8fa35aa48e804b08279e97332058a588c2d4ae30c6b"
},
"src/L2/L2ToL1MessagePasser.sol": {
"initCodeHash": "0x13fe3729beb9ed966c97bef09acb9fe5043fe651d453145073d05f2567fa988d",
Expand All @@ -108,24 +108,32 @@
"sourceCodeHash": "0xfea53344596d735eff3be945ed1300dc75a6f8b7b2c02c0043af5b0036f5f239"
},
"src/L2/OptimismSuperchainERC20.sol": {
"initCodeHash": "0x965af580568bad2b47d04c6ea536490aa263e9fcb5fb43e6c8bc00929fda3df5",
"sourceCodeHash": "0x9de349519900b1051f45d507b2fac1cf3f3ae8e2cfb1ceb56875a7ace1cb6ab8"
"initCodeHash": "0xd5c84e45746fd741d541a917ddc1cc0c7043c6b21d5c18040d4bc999d6a7b2db",
"sourceCodeHash": "0xf32130f0b46333daba062c50ff6dcfadce1f177ff753bed2374d499ea9c2d98a"
},
"src/L2/OptimismSuperchainERC20Beacon.sol": {
"initCodeHash": "0x99ce8095b23c124850d866cbc144fee6cee05dbc6bb5d83acadfe00b90cf42c7",
"sourceCodeHash": "0x5e58b7c867fafa49fe39d68d83875425e9cf94f05f2835bdcdaa08fc8bc6b68e"
},
"src/L2/OptimismSuperchainERC20Factory.sol": {
"initCodeHash": "0x43ec413140b05bfb83ec453b0d4f82b33a2d560bf8c76405d08de17565b87053",
"sourceCodeHash": "0x1e02d78a4e7ee93a07f7af7a78fe1773d0e87711f23a4ccd10a8692b47644a34"
"initCodeHash": "0x18a362c57f08b611db98dfde96121385e938f995c84e3547c1c03fd49f9db2fd",
"sourceCodeHash": "0x450cd89d0aae7bbc85ff57a14a6d3468c24c6743f25943f6d895d34b1456c456"
},
"src/L2/SequencerFeeVault.sol": {
"initCodeHash": "0xcaadbf08057b5d47f7704257e9385a29e42a7a08c818646d109c5952d3d35218",
"sourceCodeHash": "0x05bbc6039e5a9ff38987e7b9b89c69e2ee8aa4b7ca20dd002ea1bbd3d70f27f3"
},
"src/L2/SuperchainERC20.sol": {
"initCodeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"sourceCodeHash": "0x75d061633a141af11a19b86e599a1725dfae8d245dcddfb6bb244a50d5e53f96"
},
"src/L2/SuperchainTokenBridge.sol": {
"initCodeHash": "0x07fc1d495928d9c13bd945a049d17e1d105d01c2082a7719e5d18cbc0e1c7d9e",
"sourceCodeHash": "0xaf2458e48dcadcafa8940cde7368549eae2280eef91247600d864ddac20f5d82"
},
"src/L2/SuperchainWETH.sol": {
"initCodeHash": "0x4ccd25f37a816205bc26f8532afa66e02f2b36ca7b7404d0fa48a4313ed16f0c",
"sourceCodeHash": "0xd186614f1515fa3ba2f43e401e639bfa3159603954e39a51769e9b57ad19a3fd"
"initCodeHash": "0x50f6ea9bfe650fcf792e98e44b1bf66c036fd0e6d4b753da680253d7d8609816",
"sourceCodeHash": "0x82d03262decf52d5954d40bca8703f96a0f3ba7accf6c1d75292856c2f34cf8f"
},
"src/L2/WETH.sol": {
"initCodeHash": "0xfb253765520690623f177941c2cd9eba23e4c6d15063bccdd5e98081329d8956",
Expand Down
Loading