Commit 6f74ca9f authored by smartcontracts's avatar smartcontracts Committed by GitHub

style(ctb): clean up PredeployAddresses (#2967)

Cleans up the PredeployAddresses contract. I went ahead and clearly
marked and separated the legacy addresses and the non-legacy addresses.
I also renamed the L2StandardTokenFactory address to correspond to the
new name (OptimismMintableERC20Factory) and deleted several predeploy
addresses which no longer exist in the state of L2.
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent f9fee446
---
'@eth-optimism/contracts-bedrock': patch
---
Clean up the PredeployAddresses library
...@@ -3,20 +3,66 @@ pragma solidity ^0.8.9; ...@@ -3,20 +3,66 @@ pragma solidity ^0.8.9;
/** /**
* @title PredeployAddresses * @title PredeployAddresses
* @notice Contains constant addresses for contracts that are pre-deployed to the L2 system.
*/ */
library PredeployAddresses { library PredeployAddresses {
/**
* @notice Address of the L2ToL1MessagePasser predeploy.
*/
address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000; address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;
address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;
address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002; /**
address internal constant LEGACY_ERC20_ETH = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000; * @notice Address of the L2CrossDomainMessenger predeploy.
*/
address internal constant L2_CROSS_DOMAIN_MESSENGER = address internal constant L2_CROSS_DOMAIN_MESSENGER =
0x4200000000000000000000000000000000000007; 0x4200000000000000000000000000000000000007;
address internal constant ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;
address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009; /**
* @notice Address of the L2StandardBridge predeploy.
*/
address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010; address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;
/**
* @notice Address of the SequencerFeeWallet predeploy.
*/
address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011; address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;
address internal constant L2_STANDARD_TOKEN_FACTORY =
/**
* @notice Address of the OptimismMintableERC20Factory predeploy.
*/
address internal constant OPTIMISM_MINTABLE_ERC20_FACTORY =
0x4200000000000000000000000000000000000012; 0x4200000000000000000000000000000000000012;
address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;
/**
* @notice Address of the L1Block predeploy.
*/
address internal constant L1_BLOCK_ATTRIBUTES = 0x4200000000000000000000000000000000000015; address internal constant L1_BLOCK_ATTRIBUTES = 0x4200000000000000000000000000000000000015;
/**
* @custom:legacy
* @notice Address of the L1MessageSender predeploy. Deprecated. Use L2CrossDomainMessenger
* or access tx.origin (or msg.sender) in a L1 to L2 transaction instead.
*/
address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;
/**
* @custom:legacy
* @notice Address of the DeployerWhitelist predeploy. No longer active.
*/
address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;
/**
* @custom:legacy
* @notice Address of the LegacyERC20ETH predeploy. Deprecated. Balances are migrated to the
* state trie as of the Bedrock upgrade. Contract has been locked and write functions
* can no longer be accessed.
*/
address internal constant LEGACY_ERC20_ETH = 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000;
/**
* @custom:legacy
* @notice Address of the L1BlockNumber predeploy. Deprecated. Use the L1Block predeploy
* instead, which exposes more information about the L1 state.
*/
address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;
} }
...@@ -334,7 +334,7 @@ contract Bridge_Initializer is Messenger_Initializer { ...@@ -334,7 +334,7 @@ contract Bridge_Initializer is Messenger_Initializer {
super.setUp(); super.setUp();
vm.label(PredeployAddresses.L2_STANDARD_BRIDGE, "L2StandardBridge"); vm.label(PredeployAddresses.L2_STANDARD_BRIDGE, "L2StandardBridge");
vm.label(PredeployAddresses.L2_STANDARD_TOKEN_FACTORY, "L2StandardTokenFactory"); vm.label(PredeployAddresses.OPTIMISM_MINTABLE_ERC20_FACTORY, "OptimismMintableERC20Factory");
// Deploy the L1 bridge and initialize it with the address of the // Deploy the L1 bridge and initialize it with the address of the
// L1CrossDomainMessenger // L1CrossDomainMessenger
...@@ -367,9 +367,9 @@ contract Bridge_Initializer is Messenger_Initializer { ...@@ -367,9 +367,9 @@ contract Bridge_Initializer is Messenger_Initializer {
OptimismMintableERC20Factory factory = new OptimismMintableERC20Factory( OptimismMintableERC20Factory factory = new OptimismMintableERC20Factory(
PredeployAddresses.L2_STANDARD_BRIDGE PredeployAddresses.L2_STANDARD_BRIDGE
); );
vm.etch(PredeployAddresses.L2_STANDARD_TOKEN_FACTORY, address(factory).code); vm.etch(PredeployAddresses.OPTIMISM_MINTABLE_ERC20_FACTORY, address(factory).code);
L2TokenFactory = OptimismMintableERC20Factory( L2TokenFactory = OptimismMintableERC20Factory(
PredeployAddresses.L2_STANDARD_TOKEN_FACTORY PredeployAddresses.OPTIMISM_MINTABLE_ERC20_FACTORY
); );
vm.etch(PredeployAddresses.LEGACY_ERC20_ETH, address(new LegacyERC20ETH()).code); vm.etch(PredeployAddresses.LEGACY_ERC20_ETH, address(new LegacyERC20ETH()).code);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment