Skip to content

Commit 94b1392

Browse files
authored
feat: add bob network (#75)
* feat: add bob network * fix: fixed test
1 parent 627712a commit 94b1392

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

foundry.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ zkEVM = "${RPC_ZKEVM}"
6060
zksync = "${RPC_ZKSYNC}"
6161
linea = "${RPC_LINEA}"
6262
soneium = "${RPC_SONEIUM}"
63+
bob = "${RPC_BOB}"
6364

6465
[fuzz]
6566
no_zksync_reserved_addresses = true

src/contracts/utils/ChainHelpers.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ library ChainIds {
2626
uint256 internal constant MANTLE = 5000;
2727
uint256 internal constant INK = 57073;
2828
uint256 internal constant SONEIUM = 1868;
29+
uint256 internal constant BOB = 60808;
2930
}
3031

3132
library TestNetChainIds {
@@ -47,6 +48,7 @@ library TestNetChainIds {
4748
uint256 internal constant SONIC_BLAZE = 57054;
4849
uint256 internal constant MANTLE_SEPOLIA = 5003;
4950
uint256 internal constant SONEIUM_MINATO = 1946;
51+
uint256 internal constant BOB_SEPOLIA = 808813;
5052
}
5153

5254
library ChainHelpers {
@@ -100,6 +102,8 @@ library ChainHelpers {
100102
newFork = vm.createSelectFork(vm.rpcUrl('ink'));
101103
} else if (chainId == ChainIds.SONEIUM) {
102104
newFork = vm.createSelectFork(vm.rpcUrl('soneium'));
105+
} else if (chainId == ChainIds.BOB) {
106+
newFork = vm.createSelectFork(vm.rpcUrl('bob'));
103107
} else {
104108
revert UnknownChainId();
105109
}
@@ -144,6 +148,8 @@ library ChainHelpers {
144148
networkName = 'ink';
145149
} else if (chainId == ChainIds.SONEIUM) {
146150
networkName = 'soneium';
151+
} else if (chainId == ChainIds.BOB) {
152+
networkName = 'bob';
147153
}
148154
// testnets
149155
else if (chainId == TestNetChainIds.ETHEREUM_SEPOLIA) {
@@ -178,6 +184,8 @@ library ChainHelpers {
178184
networkName = 'mantle_sepolia';
179185
} else if (chainId == TestNetChainIds.SONEIUM_MINATO) {
180186
networkName = 'soneium_minato';
187+
} else if (chainId == TestNetChainIds.BOB_SEPOLIA) {
188+
networkName = 'bob_sepolia';
181189
} else {
182190
revert('chain id is not supported');
183191
}

src/contracts/utils/ScriptUtils.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ abstract contract SoneiumScript is WithChainIdValidation {
9595
constructor() WithChainIdValidation(ChainIds.SONEIUM) {}
9696
}
9797

98+
abstract contract BobScript is WithChainIdValidation {
99+
constructor() WithChainIdValidation(ChainIds.BOB) {}
100+
}
101+
98102
abstract contract MantleScript is WithChainIdValidation {
99103
constructor() WithChainIdValidation(ChainIds.MANTLE) {}
100104
}

test/ChainHelperTest.t.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ pragma solidity ^0.8.0;
44
import 'forge-std/Test.sol';
55
import {ChainHelpers} from '../src/contracts/utils/ChainHelpers.sol';
66

7+
/// forge-config: default.allow_internal_expect_revert = true
78
contract TestChainHelpers is Test {
89
function test_selectChain_shouldRevert() external {
9-
vm.expectRevert();
10+
vm.createSelectFork(vm.rpcUrl('optimism'));
11+
vm.expectRevert(ChainHelpers.UnknownChainId.selector);
1012
ChainHelpers.selectChain(vm, 0);
1113
}
1214
}

0 commit comments

Comments
 (0)