Skip to content

Commit 300516f

Browse files
committed
Fixed script that use the contracts script
1 parent 1066e04 commit 300516f

File tree

4 files changed

+31
-26
lines changed

4 files changed

+31
-26
lines changed

script/DeployEthereumSpokePool.s.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ contract DeployEthereumSpokePool is Script, Test, Constants, DeploymentUtils {
3333
// Prepare constructor arguments for Ethereum_SpokePool
3434
bytes memory constructorArgs = abi.encode(
3535
address(weth), // _weth
36-
QUOTE_TIME_BUFFER, // _quoteTimeBuffer
37-
FILL_DEADLINE_BUFFER // _fillDeadlineBuffer
36+
QUOTE_TIME_BUFFER(), // _quoteTimeBuffer
37+
FILL_DEADLINE_BUFFER() // _fillDeadlineBuffer
3838
);
3939

4040
// Initialize deposit counter to very high number of deposits to avoid duplicate deposit ID's

script/DeployHubPool.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ contract DeployHubPool is Script, Test, Constants {
3535
LpTokenFactory lpTokenFactory = new LpTokenFactory();
3636

3737
// Deploy HubPool with the LpTokenFactory address
38-
HubPool hubPool = new HubPool(lpTokenFactory, finder, weth, ZERO_ADDRESS);
38+
HubPool hubPool = new HubPool(lpTokenFactory, finder, weth, ZERO_ADDRESS());
3939

4040
// Log the deployed addresses
4141
console.log("Chain ID:", chainId);

script/DeployedAddresses.sol

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ contract DeployedAddresses is Test {
1515
using stdJson for string;
1616

1717
// Path to the JSON file containing deployed addresses
18-
string private constant JSON_PATH = "../broadcast/deployed-addresses.json";
18+
string private constant JSON_PATH = "./broadcast/deployed-addresses.json";
1919

2020
/**
2121
* @notice Get contract address by chain ID and contract name
@@ -32,6 +32,11 @@ contract DeployedAddresses is Test {
3232
contractName,
3333
'"].address'
3434
);
35+
36+
if (!vm.keyExists(jsonData, path)) {
37+
return address(0);
38+
}
39+
3540
return jsonData.readAddress(path);
3641
}
3742

@@ -99,8 +104,8 @@ contract DeployedAddresses is Test {
99104
*/
100105
function getContractNames(uint256 chainId) public view returns (string[] memory) {
101106
string memory jsonData = vm.readFile(JSON_PATH);
102-
string memory path = string.concat('.chains["', vm.toString(chainId), '"].contracts | keys');
103-
return jsonData.readStringArray(path);
107+
string memory path = string.concat('.chains["', vm.toString(chainId), '"].contracts');
108+
return vm.parseJsonKeys(jsonData, path);
104109
}
105110

106111
/**
@@ -109,7 +114,7 @@ contract DeployedAddresses is Test {
109114
*/
110115
function getChainIds() public view returns (uint256[] memory) {
111116
string memory jsonData = vm.readFile(JSON_PATH);
112-
string[] memory chainIdStrings = jsonData.readStringArray(".chains | keys");
117+
string[] memory chainIdStrings = vm.parseJsonKeys(jsonData, ".chains");
113118
uint256[] memory chainIds = new uint256[](chainIdStrings.length);
114119
for (uint256 i = 0; i < chainIdStrings.length; i++) {
115120
chainIds[i] = vm.parseUint(chainIdStrings[i]);

script/DeploymentUtils.sol

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ contract DeploymentUtils is Script, Test, Constants, DeployedAddresses {
4141

4242
// Determine hub chain ID based on spoke chain ID
4343
uint256 hubChainId;
44-
if (spokeChainId == MAINNET) {
45-
hubChainId = MAINNET;
46-
} else if (spokeChainId == SEPOLIA) {
47-
hubChainId = SEPOLIA;
44+
if (spokeChainId == MAINNET()) {
45+
hubChainId = MAINNET();
46+
} else if (spokeChainId == SEPOLIA()) {
47+
hubChainId = SEPOLIA();
4848
} else {
4949
// For L2 chains, hub is typically mainnet or sepolia
50-
hubChainId = isTestnet(spokeChainId) ? SEPOLIA : MAINNET;
50+
hubChainId = isTestnet(spokeChainId) ? SEPOLIA() : MAINNET();
5151
}
5252

5353
// If hubPoolAddress is not provided, try to get it from environment
@@ -173,20 +173,20 @@ contract DeploymentUtils is Script, Test, Constants, DeployedAddresses {
173173
* @param chainId Chain ID to check
174174
* @return bool True if testnet
175175
*/
176-
function isTestnet(uint256 chainId) internal pure returns (bool) {
176+
function isTestnet(uint256 chainId) internal view returns (bool) {
177177
return
178-
chainId == SEPOLIA ||
179-
chainId == ARBITRUM_SEPOLIA ||
180-
chainId == OPTIMISM_SEPOLIA ||
181-
chainId == BASE_SEPOLIA ||
182-
chainId == POLYGON_AMOY ||
183-
chainId == LENS_TESTNET ||
184-
chainId == LINEA_SEPOLIA ||
185-
chainId == SCROLL_SEPOLIA ||
186-
chainId == UNICHAIN_SEPOLIA ||
187-
chainId == BLAST_SEPOLIA ||
188-
chainId == INK_SEPOLIA ||
189-
chainId == LISK_SEPOLIA ||
190-
chainId == MODE_SEPOLIA;
178+
chainId == SEPOLIA() ||
179+
chainId == ARBITRUM_SEPOLIA() ||
180+
chainId == OPTIMISM_SEPOLIA() ||
181+
chainId == BASE_SEPOLIA() ||
182+
chainId == POLYGON_AMOY() ||
183+
chainId == LENS_TESTNET() ||
184+
chainId == LINEA_SEPOLIA() ||
185+
chainId == SCROLL_SEPOLIA() ||
186+
chainId == UNICHAIN_SEPOLIA() ||
187+
chainId == BLAST_SEPOLIA() ||
188+
chainId == INK_SEPOLIA() ||
189+
chainId == LISK_SEPOLIA() ||
190+
chainId == MODE_SEPOLIA();
191191
}
192192
}

0 commit comments

Comments
 (0)