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: remove output dependency from foundry l1 contracts #460

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
create2_factory_addr = "0x4e59b44847b379578588920cA78FbF26c0B4956C"
create2_factory_salt = "0x00000000000000000000000000000000000000000000000000000000000000ff"

[tokens.DAI]
name = "DAI"
symbol = "DAI"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
l1_weth_token_addr = "0x0b5026ED9Cb49981915EA448b801E416Da829315"
create2_factory_addr = "0x4e59b44847b379578588920cA78FbF26c0B4956C"
create2_factory_salt = "0x00000000000000000000000000000000000000000000000000000000000000ff"
era_chain_id = "270"
bridgehub_proxy_addr = "0x2437B508C490C0b65D53Fc6ef8F94A890A10a6b7"

l2_shared_bridge_addr = "0x0000000000000000000000000000000000000000"
l2_weth_token_proxy_addr = "0x0000000000000000000000000000000000000000"
l2_weth_token_impl_addr = "0x0000000000000000000000000000000000000000"
Expand Down
14 changes: 4 additions & 10 deletions l1-contracts-foundry/script/DeployErc20.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,16 @@ contract DeployErc20Script is Script {
function initializeConfig() internal {
config.deployerAddress = msg.sender;

string memory root = vm.projectRoot();

// Grab config from output of l1 deployment
string memory path = string.concat(root, "/script-out/output-deploy-l1.toml");
string memory toml = vm.readFile(path);

// Config file must be parsed key by key, otherwise values returned
// are parsed alfabetically and not by key.
// https://book.getfoundry.sh/cheatcodes/parse-toml
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/script-config/config-deploy-erc20.toml");
string memory toml = vm.readFile(path);

config.create2FactoryAddr = vm.parseTomlAddress(toml, "$.create2_factory_addr");
config.create2FactorySalt = vm.parseTomlBytes32(toml, "$.create2_factory_salt");

// Grab config from custom config file
path = string.concat(root, "/script-config/config-deploy-erc20.toml");
toml = vm.readFile(path);

string[] memory tokens = vm.parseTomlKeys(toml, "$.tokens");

for (uint256 i = 0; i < tokens.length; i++) {
Expand Down
22 changes: 5 additions & 17 deletions l1-contracts-foundry/script/InitializeL2WethToken.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,17 @@ contract InitializeL2WethTokenScript is Script {
function initializeConfig() internal {
config.deployerAddress = msg.sender;

// Parse some config from output of l1 deployment
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/script-out/output-deploy-l1.toml");
string memory path = string.concat(root, "/script-config/config-initialize-l2-weth-token.toml");
string memory toml = vm.readFile(path);

config.l1WethTokenAddr = toml.readAddress("$.l1_weth_token_addr");
config.l1WethTokenName = "Wrapped Ether";
config.l1WethTokenSymbol = "WETH";
config.create2FactoryAddr = toml.readAddress("$.create2_factory_addr");
config.create2FactorySalt = toml.readBytes32("$.create2_factory_salt");
config.eraChainId = toml.readUint("$.era_chain_id");
config.bridgehubProxyAddr = toml.readAddress("$.deployed_addresses.bridgehub.bridgehub_proxy_addr");

// Parse some config from output of erc20 tokens deployment
path = string.concat(root, "/script-out/output-deploy-erc20.toml");
toml = vm.readFile(path);

config.l1WethTokenAddr = toml.readAddress("$.tokens.WETH.address");
config.l1WethTokenName = toml.readString("$.tokens.WETH.name");
config.l1WethTokenSymbol = toml.readString("$.tokens.WETH.symbol");

// Parse some config from custom config
// TODO: read from L2 deployment output when available
path = string.concat(root, "/script-config/config-initialize-l2-weth-token.toml");
toml = vm.readFile(path);

config.bridgehubProxyAddr = toml.readAddress("$.bridgehub_proxy_addr");
config.l2SharedBridgeAddr = toml.readAddress("$.l2_shared_bridge_addr");
config.l2WethTokenProxyAddr = toml.readAddress("$.l2_weth_token_proxy_addr");
config.l2WethTokenImplAddr = toml.readAddress("$.l2_weth_token_impl_addr");
Expand Down