Skip to content

Commit c0b73a2

Browse files
committed
use deployedAddresses util
Signed-off-by: Taylor Webb <[email protected]>
1 parent d73d38b commit c0b73a2

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

script/tasks/UpdateVkey.s.sol

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity ^0.8.0;
44
import { Script } from "forge-std/Script.sol";
55
import { console } from "forge-std/console.sol";
66
import { Constants } from "../utils/Constants.sol";
7+
import { DeployedAddresses } from "../utils/DeployedAddresses.sol";
78

89
/**
910
* @title UpdateVkey
@@ -22,7 +23,7 @@ import { Constants } from "../utils/Constants.sol";
2223
* - newVkey: The new Helios program vkey (bytes32)
2324
* - chains: Comma-separated list of chain IDs (e.g., "56,143,999")
2425
*/
25-
contract UpdateVkey is Script, Constants {
26+
contract UpdateVkey is Script, Constants, DeployedAddresses {
2627
// Expected value for VKEY_UPDATER_ROLE to sanity check on-chain value
2728
bytes32 constant EXPECTED_VKEY_UPDATER_ROLE = 0x07ecc55c8d82c6f82ef86e34d1905e0f2873c085733fa96f8a6e0316b050d174;
2829

@@ -38,11 +39,8 @@ contract UpdateVkey is Script, Constants {
3839
// Parse chain IDs from argument
3940
uint256[] memory chainIds = parseChainIds(chainsStr);
4041

41-
// Read deployed addresses
42-
string memory deployedAddressesJson = vm.readFile("broadcast/deployed-addresses.json");
43-
4442
// Get HubPool address (from mainnet)
45-
address hubPoolAddress = getDeployedAddress(deployedAddressesJson, 1, "HubPool");
43+
address hubPoolAddress = getAddress(1, "HubPool");
4644
require(hubPoolAddress != address(0), "HubPool not found in deployed-addresses.json");
4745

4846
console.log("");
@@ -64,7 +62,7 @@ contract UpdateVkey is Script, Constants {
6462
uint256 chainId = chainIds[i];
6563

6664
// Get SpokePool address for this chain
67-
address spokePoolAddress = getDeployedAddress(deployedAddressesJson, chainId, "SpokePool");
65+
address spokePoolAddress = getAddress(chainId, "SpokePool");
6866
if (spokePoolAddress == address(0)) {
6967
console.log("Skipping chain %d: no SpokePool in deployed-addresses.json", chainId);
7068
failedChains[failedCount++] = chainId;
@@ -265,25 +263,6 @@ contract UpdateVkey is Script, Constants {
265263
return result;
266264
}
267265

268-
function getDeployedAddress(
269-
string memory json,
270-
uint256 chainId,
271-
string memory contractName
272-
) internal view returns (address) {
273-
string memory path = string.concat(
274-
".chains.",
275-
vm.toString(chainId),
276-
".contracts.",
277-
contractName,
278-
".address"
279-
);
280-
281-
try vm.parseJsonAddress(json, path) returns (address addr) {
282-
return addr;
283-
} catch {
284-
return address(0);
285-
}
286-
}
287266
}
288267

289268
// ============ Minimal Interfaces ============

0 commit comments

Comments
 (0)