Skip to content

Commit 2989b2a

Browse files
authored
feat(devnet): Add command for deploying metabased chain contracts (#31)
1 parent b6797b5 commit 2989b2a

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.devcontainer/justfile

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,24 @@ foundry_path := env_var('PATH') + ":" + env_var('HOME') + "/.foundry/bin"
44
# Define fully qualified path to forge binary
55
forge := env_var('HOME') + "/.foundry/bin/forge"
66

7-
# Minimum forge version (annoted by build date since we're using nightly build)
7+
# Define minimum forge version (annoted by build date since we're using nightly build)
88
forge_min_build_date := "2024-10-22"
99

10+
# Define a non-zero number to identify the layer-3 chain
11+
l3_chain_id := "5100"
12+
13+
# Define a private key authorized to deploy contracts on Optimism devnet
14+
# This private key is common knowledge, you should not use it on any network other than this dev network.
15+
# Using this private key on mainnet, or even a testnet, will most likely result in a loss of funds.
16+
# https://docs.optimism.io/chain/testing/dev-node#additional-info
17+
op_devnet_private_key := "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
18+
19+
# Define layer-2 devnet RPC URL launched by the Optimism devnet
20+
op_devnet_l2_rpc_url := "127.0.0.1:9545"
21+
22+
# Define root directory of the metabased contracts project
23+
contracts_root := justfile_directory() + "/../metabased-contracts"
24+
1025
# Add Foundry's bin directory to the PATH for all recipes
1126
export PATH := foundry_path
1227

@@ -16,7 +31,7 @@ op-clone:
1631
# This is true across 1.9.3, 1.9.4, and develop, but it appears to happen
1732
# less frequently on develop. We'll change this to use the latest release
1833
# once it's fixed
19-
# If you encounter this error, you can try running `op-clean` to clean up
34+
# If you encounter this error, you can try running `op-reclone` to clean up
2035
# and re-clone the repository
2136
git clone --branch develop --single-branch --depth 1 https://github.com/ethereum-optimism/optimism.git ~/optimism || echo skipping clone
2237

@@ -25,6 +40,12 @@ op-clean:
2540

2641
op-reclone: op-down op-clean op-clone
2742

43+
# Deploy MetabasedSequencerChain smart contract to devnet
44+
op-deploy-chain:
45+
cat {{ contracts_root }}/script/DeployContractsForSequencerChain.s.sol | sed 's/l3ChainId = 0;[^\n]*/l3ChainId = {{ l3_chain_id }};/' > {{ contracts_root }}/script/DeployContractsForSequencerChain_.s.sol
46+
forge script --root {{ contracts_root }} {{ contracts_root }}/script/DeployContractsForSequencerChain_.s.sol:DeployMetabasedSequencerChainPlusSetupWithAlwaysAllowModule --rpc-url {{ op_devnet_l2_rpc_url }} --private-key {{ op_devnet_private_key }} --broadcast -vv
47+
rm {{ contracts_root }}/script/DeployContractsForSequencerChain_.s.sol
48+
2849
go-install:
2950
go install /workspaces/metabased-rollup/op-translator
3051
# go install /workspaces/metabased-rollup/metabased-publisher/cmd
@@ -66,6 +87,7 @@ create-aliases:
6687
echo "alias op-clean='just -f {{justfile()}} op-clean'" >> "$rc_file"
6788
echo "alias op-reclone='just -f {{justfile()}} op-reclone'" >> "$rc_file"
6889
echo "alias go-install='just -f {{justfile()}} go-install'" >> "$rc_file"
90+
echo "alias op-deploy-chain='just -f {{justfile()}} op-deploy-chain'" >> "$rc_file"
6991
echo "# END Metabased Rollup Dev Container aliases" >> "$rc_file"
7092
echo "Aliases created in $rc_file"
7193
else

0 commit comments

Comments
 (0)