feat: introduce OptimismSuperchainERC20Factory
Description
Implement the factory for deploying OptimismSuperchainERC20 Beacon proxies.
Spec: https://github.com/ethereum-optimism/specs/pull/332
Tests
Added OptimismSuperchainERC20Factory tests
Test the OptimismSuperchainERC20 Beacon in its tests
Additional context
Q: Should the OptimismSuperchainERC20Beacon predeploy be proxied?
TODO: Set the correct address of the OptimismSuperchainERC20 implementation in the OptimismSuperchainERC20Beacon contract.
Metadata
- Closes https://github.com/ethereum-optimism/optimism/issues/10872
@tynes Do you have an usual way to generate an address in the L2Genesis script? It is the thing missing for the OptimismSuperchainERC20 implementation
@tynes Do you have an usual way to generate an address in the
L2Genesisscript? It is the thing missing for theOptimismSuperchainERC20implementation
An example of how addresses are generated can be found here: https://github.com/ethereum-optimism/specs/blob/9342867e3fd6dcd47038200b21629d25cb7fe566/specs/protocol/fjord/derivation.md#network-upgrade-automation-transactions
The idea is that the hardfork includes special deposit transactions at the hardfork block and these deposit transactions can deploy contracts, initialize state, modify implementations in proxies. We will need to compute the address at which the implementation will be deployed at. There isn't really any special reason as to why a particular from is picked, usually a fresh one is used with nonce 0. There needs to be enough gas to do the execution.
I recommend just creating an entry in the predeploys library for an arbitrary address for now, and we can think about the hardfork later. For now we just care about new networks
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 78.78%. Comparing base (
d887cfa) to head (3e23981). Report is 2 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #11617 +/- ##
========================================
Coverage 78.78% 78.78%
========================================
Files 41 41
Lines 3262 3262
========================================
Hits 2570 2570
Misses 529 529
Partials 163 163
| Flag | Coverage Δ | |
|---|---|---|
| cannon-go-tests | 78.78% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
It looks like this may need to be rebased one more time to get the latest CI to run with it, some new required CI was added since this was last committed to. The code looks good to me, great work!