forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
70 lines (61 loc) · 3.51 KB
/
justfile
File metadata and controls
70 lines (61 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
build:
go build -o bin/op-deployer cmd/op-deployer/main.go
build-contracts:
just ../packages/contracts-bedrock/forge-build
test args='./...': build-contracts
go test -v {{args}}
copy-contract-artifacts:
rm -f ./pkg/deployer/artifacts/forge-artifacts/artifacts.tgz
tar -cvzf ./pkg/deployer/artifacts/forge-artifacts/artifacts.tgz -C ../packages/contracts-bedrock/forge-artifacts --exclude="*.t.sol" .
# ======================================
# Deployment and Verification Utilities
#
# The following commands are used to deploy the OPCM and the associated implementations contracts,
# they are meant to be run in the order which they are listed.
# This provides a linear flow of deployment and verification steps.
# ======================================
export ROOT_DIR := parent_directory(justfile_directory())
export DEFAULT_LOCATOR := "embedded"
export NETWORK := env_var_or_default("NETWORK", "sepolia")
export PROTOCOL_VERSIONS_PROXY := if NETWORK == "mainnet" { "0x8062AbC286f5e7D9428a0Ccb9AbD71e50d93b935" } else if NETWORK == "sepolia" { "0x79ADD5713B383DAa0a138d3C4780C7A1804a8090" } else { "" }
export SUPERCHAIN_CONFIG_PROXY := if NETWORK == "mainnet" { "0x95703e0982140D16f8ebA6d158FccEde42f04a4C" } else if NETWORK == "sepolia" { "0xC2Be75506d5724086DEB7245bd260Cc9753911Be" } else { "" }
export SUPERCHAIN_PROXY_ADMIN := if NETWORK == "mainnet" { "0x543ba4aadbab8f9025686bd03993043599c6fb04" } else if NETWORK == "sepolia" { "0x189abaaaa82dfc015a588a7dbad6f13b1d3485bc" } else { "" }
export UPGRADE_CONTROLLER := if NETWORK == "mainnet" { "0x5a0Aae59D09fccBdDb6C6CcEB07B7279367C3d2A" } else if NETWORK == "sepolia" { "0x1Eb2fFc903729a0F03966B917003800b145F56E2" } else { "" }
export CHALLENGER := if NETWORK == "mainnet" { "0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A" } else if NETWORK == "sepolia" { "0xfd1D2e729aE8eEe2E146c033bf4400fE75284301" } else { "" }
# This command should be called before any deployment or verification commands.
_validate_rpc:
#!/bin/bash
CHAIN_ID=$(cast chain-id)
EXPECTED_CHAIN_ID=$(if [ "$NETWORK" == "mainnet" ]; then echo "1"; elif [ "$NETWORK" == "sepolia" ]; then echo "11155111"; else echo ""; fi)
if [ "$CHAIN_ID" != "$EXPECTED_CHAIN_ID" ]; then
echo "Error: RPC chain ID $CHAIN_ID does not match expected chain ID $EXPECTED_CHAIN_ID for network $NETWORK"
exit 1
fi
# Run this before deploying the OPCM.
pre-deploy: build build-contracts
# Run with:
# PRIVATE_KEY=0x1234.... NETWORK=sepolia just deploy-opcm 'op-contracts/v4.0.0-rc.8'
deploy-opcm release="dev" locator="$DEFAULT_LOCATOR": _validate_rpc
#!/bin/bash
echo "Using artifacts locator: {{locator}}"
./bin/op-deployer bootstrap implementations \
--l1-rpc-url $ETH_RPC_URL \
--private-key $PRIVATE_KEY \
--mips-version 7 \
--protocol-versions-proxy $PROTOCOL_VERSIONS_PROXY \
--superchain-config-proxy $SUPERCHAIN_CONFIG_PROXY \
--upgrade-controller $UPGRADE_CONTROLLER \
--l1-contracts-release {{release}} \
--superchain-proxy-admin $SUPERCHAIN_PROXY_ADMIN \
--challenger $CHALLENGER \
--outfile deploy-${NETWORK}.json
# Verifies the OPCM and the associated implementations contracts on Etherscan.
# This should be run after the OPCM is deployed, and requires the deploy-$NETWORK.json file.
verify-opcm locator="$DEFAULT_LOCATOR": _validate_rpc
#!/bin/bash
echo "Using artifacts locator: {{locator}}"
./bin/op-deployer verify \
--artifacts-locator {{locator}} \
--l1-rpc-url $ETH_RPC_URL \
--etherscan-api-key $ETHERSCAN_API_KEY \
--input-file deploy-${NETWORK}.json