Skip to content

Commit 329dc6d

Browse files
committed
add makefile target
1 parent 471d0bf commit 329dc6d

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

claim_contracts/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ deploy-token: ## 🚀 Deploy the token contract
3030
--broadcast \
3131
--verbosity 3
3232

33+
34+
update_token_proxy:
35+
@NEW_TOKEN_PROXY=$$(jq -r '.tokenProxy' "script-out/deployed_contracts.json") && \
36+
jq --arg new_proxy "$$NEW_TOKEN_PROXY" '.tokenProxy = $$new_proxy' $(CONFIG) > $(CONFIG).tmp \
37+
&& mv $(CONFIG).tmp $(CONFIG) \
38+
3339
upgrade-token: ## 🚀 Upgrade the token contract
3440
cd script && \
3541
forge script UpgradeToken.s.sol \

claim_contracts/script/DeployAlignedToken.s.sol

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,46 @@ contract DeployAlignedToken is Script {
4747
vm.toString(_safe)
4848
)
4949
);
50+
51+
string memory deployedAddressesJson = "deployedAddressesJson";
52+
53+
string memory tokenProxyKey = "tokenProxy";
54+
vm.serializeAddress(
55+
deployedAddressesJson,
56+
tokenProxyKey,
57+
address(_tokenProxy)
58+
);
59+
string memory proxyAdminKey = "proxyAdmin";
60+
vm.serializeAddress(
61+
deployedAddressesJson,
62+
proxyAdminKey,
63+
Utils.getAdminAddress(address(_tokenProxy))
64+
);
65+
string memory safeKey = "safe";
66+
vm.serializeAddress(
67+
deployedAddressesJson,
68+
safeKey,
69+
address(_safe)
70+
);
71+
72+
// serialize all the data
73+
string memory finalJson =
74+
vm.serializeString(deployedAddressesJson, "aligned", "deployed contracts");
75+
76+
vm.writeJson(finalJson, _getOutputPath("deployed_contracts.json"));
77+
}
78+
79+
function _getOutputPath(
80+
string memory fileName
81+
) internal returns (string memory) {
82+
string memory outputDir = "script-out/";
83+
84+
// Create output directory if it doesn't exist
85+
if (!vm.exists(outputDir)) {
86+
vm.createDir(outputDir, true);
87+
}
88+
89+
return string.concat(outputDir, fileName);
5090
}
5191

5292
function deployAlignedTokenProxy(

0 commit comments

Comments
 (0)