Skip to content

Commit

Permalink
test: send parameters on test script
Browse files Browse the repository at this point in the history
  • Loading branch information
0xChin committed Nov 19, 2024
1 parent dc27501 commit e651277
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"lint:sol-logic": "solhint -c .solhint.json 'src/**/*.sol' 'script/**/*.sol'",
"lint:sol-tests": "solhint -c .solhint.tests.json 'test/**/*.sol'",
"prepare": "husky install",
"test": "forge test -vvv",
"test": "TESTING=true FORKED_NETWORK=mainnet FORK_BLOCK=18920905 forge test -vvv ",
"test:fuzz": "echidna test/invariants/fuzz/Greeter.t.sol --contract InvariantGreeter --corpus-dir test/invariants/fuzz/echidna_coverage/ --test-mode assertion",
"test:integration": "forge test --match-contract Integration -vvv",
"test:symbolic": "halmos",
Expand Down
9 changes: 6 additions & 3 deletions script/Deploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ contract Deploy is Script {
function run() public {
DeploymentParams memory _params = getDeploymentParams(block.chainid);

/* vm.startBroadcast(); */

if (!vm.envBool("TESTING")) {
vm.startBroadcast();
}
// Deploy Grateful contract
grateful = new Grateful(_params.tokens, _params.aavePool, _params.initialFee);

Expand Down Expand Up @@ -154,6 +155,8 @@ contract Deploy is Script {
// Add TestToken to Grateful (if needed)
/* grateful.addToken(address(_testToken)); */

/* vm.stopBroadcast(); */
if (!vm.envBool("TESTING")) {
vm.stopBroadcast();
}
}
}
7 changes: 4 additions & 3 deletions test/integration/IntegrationBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ contract IntegrationBase is Test, Deploy {
CONSTANTS
//////////////////////////////////////////////////////////////*/

string internal constant _FORKED_NETWORK = "mainnet";
uint256 internal constant _FORK_BLOCK = 18_920_905;
uint256 internal constant _FEE = 100; // 1% fee
uint256 internal constant _PAYMENT_SALT = 4; // Salt for computing payment addresses
bool internal constant _YIELDING_FUNDS = true;
Expand Down Expand Up @@ -60,8 +58,11 @@ contract IntegrationBase is Test, Deploy {
//////////////////////////////////////////////////////////////*/

function setUp() public {
string memory forkedNetwork = vm.envString("FORKED_NETWORK");
uint256 forkBlock = vm.envUint("FORK_BLOCK");

// Use fork block from deployment parameters
vm.createSelectFork(vm.rpcUrl(_FORKED_NETWORK), _FORK_BLOCK);
vm.createSelectFork(vm.rpcUrl(forkedNetwork), forkBlock);
vm.startPrank(_owner);

// Get deployment parameters
Expand Down

0 comments on commit e651277

Please sign in to comment.