Skip to content

Commit d8f777e

Browse files
committed
More flexible parameterization
1 parent e0bccd3 commit d8f777e

File tree

3 files changed

+29
-21
lines changed

3 files changed

+29
-21
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
JSON_RPC_URL="https://eth-mainnet.g.alchemy.com/v2/<API-KEY>"
22
# JSON_RPC_URL="https://eth-sepolia.g.alchemy.com/v2/<API-KEY>"
3+
# JSON_RPC_URL="https://eth-holesky.g.alchemy.com/v2/<API-KEY>"
34
# JSON_RPC_URL="https://base-mainnet.g.alchemy.com/v2/<API-KEY>"
45
# JSON_RPC_URL="https://polygon-rpc.com/"
56
# JSON_RPC_URL="https://arb1.arbitrum.io/rpc"
67
# JSON_RPC_URL="https://mainnet.era.zksync.io"
8+
# JSON_RPC_URL="https://mainnet.mode.network"
9+
# JSON_RPC_URL="https://linea.drpc.org"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.env
22
digest
3-
data/*json
3+
cache/*json
44
deployments/all-*.json

Makefile

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
include .env
55

66
SHELL:=/bin/bash
7+
CACHE_PATH:=./cache
8+
OUTPUT_PATH:=./deployments
79

810
# Target dependent variables
911
deployment: export GENERATION_SCRIPT=generate-upgrade-deployment-config.ts
@@ -17,6 +19,8 @@ help: ## Display the current message
1719
@cat Makefile | while IFS= read -r line; do \
1820
if [[ "$$line" == "##" ]]; then \
1921
echo "" ; \
22+
elif [[ "$$line" =~ ^##\ (.*)$$ ]]; then \
23+
echo -e "$${BASH_REMATCH[1]}" ; \
2024
elif [[ "$$line" =~ ^([^:]+):(.*)##\ (.*)$$ ]]; then \
2125
echo -e "- make $${BASH_REMATCH[1]} \t$${BASH_REMATCH[3]}" ; \
2226
fi ; \
@@ -26,39 +30,39 @@ help: ## Display the current message
2630

2731
.PHONY: init
2832
init: .env ## Check the dependencies and prepare the environment
29-
@mkdir -p data deployments
33+
@mkdir -p $(CACHE_PATH) $(OUTPUT_PATH)
3034
@which docker > /dev/null || (echo "Error: Docker is not installed" ; exit 1)
3135
@which jq > /dev/null || (echo "Error: jq is not installed" ; exit 1)
3236
@which cast > /dev/null || (echo "Error: Foundry is not installed" ; exit 1)
3337
docker pull denoland/deno:alpine
3438

3539
.PHONY: clean
3640
clean: ## Clean the generated artifacts
37-
rm -Rf ./data/*
41+
rm -Rf $(CACHE_PATH)/*
3842

3943
##
4044

4145
# Entry points
4246

4347
.PHONY: deployment
44-
deployment: deployments/osx-$(network).json ## Generate the config to verify with diffyscan-workspace
48+
deployment: $(OUTPUT_PATH)/osx-$(network).json ## Generate the config to verify with diffyscan-workspace
4549

4650
.PHONY: deployment-zk
47-
deployment-zk: deployments/osx-$(network).json ## Generate the config to verify with diffyscan-workspace (only ZkSync)
51+
deployment-zk: $(OUTPUT_PATH)/osx-$(network).json ## Generate the config to verify with diffyscan-workspace (only ZkSync)
4852

4953
.PHONY: summary
50-
summary: data/upgrade-proposal-$(network)-$(address)-$(pid)-actions-decoded.json ## Show the decoded proposal upgrade actions
54+
summary: $(CACHE_PATH)/upgrade-proposal-$(network)-$(address)-$(pid)-actions-decoded.json ## Show the decoded proposal upgrade actions
5155
docker run --rm \
5256
-v ./scripts/summarize-upgrade-proposal.ts:/root/script.ts:ro \
5357
-v ./scripts/lib.ts:/root/lib.ts:ro \
54-
-v ./$<:/root/data.json:ro \
58+
-v ./$<:/root/input.json:ro \
5559
denoland/deno:alpine \
56-
deno run --allow-read /root/script.ts /root/data.json
60+
deno run --allow-read /root/script.ts /root/input.json
5761

5862
# Internal targets
5963

6064
# Deployment config <= Decoded proposal actions
61-
deployments/osx-$(network).json: data/upgrade-proposal-$(network)-$(address)-$(pid)-actions-decoded.json
65+
$(OUTPUT_PATH)/osx-$(network).json: $(CACHE_PATH)/upgrade-proposal-$(network)-$(address)-$(pid)-actions-decoded.json
6266
@echo "Generating the deployment config file"
6367
docker run --rm \
6468
-v ./scripts/$(GENERATION_SCRIPT):/root/script.ts:ro \
@@ -67,37 +71,38 @@ deployments/osx-$(network).json: data/upgrade-proposal-$(network)-$(address)-$(p
6771
-v ./scripts/template-token-voting.json:/root/template-token-voting.json:ro \
6872
-v ./scripts/template-multisig.json:/root/template-multisig.json:ro \
6973
-v ./scripts/template-admin.json:/root/template-admin.json:ro \
70-
-v ./$<:/root/data.json:ro \
74+
-v ./$<:/root/input.json:ro \
7175
-w /root \
7276
denoland/deno:alpine \
73-
deno run --allow-read /root/script.ts /root/data.json $(network) > ./deployments/all-$(network).json
77+
deno run --allow-read /root/script.ts /root/input.json $(network) > $(OUTPUT_PATH)/all-$(network).json
7478

75-
jq ".osx" ./deployments/all-$(network).json > $(@)
76-
jq ".tokenVoting" ./deployments/all-$(network).json > deployments/token-voting-$(network).json
77-
jq ".multisig" ./deployments/all-$(network).json > deployments/multisig-$(network).json
78-
jq ".admin" ./deployments/all-$(network).json > deployments/admin-$(network).json
79+
@echo "Generating the config files:"
80+
jq ".osx" $(OUTPUT_PATH)/all-$(network).json > $(@)
81+
jq ".tokenVoting" $(OUTPUT_PATH)/all-$(network).json > $(OUTPUT_PATH)/token-voting-$(network).json
82+
jq ".multisig" $(OUTPUT_PATH)/all-$(network).json > $(OUTPUT_PATH)/multisig-$(network).json
83+
jq ".admin" $(OUTPUT_PATH)/all-$(network).json > $(OUTPUT_PATH)/admin-$(network).json
7984

80-
rm ./deployments/all-$(network).json
85+
rm $(OUTPUT_PATH)/all-$(network).json
8186

8287
# Decoded proposal actions <= Proposal raw actions
83-
data/upgrade-proposal-$(network)-$(address)-$(pid)-actions-decoded.json: data/upgrade-proposal-$(network)-$(address)-$(pid)-actions.json
88+
$(CACHE_PATH)/upgrade-proposal-$(network)-$(address)-$(pid)-actions-decoded.json: $(CACHE_PATH)/upgrade-proposal-$(network)-$(address)-$(pid)-actions.json
8489
@echo "Decoding action parameters"
8590
jq -r '.[] | "cast 4byte-decode \(.data)"' $< | while read cmd; do \
8691
data=$$(eval "$$cmd") ; \
8792
jq -n --arg data "$$data" '{"decoded": $$ARGS.named.data}' ; \
8893
done | jq -s '.' > $(@)
8994

9095
# Proposal raw actions <= Proposal raw data
91-
data/upgrade-proposal-$(network)-$(address)-$(pid)-actions.json: data/upgrade-proposal-$(network)-$(address)-$(pid)-raw.json
96+
$(CACHE_PATH)/upgrade-proposal-$(network)-$(address)-$(pid)-actions.json: $(CACHE_PATH)/upgrade-proposal-$(network)-$(address)-$(pid)-raw.json
9297
@echo "Parsing proposal actions"
9398
docker run --rm \
9499
-v ./scripts/parse-upgrade-proposal-actions.ts:/root/script.ts:ro \
95-
-v ./$<:/root/data.json:ro \
100+
-v ./$<:/root/input.json:ro \
96101
denoland/deno:alpine \
97-
deno run --allow-read /root/script.ts /root/data.json > $(@)
102+
deno run --allow-read /root/script.ts /root/input.json > $(@)
98103

99104
# Fetch proposal data
100-
data/upgrade-proposal-$(network)-$(address)-$(pid)-raw.json:
105+
$(CACHE_PATH)/upgrade-proposal-$(network)-$(address)-$(pid)-raw.json:
101106
@if [ -z "$(address)" ]; then echo "Please, append 'address=<plugin-address>'"; exit 1 ; fi
102107
@if [ -z "$(pid)" ]; then echo "Please, append 'pid=<proposal-id>'"; exit 1 ; fi
103108
@if [ -z "$(network)" ]; then echo "Please, append 'network=<name>'"; exit 1 ; fi

0 commit comments

Comments
 (0)