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

fix: deploy l1 contracts script #3713

Merged
merged 6 commits into from
Dec 16, 2023
Merged
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
2 changes: 1 addition & 1 deletion l1-contracts/REDEPLOY
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Append value to force redeploy
4
5
51 changes: 40 additions & 11 deletions l1-contracts/scripts/ci_deploy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,48 @@ fi
# Login to pull our ecr images with docker.
ecr_login

# Contract addresses will be saved in the serve directory
mkdir -p serve
# Contract addresses will be mounted in the serve directory
FILE_PATH=./serve/contract_addresses.json
CLI_IMAGE=$(calculate_image_uri cli)
retry docker pull $CLI_IMAGE

# remove 0x prefix from private key
PRIVATE_KEY=${CONTRACT_PUBLISHER_PRIVATE_KEY#0x}
docker run \
-v $(pwd)/serve:/usr/src/l1-contracts/serve \
-e ETHEREUM_HOST=$ETHEREUM_HOST -e PRIVATE_KEY=$CONTRACT_PUBLISHER_PRIVATE_KEY \
"$ECR_URL/l1-contracts:cache-$CONTENT_HASH" \
./scripts/deploy_contracts.sh

# Write the contract addresses as terraform variables
for KEY in ROLLUP_CONTRACT_ADDRESS REGISTRY_CONTRACT_ADDRESS INBOX_CONTRACT_ADDRESS OUTBOX_CONTRACT_ADDRESS CONTRACT_DEPLOYMENT_EMITTER_ADDRESS; do
VALUE=$(jq -r .$KEY ./serve/contract_addresses.json)
export TF_VAR_$KEY=$VALUE
done
$CLI_IMAGE \
deploy-l1-contracts -u $ETHEREUM_HOST -p $PRIVATE_KEY >./serve/contract_addresses.json

## Result format is:
# Rollup Address: 0xe33d37702bb94e83ca09e7dc804c9f4c4ab8ee4a
# Registry Address: 0xf02a70628c4e0d7c41f231f9af24c1678a030438
# L1 -> L2 Inbox Address: 0xdf34a07c7da15630d3b5d6bb17651d548a6e9d8f
# L2 -> L1 Outbox address: 0xf6b1b3c2c393fe55fe577a1f528bd72a76589ab0
# Contract Deployment Emitter Address: 0xf3ecc6e9428482a74687ee5f7b96f4dff8781454

# Read the file line by line
while IFS= read -r line; do
# Extract the hexadecimal address using awk
address=$(echo "$line" | awk '{print $NF}')

# Assign the address to the respective variable based on the line content
if [[ $line == *"Rollup"* ]]; then
export TF_VAR_ROLLUP_CONTRACT_ADDRESS=$address
echo "TF_VAR_ROLLUP_CONTRACT_ADDRESS=$TF_VAR_ROLLUP_CONTRACT_ADDRESS"
elif [[ $line == *"Registry"* ]]; then
export TF_VAR_REGISTRY_CONTRACT_ADDRESS=$address
echo "TF_VAR_REGISTRY_CONTRACT_ADDRESS=$TF_VAR_REGISTRY_CONTRACT_ADDRESS"
elif [[ $line == *"Inbox"* ]]; then
export TF_VAR_INBOX_CONTRACT_ADDRESS=$address
echo "TF_VAR_INBOX_CONTRACT_ADDRESS=$TF_VAR_INBOX_CONTRACT_ADDRESS"
elif [[ $line == *"Outbox"* ]]; then
export TF_VAR_OUTBOX_CONTRACT_ADDRESS=$address
echo "TF_VAR_OUTBOX_CONTRACT_ADDRESS=$TF_VAR_OUTBOX_CONTRACT_ADDRESS"
elif [[ $line == *"Emitter"* ]]; then
export TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$address
echo "TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS=$TF_VAR_CONTRACT_DEPLOYMENT_EMITTER_ADDRESS"
fi
done <"$FILE_PATH"

if [ "$DRY_DEPLOY" -eq 1 ]; then
echo "DRY_DEPLOY: deploy_terraform l1-contracts ./terraform"
Expand Down
54 changes: 0 additions & 54 deletions l1-contracts/scripts/deploy_contracts.sh

This file was deleted.