Skip to content

Commit b9c9f1f

Browse files
committed
added test cases
1 parent 3b783d3 commit b9c9f1f

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

test/Solaxy.invariant.t.sol

+6
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,11 @@ contract SolaxyInvarantTest is Test {
8585
SLX.balanceOf(handlerAddress) + SLX.balanceOf(tipAccount()),
8686
"Total handler holdings plus all fees collected should be strictly equal to the total token supply"
8787
);
88+
89+
assertEq(
90+
SLX.totalAssets(),
91+
SLX.previewRedeem(SLX.totalSupply()),
92+
"Total reserve assets must be enough to cover the conversion of all existing tokens to less than a cent rounding error"
93+
);
8894
}
8995
}

test/Solaxy.t.sol

+12-8
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ contract SolaxyUnitTest is Test {
106106
totalAssetsAfterDeposit - reserve_amountWithdrawn,
107107
"reserve balance should increase after withdrawal"
108108
);
109-
110-
// Check for fees
111-
// uint256 SLX_feeBalance = SLX.balanceOf(tipAccount());
112-
// assertEq(SLX_feeBalance, 17950000000000000000);
109+
assertApproxEqAbs(
110+
SLX.balanceOf(tipAccount()),
111+
SLX_amountIn - SLX_amountBurned,
112+
0.000000002e18,
113+
"tip should be difference between all shares burnt vs shares spent"
114+
);
113115
}
114116

115117
function test_M3terHolderCanMintAndRedeem() public {
@@ -153,9 +155,11 @@ contract SolaxyUnitTest is Test {
153155
0.00002e18,
154156
"reserve balance should increase after redeeming"
155157
);
156-
157-
// Check for fees
158-
// uint256 SLX_feeBalance = SLX.balanceOf(tipAccount());
159-
// assertEq(SLX_feeBalance, 17938800000000000000);
158+
assertApproxEqAbs(
159+
SLX.balanceOf(tipAccount()),
160+
SLX_amountIn - SLX_amountBurned,
161+
0.000000002e18,
162+
"tip should be difference between all shares burnt vs shares spent"
163+
);
160164
}
161165
}

0 commit comments

Comments
 (0)