File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ abstract contract DifferentialBase is Test {
4949 uint256 pinBlock ,
5050 uint256 btcBlockTime
5151 ) internal {
52- string memory rpcUrl = vm. rpcUrl (networkKey);
52+ string memory rpcUrl = _resolveRpcUrl (networkKey);
5353 harness.forkId = _createForkSafe (rpcUrl, pinBlock);
5454
5555 vm.selectFork (harness.forkId);
@@ -128,6 +128,27 @@ abstract contract DifferentialBase is Test {
128128 return vm.parseJsonAddress (addressesJson, key);
129129 }
130130
131+ function _resolveRpcUrl (
132+ string memory networkKey
133+ ) internal view returns (string memory ) {
134+ bytes32 networkHash = keccak256 (bytes (networkKey));
135+ if (networkHash == keccak256 (bytes ("rskMainnet " ))) {
136+ return
137+ vm.envOr (
138+ "MAINNET_RPC_URL " ,
139+ string ("https://public-node.rsk.co " )
140+ );
141+ }
142+ if (networkHash == keccak256 (bytes ("rskTestnet " ))) {
143+ return
144+ vm.envOr (
145+ "TESTNET_RPC_URL " ,
146+ string ("https://public-node.testnet.rsk.co " )
147+ );
148+ }
149+ revert ("Unsupported differential network key " );
150+ }
151+
131152 function _assertReferenceCompatibility (
132153 address referenceTarget
133154 ) internal view {
You can’t perform that action at this time.
0 commit comments