From e770c51dd586090d606627e6ddde1cccbcc701bf Mon Sep 17 00:00:00 2001 From: ichristwin Date: Sat, 1 Feb 2025 18:52:19 +0100 Subject: [PATCH] minor changes to tests --- .github/workflows/test.yml | 2 +- test/Solaxy.invariant.t.sol | 20 +++++++------------- test/Solaxy.t.sol | 5 ----- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6470a8e..a633f71 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,5 +33,5 @@ jobs: - name: Run Forge tests run: | - forge test -vvvv + forge test -vvv id: test diff --git a/test/Solaxy.invariant.t.sol b/test/Solaxy.invariant.t.sol index 0f486f6..ea3f77c 100644 --- a/test/Solaxy.invariant.t.sol +++ b/test/Solaxy.invariant.t.sol @@ -48,9 +48,8 @@ contract Handler is Test { } contract SolaxyInvarantTest is Test { - Handler public handler; - IERC20 public RESERVE; Solaxy public SLX; + IERC20 public RESERVE; address public RESERVE_address; address public handlerAddress; @@ -61,9 +60,7 @@ contract SolaxyInvarantTest is Test { SLX = new Solaxy(); RESERVE_address = SLX.asset(); RESERVE = IERC20(RESERVE_address); - - handler = new Handler(SLX, RESERVE); - handlerAddress = address(handler); + handlerAddress = address(new Handler(SLX, RESERVE)); deal(RESERVE_address, handlerAddress, reserve_balanceOneBillion, true); dealERC721(address(SLX.M3TER()), handlerAddress, 0); @@ -71,9 +68,11 @@ contract SolaxyInvarantTest is Test { } function invariantValuation() public view { - uint256 reserve_balanceAfterTest = RESERVE.balanceOf(handlerAddress); - uint256 solaxyTVL = reserve_balanceOneBillion - reserve_balanceAfterTest; - assertEq(SLX.totalAssets(), solaxyTVL, "Total value locked should be strictly equal to total reserve assets"); + assertEq( + SLX.totalAssets(), + RESERVE.balanceOf(handlerAddress) - reserve_balanceOneBillion, + "Total value locked should be strictly equal to total reserve assets" + ); assertEq( SLX.totalSupply(), @@ -88,9 +87,4 @@ contract SolaxyInvarantTest is Test { "Total reserve assets must be enough to cover the conversion of all existing tokens to less than a cent rounding error" ); } - - function test_knowHolderBalance() public view { - uint256 knowHolderBalance = RESERVE.balanceOf(0x4e59b44847b379578588920cA78FbF26c0B4956C); - assertEq(knowHolderBalance, 0.000864e18, "reserve balance should be equal 0.000864 reserve"); - } } diff --git a/test/Solaxy.t.sol b/test/Solaxy.t.sol index e4263f9..38dfc1f 100644 --- a/test/Solaxy.t.sol +++ b/test/Solaxy.t.sol @@ -149,9 +149,4 @@ contract SolaxyUnitTest is Test { uint256 SLX_feeBalance = SLX.balanceOf(SLX.tipAccount()); assertEq(SLX_feeBalance, 17938800000000000000); } - - function test_knowHolderBalance() public view { - uint256 knowHolderBalance = RESERVE.balanceOf(0x4e59b44847b379578588920cA78FbF26c0B4956C); - assertEq(knowHolderBalance, 0.000864e18, "reserve balance should be equal 0.000864 reserve"); - } }