Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-manuel committed Nov 14, 2023
1 parent 363a32a commit 4fc73af
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions test/IntegrationTests.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ contract IntegrationTestsBase is Test {
// reserve asset can be borrowed.
// TODO: Remove LTV check once DAI spell goes through
if (!_usageAsCollateralEnabled(asset) || _ltv(asset) == 1) {
console.log("Collateral NOT enabled", IERC20(asset).name());
_supplyWethCollateral(sparkUser, 1_000 ether);
}

Expand Down Expand Up @@ -396,7 +395,7 @@ contract FreezeAllAssetsSpellTest is IntegrationTestsBase {
address asset = reserves[i];
uint256 decimals = IERC20(asset).decimals();

// If the asset is frozen on mainnet, skip the test
// If the asset is already frozen on mainnet, skip the test
if (_isFrozen(asset)) {
untestedReserves.push(asset);
continue;
Expand All @@ -408,43 +407,31 @@ contract FreezeAllAssetsSpellTest is IntegrationTestsBase {
poolConfig.setBorrowCap(asset, 68_719_476_735); // MAX_BORROW_CAP
vm.stopPrank();

// uint256 snapshot = vm.snapshot();

console.log("i", i);

_checkUserActionsUnfrozen(
asset,
supplyAmount * 10 ** decimals,
withdrawAmount * 10 ** decimals,
borrowAmount * 10 ** decimals,
repayAmount * 10 ** decimals
);

// vm.revertTo(snapshot); // Use snapshotting to avoid issues with siloed borrowing
}



assertEq(untestedReserves.length, 1);
assertEq(untestedReserves[0], 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); // WBTC

// Freeze all assets in the protocol
vm.prank(randomUser); // Demonstrate no ACL in spell
FreezeSingleAssetSpell(freezeAllAssetsSpell).freeze();

// Check that protocol is working as expected after the freeze spell for each asset
// Check that protocol is working as expected after the freeze spell for all assets
for (uint256 i = 0; i < reserves.length; i++) {
if (reserves[i] == untestedReserves[0]) {
continue;
}

console.log("i", i);

address asset = reserves[i];
uint256 decimals = IERC20(asset).decimals();

// uint256 snapshot = vm.snapshot();

// Check all assets, including unfrozen ones from start
_checkUserActionsFrozen(
asset,
Expand All @@ -453,8 +440,6 @@ contract FreezeAllAssetsSpellTest is IntegrationTestsBase {
borrowAmount * 10 ** decimals,
repayAmount * 10 ** decimals
);

// vm.revertTo(snapshot); // Use snapshotting to avoid issues with siloed borrowing
}

// Undo all freezes, including WBTC and make sure that protocol is back to working
Expand All @@ -466,18 +451,13 @@ contract FreezeAllAssetsSpellTest is IntegrationTestsBase {
vm.prank(SPARK_PROXY);
poolConfig.setReserveFreeze(asset, false);

// uint256 snapshot = vm.snapshot();

_checkUserActionsUnfrozen(
asset,
supplyAmount * 10 ** decimals,
withdrawAmount * 10 ** decimals,
borrowAmount * 10 ** decimals,
repayAmount * 10 ** decimals
);

// vm.revertTo(snapshot); // Use snapshotting to avoid issues with siloed borrowing

}
}

Expand Down

0 comments on commit 4fc73af

Please sign in to comment.