From a43663c65249b1a7f2b7fb96c77c034ea7452ef7 Mon Sep 17 00:00:00 2001 From: 0xParticle Date: Fri, 2 Aug 2024 16:19:00 -0300 Subject: [PATCH 1/3] specs: updated OptimismMintableERC20Factory specs to use CREATE3 --- specs/protocol/predeploys.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/specs/protocol/predeploys.md b/specs/protocol/predeploys.md index 4250ade7e..0458167b4 100644 --- a/specs/protocol/predeploys.md +++ b/specs/protocol/predeploys.md @@ -289,17 +289,30 @@ upgraded by changing its proxy's implementation key. ## OptimismMintableERC20Factory -[Implementation](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/universal/OptimismMintableERC20Factory.sol) - Address: `0x4200000000000000000000000000000000000012` The `OptimismMintableERC20Factory` is responsible for creating ERC20 contracts on L2 that can be -used for depositing native L1 tokens into. These ERC20 contracts can be created permisionlessly +used for depositing native L1 tokens into (`OptimismMintableERC20`). These ERC20 contracts can be created permisionlessly and implement the interface required by the `StandardBridge` to just work with deposits and withdrawals. -Each ERC20 contract that is created by the `OptimismMintableERC20Factory` allows for the `L2StandardBridge` to mint +Each `OptimismMintableERC20` contract that is created by the `OptimismMintableERC20Factory` allows for the `L2StandardBridge` to mint and burn tokens, depending on if the user is depositing from L1 to L2 or withdrawing from L2 to L1. +The factory will deploy using `CREATE3`, where the salt will depend on the user inputs: `remoteToken`, `name`, `symbol`, and `decimals`. The use of `CREATE3` over `CREATE2` removes any dependence on the compiler. + +```solidity +bytes memory _creationCode = abi.encodePacked( + type(OptimismMintableERC20).creationCode, + abi.encode(_bridge, _remoteToken, _name, _symbol, _decimals) +); + +bytes32 salt = keccak256(abi.encode(_remoteToken, _name, _symbol, _decimals)); +_optimismMintableERC20 = CREATE3.deploy(salt, _creationCode); +``` + +The `OptimismMintableERC20Factory` will include a `deployments` mapping to store the `remoteToken` address for each deployed `OptimsimMintableERC20`. + + ## OptimismMintableERC721Factory [Implementation](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/universal/OptimismMintableERC721Factory.sol) From df8eefdc9bcd35d13420a8f2c2e4959fa340d238 Mon Sep 17 00:00:00 2001 From: 0xParticle Date: Fri, 2 Aug 2024 16:20:23 -0300 Subject: [PATCH 2/3] feat: lint --- specs/protocol/predeploys.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/specs/protocol/predeploys.md b/specs/protocol/predeploys.md index 0458167b4..b59998a0b 100644 --- a/specs/protocol/predeploys.md +++ b/specs/protocol/predeploys.md @@ -298,7 +298,9 @@ and implement the interface required by the `StandardBridge` to just work with d Each `OptimismMintableERC20` contract that is created by the `OptimismMintableERC20Factory` allows for the `L2StandardBridge` to mint and burn tokens, depending on if the user is depositing from L1 to L2 or withdrawing from L2 to L1. -The factory will deploy using `CREATE3`, where the salt will depend on the user inputs: `remoteToken`, `name`, `symbol`, and `decimals`. The use of `CREATE3` over `CREATE2` removes any dependence on the compiler. +The factory will deploy using `CREATE3`, where the salt will depend on the user inputs: +`remoteToken`, `name`, `symbol`, and `decimals`. +The use of `CREATE3` over `CREATE2` removes any dependence on the compiler. ```solidity bytes memory _creationCode = abi.encodePacked( @@ -310,8 +312,8 @@ bytes32 salt = keccak256(abi.encode(_remoteToken, _name, _symbol, _decimals)); _optimismMintableERC20 = CREATE3.deploy(salt, _creationCode); ``` -The `OptimismMintableERC20Factory` will include a `deployments` mapping to store the `remoteToken` address for each deployed `OptimsimMintableERC20`. - +The `OptimismMintableERC20Factory` will include a `deployments` mapping +to store the `remoteToken` address for each deployed `OptimsimMintableERC20`. ## OptimismMintableERC721Factory From a8178b6743f6a12a84f870017132c55090396e08 Mon Sep 17 00:00:00 2001 From: 0xParticle Date: Fri, 2 Aug 2024 17:20:56 -0300 Subject: [PATCH 3/3] feat: lint --- specs/protocol/predeploys.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/specs/protocol/predeploys.md b/specs/protocol/predeploys.md index b59998a0b..aa2e77df4 100644 --- a/specs/protocol/predeploys.md +++ b/specs/protocol/predeploys.md @@ -295,8 +295,10 @@ The `OptimismMintableERC20Factory` is responsible for creating ERC20 contracts o used for depositing native L1 tokens into (`OptimismMintableERC20`). These ERC20 contracts can be created permisionlessly and implement the interface required by the `StandardBridge` to just work with deposits and withdrawals. -Each `OptimismMintableERC20` contract that is created by the `OptimismMintableERC20Factory` allows for the `L2StandardBridge` to mint -and burn tokens, depending on if the user is depositing from L1 to L2 or withdrawing from L2 to L1. +Each `OptimismMintableERC20` contract that is created by the `OptimismMintableERC20Factory` +allows for the `L2StandardBridge` to mint +and burn tokens, depending on if the user is +depositing from L1 to L2 or withdrawing from L2 to L1. The factory will deploy using `CREATE3`, where the salt will depend on the user inputs: `remoteToken`, `name`, `symbol`, and `decimals`. @@ -313,7 +315,7 @@ _optimismMintableERC20 = CREATE3.deploy(salt, _creationCode); ``` The `OptimismMintableERC20Factory` will include a `deployments` mapping -to store the `remoteToken` address for each deployed `OptimsimMintableERC20`. +to store the `remoteToken` address for each deployed `OptimsimMintableERC20`. ## OptimismMintableERC721Factory