Skip to content

Commit 8c6e8df

Browse files
authored
add makefile target for updating token-proxy (#1628)
2 parents f3adf99 + 4c3e352 commit 8c6e8df

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
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_token_addresses.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: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,13 @@ import {Utils} from "./Utils.sol";
1212
contract DeployAlignedToken is Script {
1313
function run(string memory config) public {
1414
string memory root = vm.projectRoot();
15-
string memory path = string.concat(
16-
root,
17-
"/script-config/config.",
18-
config,
19-
".json"
20-
);
15+
string memory path = string.concat(root, "/script-config/config.", config, ".json");
2116
string memory config_json = vm.readFile(path);
2217

2318
bytes32 _salt = stdJson.readBytes32(config_json, ".salt");
2419
address _deployer = stdJson.readAddress(config_json, ".deployer");
2520
address _foundation = stdJson.readAddress(config_json, ".foundation");
26-
address _claimSupplier = stdJson.readAddress(
27-
config_json,
28-
".claimSupplier"
29-
);
21+
address _claimSupplier = stdJson.readAddress(config_json, ".claimSupplier");
3022

3123
TransparentUpgradeableProxy _tokenProxy = deployAlignedTokenProxy(
3224
_foundation,
@@ -46,6 +38,22 @@ contract DeployAlignedToken is Script {
4638
vm.toString(_foundation)
4739
)
4840
);
41+
42+
string memory deployedAddressesJson = "deployedAddressesJson";
43+
string memory finalJson = vm.serializeAddress(deployedAddressesJson, "tokenProxy", address(_tokenProxy));
44+
45+
vm.writeJson(finalJson, _getOutputPath("deployed_token_addresses.json"));
46+
}
47+
48+
function _getOutputPath(string memory fileName) internal returns (string memory) {
49+
string memory outputDir = "script-out/";
50+
51+
// Create output directory if it doesn't exist
52+
if (!vm.exists(outputDir)) {
53+
vm.createDir(outputDir, true);
54+
}
55+
56+
return string.concat(outputDir, fileName);
4957
}
5058

5159
function deployAlignedTokenProxy(

0 commit comments

Comments
 (0)