Skip to content

Commit 8baa95f

Browse files
committed
feat: update claim_contract README and Makefile
1 parent f5aed29 commit 8baa95f

4 files changed

Lines changed: 205 additions & 123 deletions

File tree

claim_contracts/Makefile

Lines changed: 71 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
1-
.PHONY: help deploy-aligned-token-implementation deploy-aligned-token-proxy deploy-claimable-airdrop-implementation deploy-claimable-airdrop-proxy upgrade-aligned-token-implementation aligned-token-proxy-deploy-data aligned-token-init-data aligned-token-upgrade-data aligned-token-create2 aligned-token-proxy-create2
2-
1+
.PHONY: help \
2+
calldata-update-merkle-root calldata-update-limit-timestamp calldata-approve-spending calldata-unpause calldata-pause \
3+
deploy-token deploy-token-sepolia deploy-token-mainnet \
4+
deploy-claimable-local deploy-claimable-sepolia deploy-claimable-base-sepolia deploy-claimable-mainnet \
5+
update_token_proxy upgrade-token enable-claimability \
6+
approve-claimable claimable-update-root claimable-get-root claimable-update-timestamp claimable-get-timestamp claimable-pause claimable-unpause \
7+
upgrade-aligned-token-implementation \
8+
test-token test-claim test-claimed test-airdrop \
9+
deploy-example
10+
11+
12+
# ============================================================================
13+
# Configuration — override any of these on the command line, e.g.
14+
# make deploy-claimable-sepolia DEPLOYER_PRIVATE_KEY=0x... ETHERSCAN_API_KEY=...
15+
# (ETHERSCAN_API_KEY, KEYSTORE_PATH, MERKLE_ROOT, TIMESTAMP, CLAIM_PROXY_ADDRESS,
16+
# LIMIT_TIMESTAMP, etc. have no default and are passed in per invocation.)
17+
# ============================================================================
18+
19+
# RPC endpoints (per network)
20+
RPC_URL ?= http://localhost:8545
21+
SEPOLIA_RPC_URL ?= https://ethereum-sepolia-rpc.publicnode.com
22+
BASE_SEPOLIA_RPC_URL ?= https://sepolia.base.org
23+
MAINNET_RPC_URL ?= https://ethereum-rpc.publicnode.com
24+
25+
# Signing keys (anvil defaults, for local use)
26+
DEPLOYER_PRIVATE_KEY ?= 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
27+
DISTRIBUTOR_PRIVATE_KEY ?= 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
28+
OWNER_PRIVATE_KEY ?= 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
29+
30+
# Deploy config + contract addresses (anvil defaults)
31+
CONFIG ?= example
32+
AIRDROP ?= 0xBC9129Dc0487fc2E169941C75aABC539f208fb01
33+
TOKEN ?= 0x2E983A1Ba5e8b38AAAeC4B440B9dDcFBf72E15d1
34+
APPROVE_AMOUNT ?= 2600000000000000000000000000
35+
36+
# Test inputs — require the proof API running on localhost:4000
37+
AMOUNT_TO_CLAIM = $(shell curl -S -H "Content-Type: application/json" http://localhost:4000/api/proof/\$(CLAIMER) | jq -r .amount)
38+
MERKLE_PROOF_TO_CLAIM = $(shell curl -S -H "Content-Type: application/json" http://localhost:4000/api/proof/\$(CLAIMER) | jq .proof | tr -d '"\n ')
339

440
help: ## 📚 Show help for each of the Makefile recipes
541
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@@ -23,36 +59,32 @@ calldata-pause: ## 💾 Calldata for the method `pause` to use in a transaction
2359

2460
# Deployments
2561

26-
RPC_URL?=http://localhost:8545
27-
DEPLOYER_PRIVATE_KEY?=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
28-
CONFIG?=example
2962
deploy-token: ## 🚀 Deploy the token contract
3063
cd script && \
3164
forge script DeployAlignedToken.s.sol \
3265
--sig "run(string)" \
3366
$(CONFIG) \
3467
--private-key $(DEPLOYER_PRIVATE_KEY) \
3568
--rpc-url $(RPC_URL) \
36-
--broadcast \
37-
--verbosity 3
69+
--broadcast
3870

39-
deploy-token-testnet: ## 🚀 Deploy the token contract
71+
deploy-token-sepolia: ## 🚀 Deploy the token contract in Sepolia
4072
cd script && \
4173
forge script DeployAlignedToken.s.sol \
4274
--sig "run(string)" sepolia \
4375
--private-key $(DEPLOYER_PRIVATE_KEY) \
44-
--rpc-url $(RPC_URL) \
76+
--rpc-url $(SEPOLIA_RPC_URL) \
4577
--broadcast \
4678
--verify \
4779
--etherscan-api-key $(ETHERSCAN_API_KEY)
4880

49-
deploy-token-prod: ## 🚀 Deploy the token contract
81+
deploy-token-mainnet: ## 🚀 Deploy the token contract in Mainnet
5082
cd script && \
5183
forge script DeployAlignedToken.s.sol \
5284
--sig "run(string)" \
53-
$(PROD_CONFIG) \
85+
mainnet \
5486
--keystore $(KEYSTORE_PATH) \
55-
--rpc-url $(PROD_RPC_URL) \
87+
--rpc-url $(MAINNET_RPC_URL) \
5688
--broadcast \
5789
--verbosity 3
5890

@@ -64,12 +96,22 @@ deploy-claimable-local: ## 🚀 Deploy the airdrop contract in localnet
6496
--rpc-url http://localhost:8545 \
6597
--broadcast
6698

67-
deploy-claimable-testnet: ## 🚀 Deploy the airdrop contract in Sepolia
99+
deploy-claimable-sepolia: ## 🚀 Deploy the airdrop contract in Sepolia
68100
cd script && \
69101
forge script DeployClaimableAirdrop.s.sol \
70102
--sig "run(string)" sepolia \
71103
--private-key $(DEPLOYER_PRIVATE_KEY) \
72-
--rpc-url $(RPC_URL) \
104+
--rpc-url $(SEPOLIA_RPC_URL) \
105+
--broadcast \
106+
--verify \
107+
--etherscan-api-key $(ETHERSCAN_API_KEY)
108+
109+
deploy-claimable-base-sepolia: ## 🚀 Deploy the airdrop contract in Base Sepolia
110+
cd script && \
111+
forge script DeployClaimableAirdrop.s.sol \
112+
--sig "run(string)" base-sepolia \
113+
--private-key $(DEPLOYER_PRIVATE_KEY) \
114+
--rpc-url $(BASE_SEPOLIA_RPC_URL) \
73115
--broadcast \
74116
--verify \
75117
--etherscan-api-key $(ETHERSCAN_API_KEY)
@@ -79,40 +121,41 @@ deploy-claimable-mainnet: ## 🚀 Deploy the airdrop contract in Mainnet
79121
forge script DeployClaimableAirdrop.s.sol \
80122
--sig "run(string)" mainnet \
81123
--keystore $(KEYSTORE_PATH) \
82-
--rpc-url https://eth.llamarpc.com \
124+
--rpc-url $(MAINNET_RPC_URL) \
83125
--broadcast \
84126
--verify \
85127
--etherscan-api-key $(ETHERSCAN_API_KEY)
86128

87129

130+
# TODO: broken — reads script-out/deployed_token_addresses.json (never generated by the deploy
131+
# scripts) and treats $(CONFIG) as a file path. Fix or remove.
88132
update_token_proxy:
89133
@NEW_TOKEN_PROXY=$$(jq -r '.tokenProxy' "script-out/deployed_token_addresses.json") && \
90134
jq --arg new_proxy "$$NEW_TOKEN_PROXY" '.tokenProxy = $$new_proxy' $(CONFIG) > $(CONFIG).tmp \
91135
&& mv $(CONFIG).tmp $(CONFIG)
92136

137+
# TODO: broken — runs UpgradeToken.s.sol, which does not exist in script/. Fix or remove
138+
# (see the README "Upgrades" section, which expects the upgrade script to be written ad-hoc).
93139
upgrade-token: ## 🚀 Upgrade the token contract
94140
cd script && \
95141
forge script UpgradeToken.s.sol \
96142
--sig "run(string)" \
97143
$(CONFIG) \
98-
--private-key $(PRIVATE_KEY) \
144+
--private-key $(DEPLOYER_PRIVATE_KEY) \
99145
--rpc-url $(RPC_URL) \
100146
--broadcast \
101147
--verbosity 3
102148

103149
# Miscellaneous
104150

105-
DISTRIBUTOR_PRIVATE_KEY?=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
106-
OWNER_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
107-
AIRDROP=0xBC9129Dc0487fc2E169941C75aABC539f208fb01
108-
TOKEN=0x2E983A1Ba5e8b38AAAeC4B440B9dDcFBf72E15d1
151+
enable-claimability: claimable-update-root claimable-update-timestamp approve-claimable claimable-unpause ## 🚀 Run every tx needed to start claiming (set root, set deadline, approve, unpause)
109152

110153
approve-claimable: ## 🚀 Approve the ClaimableAirdrop contract to spend the token
111154
cast send \
112155
--rpc-url $(RPC_URL) \
113156
--private-key $(DISTRIBUTOR_PRIVATE_KEY) \
114157
$(TOKEN) \
115-
'approve(address,uint256)' $(AIRDROP) 2600000000000000000000000000
158+
'approve(address,uint256)' $(AIRDROP) $(APPROVE_AMOUNT)
116159

117160
claimable-update-root: ## 🚀 Update the merkle root of the ClaimableAirdrop contract
118161
cast send \
@@ -154,13 +197,15 @@ claimable-unpause:
154197

155198
# Upgrades
156199

200+
# TODO: broken — script/aligned_token/UpgradeAlignedTokenImplementation.s.sol doesn't exist and
201+
# --sig has a stray leading "function". Fix or remove.
157202
upgrade-aligned-token-implementation: ## 🚀 Upgrade the AlignedToken implementation contract
158203
cd script/aligned_token && \
159204
forge script UpgradeAlignedTokenImplementation.s.sol \
160205
--sig "function run(address,address,uint256,address,address,address,address,uint256)" \
161206
$(PROXY) $(IMPLEMENTATION) $(VERSION) $(OWNER) $(BENEFICIARY1) $(BENEFICIARY2) $(BENEFICIARY3) $(MINT)\
162207
--rpc-url $(RPC_URL) \
163-
--private-key $(PRIVATE_KEY) \
208+
--private-key $(DEPLOYER_PRIVATE_KEY) \
164209
--broadcast
165210

166211
# Test targets
@@ -170,21 +215,19 @@ test-token:
170215
cast call $(ADDRESS) "symbol()(string)" --rpc-url $(RPC_URL)
171216
cast call $(ADDRESS) "totalSupply()(uint256)" --rpc-url $(RPC_URL)
172217

173-
# The following target needs the proof API running on localhost:4000
174-
AMOUNT_TO_CLAIM=$(shell curl -S -H "Content-Type: application/json" http://localhost:4000/api/proof/\$(CLAIMER) | jq -r .amount)
175-
MERKLE_PROOF_TO_CLAIM=$(shell curl -S -H "Content-Type: application/json" http://localhost:4000/api/proof/\$(CLAIMER) | jq .proof | tr -d '"\n ')
218+
# TODO: outdated — claim is now claim(uint256 amount,uint256 validFrom,bytes32[] proof) and the
219+
# proof comes from the web app's /api/wallets/<address>, not /api/proof/<claimer>. Fix.
176220
test-claim:
177221
cast send $(AIRDROP) --private-key $(CLAIMER_PRIVATE_KEY) "claim(uint256,bytes32[])" $(AMOUNT_TO_CLAIM) "$(MERKLE_PROOF_TO_CLAIM)" --rpc-url $(RPC_URL)
178222

223+
# TODO: outdated — hasClaimed is now hasClaimed(bytes32 leaf), not hasClaimed(address). Fix.
179224
test-claimed:
180225
cast call $(AIRDROP) "hasClaimed(address)(bool)" $(CLAIMER) --rpc-url $(RPC_URL)
181226
cast balance --erc20 $(TOKEN) $(CLAIMER) --rpc-url $(RPC_URL)
182227

183-
OWNER_PRIVATE_KEY?=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
184-
185228
test-airdrop:
186229
cast call $(AIRDROP) "paused()(bool)" --rpc-url $(RPC_URL)
187230
cast call $(AIRDROP) "owner()(address)" --rpc-url $(RPC_URL)
188231

189232
# Requires MERKLE_ROOT, TIMESTAMP
190-
deploy-example: deploy-token deploy-claimable-local claimable-update-root claimable-update-timestamp approve-claimable claimable-unpause
233+
deploy-example: deploy-token deploy-claimable-local enable-claimability

0 commit comments

Comments
 (0)