@@ -3,6 +3,10 @@ pragma solidity >=0.8.22 <0.9.0;
33
44import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol " ;
55import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol " ;
6+ import { ILockupNFTDescriptor } from "src/interfaces/ILockupNFTDescriptor.sol " ;
7+ import { ISablierBatchLockup } from "src/interfaces/ISablierBatchLockup.sol " ;
8+ import { ISablierLockup } from "src/interfaces/ISablierLockup.sol " ;
9+
610import { Base_Test } from "./../Base.t.sol " ;
711
812/// @notice Common logic needed by all fork tests.
@@ -12,16 +16,15 @@ abstract contract Fork_Test is Base_Test {
1216 //////////////////////////////////////////////////////////////////////////*/
1317
1418 IERC20 internal immutable FORK_TOKEN;
15- address internal immutable FORK_TOKEN_HOLDER ;
19+ address internal forkTokenHolder ;
1620 uint256 internal initialHolderBalance;
1721
1822 /*//////////////////////////////////////////////////////////////////////////
1923 CONSTRUCTOR
2024 //////////////////////////////////////////////////////////////////////////*/
2125
22- constructor (IERC20 forkToken , address forkTokenHolder ) {
26+ constructor (IERC20 forkToken ) {
2327 FORK_TOKEN = forkToken;
24- FORK_TOKEN_HOLDER = forkTokenHolder;
2528 }
2629
2730 /*//////////////////////////////////////////////////////////////////////////
@@ -30,19 +33,24 @@ abstract contract Fork_Test is Base_Test {
3033
3134 function setUp () public virtual override {
3235 // Fork Ethereum Mainnet at a specific block number.
33- vm.createSelectFork ({ blockNumber: 20_428_723 , urlOrAlias: "mainnet " });
36+ vm.createSelectFork ({ blockNumber: 21_719_029 , urlOrAlias: "mainnet " });
37+
38+ // Load deployed addresses from Ethereum mainnet.
39+ batchLockup = ISablierBatchLockup (0x3F6E8a8Cffe377c4649aCeB01e6F20c60fAA356c );
40+ nftDescriptor = ILockupNFTDescriptor (0xA9dC6878C979B5cc1d98a1803F0664ad725A1f56 );
41+ lockup = ISablierLockup (0x7C01AA3783577E15fD7e272443D44B92d5b21056 );
3442
35- // The base is set up after the fork is selected so that the base test contracts are deployed on the fork .
36- Base_Test. setUp ( );
43+ // Create a custom user for this test suite .
44+ forkTokenHolder = payable ( makeAddr ( string . concat ( IERC20Metadata ( address (FORK_TOKEN)). symbol (), " _HOLDER " )) );
3745
38- // Label the contracts .
46+ // Label the addresses .
3947 labelContracts ();
4048
41- // Make the forked token holder the caller in this test suite.
42- resetPrank ({ msgSender: FORK_TOKEN_HOLDER });
49+ // Deal token balance to the user.
50+ initialHolderBalance = 1e7 * 10 ** IERC20Metadata (address (FORK_TOKEN)).decimals ();
51+ deal ({ token: address (FORK_TOKEN), to: forkTokenHolder, give: initialHolderBalance });
4352
44- // Query the initial balance of the forked token holder.
45- initialHolderBalance = FORK_TOKEN.balanceOf (FORK_TOKEN_HOLDER);
53+ resetPrank ({ msgSender: forkTokenHolder });
4654 }
4755
4856 /*//////////////////////////////////////////////////////////////////////////
@@ -56,7 +64,7 @@ abstract contract Fork_Test is Base_Test {
5664
5765 // The goal is to not have overlapping users because the forked token balance tests would fail otherwise.
5866 vm.assume (sender != recipient && sender != broker && recipient != broker);
59- vm.assume (sender != FORK_TOKEN_HOLDER && recipient != FORK_TOKEN_HOLDER && broker != FORK_TOKEN_HOLDER );
67+ vm.assume (sender != forkTokenHolder && recipient != forkTokenHolder && broker != forkTokenHolder );
6068 vm.assume (sender != lockupContract && recipient != lockupContract && broker != lockupContract);
6169
6270 // Avoid users blacklisted by USDC or USDT.
@@ -65,9 +73,9 @@ abstract contract Fork_Test is Base_Test {
6573 assumeNoBlacklisted (address (FORK_TOKEN), broker);
6674 }
6775
68- /// @dev Labels the most relevant contracts .
76+ /// @dev Labels the most relevant addresses .
6977 function labelContracts () internal {
7078 vm.label ({ account: address (FORK_TOKEN), newLabel: IERC20Metadata (address (FORK_TOKEN)).symbol () });
71- vm.label ({ account: FORK_TOKEN_HOLDER , newLabel: "FORK_TOKEN_HOLDER " });
79+ vm.label ({ account: forkTokenHolder , newLabel: "Fork Token Holder " });
7280 }
7381}
0 commit comments