Skip to content

Commit

Permalink
✅ added new bootstrap with current block forking
Browse files Browse the repository at this point in the history
  • Loading branch information
moss-eth committed Oct 31, 2024
1 parent 6fb649c commit b84c784
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions test/Swap.from.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity 0.8.27;

import {
Bootstrap,
Constants,
IERC20,
IPerpsMarket,
Expand All @@ -11,8 +10,9 @@ import {
Test,
Zap
} from "./utils/Bootstrap.sol";
import {BootstrapWithCurrentBlock} from "./utils/BootstrapWithCurrentBlock.sol";

contract SwapFromTest is Bootstrap {
contract SwapFromTest is BootstrapWithCurrentBlock {

bytes swapPath;
string pathId;
Expand Down
10 changes: 5 additions & 5 deletions test/utils/Bootstrap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {Constants} from "../utils/Constants.sol";
import {stdJson} from "forge-std/StdJson.sol";
import {Test} from "forge-std/Test.sol";
import {Surl} from "surl/src/Surl.sol";

contract Bootstrap is
Test,
Deploy,
Expand Down Expand Up @@ -45,15 +44,16 @@ contract Bootstrap is

string[] headers;

function setUp() public {
function setUp() public virtual {
string memory BASE_RPC = vm.envString(BASE_RPC_REF);
string memory ARBITRUM_RPC = vm.envString(ARBITRUM_RPC_REF);
string memory ARBITRUM_SEPOLIA_RPC =
vm.envString(ARBITRUM_SEPOLIA_RPC_REF);

BASE = vm.createFork(BASE_RPC);
ARBITRUM = vm.createFork(ARBITRUM_RPC);
ARBITRUM_SEPOLIA = vm.createFork(ARBITRUM_SEPOLIA_RPC);
BASE = vm.createFork(BASE_RPC, BASE_FORK_BLOCK);
ARBITRUM = vm.createFork(ARBITRUM_RPC, ARBITRUM_FORK_BLOCK);
ARBITRUM_SEPOLIA =
vm.createFork(ARBITRUM_SEPOLIA_RPC, ARBITRUM_SEPOLIA_FORK_BLOCK);

headers.push("Content-Type: application/json");
}
Expand Down
22 changes: 22 additions & 0 deletions test/utils/BootstrapWithCurrentBlock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.27;

import {Bootstrap} from "./Bootstrap.sol";
import "forge-std/console2.sol";

contract BootstrapWithCurrentBlock is Bootstrap {

function setUp() public override {
string memory BASE_RPC = vm.envString(BASE_RPC_REF);
string memory ARBITRUM_RPC = vm.envString(ARBITRUM_RPC_REF);
string memory ARBITRUM_SEPOLIA_RPC =
vm.envString(ARBITRUM_SEPOLIA_RPC_REF);

BASE = vm.createFork(BASE_RPC);
ARBITRUM = vm.createFork(ARBITRUM_RPC);
ARBITRUM_SEPOLIA = vm.createFork(ARBITRUM_SEPOLIA_RPC);

headers.push("Content-Type: application/json");
}

}
4 changes: 4 additions & 0 deletions test/utils/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ contract Constants {
string constant ARBITRUM_RPC_REF = "ARBITRUM_RPC";
string constant ARBITRUM_SEPOLIA_RPC_REF = "ARBITRUM_SEPOLIA_RPC";

uint256 constant BASE_FORK_BLOCK = 20_165_000;
uint256 constant ARBITRUM_FORK_BLOCK = 256_615_000;
uint256 constant ARBITRUM_SEPOLIA_FORK_BLOCK = 85_443_000;

uint256 constant BASE_CHAIN_ID = 8453;
uint256 constant ARBITRUM_CHAIN_ID = 42_161;

Expand Down

0 comments on commit b84c784

Please sign in to comment.