@@ -89,38 +89,38 @@ contract StrategyAtomicityTest is Test {
8989 function testFenwickTreeAtomicityDuringTransfers () public {
9090 // Setup: Create holders with exact amounts
9191 vm.expectEmit (true , true , true , true );
92- emit Minted (alice, 10 ether, 9900 ether, 100 ether);
92+ emit Minted (alice, 10 ether, 9.9 ether, 0.1 ether);
9393 vm.prank (alice);
9494 monstr.mint {value: 10 ether }();
9595 assertEq (
9696 monstr.balanceOf (alice),
97- 9900 ether,
97+ 9.9 ether,
9898 "Alice should have 9,900 tokens "
9999 );
100100
101101 vm.expectEmit (true , true , true , true );
102- emit Minted (bob, 5 ether, 4950 ether, 50 ether);
102+ emit Minted (bob, 5 ether, 4.95 ether, 0.05 ether);
103103 vm.prank (bob);
104104 monstr.mint {value: 5 ether }();
105105 assertEq (
106106 monstr.balanceOf (bob),
107- 4950 ether,
107+ 4.95 ether,
108108 "Bob should have 4,950 tokens "
109109 );
110110
111111 vm.expectEmit (true , true , true , true );
112- emit Minted (charlie, 3 ether, 2970 ether, 30 ether);
112+ emit Minted (charlie, 3 ether, 2.97 ether, 0.03 ether);
113113 vm.prank (charlie);
114114 monstr.mint {value: 3 ether }();
115115 assertEq (
116116 monstr.balanceOf (charlie),
117- 2970 ether,
117+ 2.97 ether,
118118 "Charlie should have 2,970 tokens "
119119 );
120120
121121 // Verify initial Fenwick tree state
122122 uint256 initialSuffix1 = monstr.getSuffixSum (1 );
123- uint256 expectedInitialTotal = 9900 ether + 4950 ether + 2970 ether ; // 17,820 tokens
123+ uint256 expectedInitialTotal = 9.9 ether + 4.95 ether + 2.97 ether ; // 17.82 tokens
124124 assertEq (
125125 initialSuffix1,
126126 expectedInitialTotal,
@@ -130,89 +130,89 @@ contract StrategyAtomicityTest is Test {
130130 // Perform multiple transfers in same transaction
131131 vm.startPrank (alice);
132132 vm.expectEmit (true , true , true , true );
133- emit Transfer (alice, bob, 99 ether); // 100 - 1% fee = 99
134- monstr.transfer (bob, 100 ether);
133+ emit Transfer (alice, bob, 0.099 ether); // 0.1 - 1% fee = 0.099
134+ monstr.transfer (bob, 0.1 ether);
135135 assertEq (
136136 monstr.balanceOf (alice),
137- 9800 ether,
138- "Alice should have 9,800 tokens after first transfer "
137+ 9.8 ether,
138+ "Alice should have 9.8 tokens after first transfer "
139139 );
140140 assertEq (
141141 monstr.balanceOf (bob),
142- 5049 ether,
143- "Bob should have 5, 049 tokens "
142+ 5.049 ether,
143+ "Bob should have 5. 049 tokens "
144144 );
145145
146146 vm.expectEmit (true , true , true , true );
147- emit Transfer (alice, charlie, 198 ether); // 200 - 1% fee = 198
148- monstr.transfer (charlie, 200 ether);
147+ emit Transfer (alice, charlie, 0. 198 ether); // 0.2 - 1% fee = 0. 198
148+ monstr.transfer (charlie, 0.2 ether);
149149 assertEq (
150150 monstr.balanceOf (alice),
151- 9600 ether,
152- "Alice should have 9,600 tokens after second transfer "
151+ 9.6 ether,
152+ "Alice should have 9.6 tokens after second transfer "
153153 );
154154 assertEq (
155155 monstr.balanceOf (charlie),
156- 3168 ether,
157- "Charlie should have 3, 168 tokens "
156+ 3.168 ether,
157+ "Charlie should have 3. 168 tokens "
158158 );
159159 vm.stopPrank ();
160160
161161 // Verify Fenwick tree is still consistent
162162 uint256 afterSuffix1 = monstr.getSuffixSum (1 );
163- uint256 expectedAfterTotal = 9600 ether + 5049 ether + 3168 ether ; // 17, 817 tokens (3 tokens to fees)
163+ uint256 expectedAfterTotal = 9.6 ether + 5.049 ether + 3.168 ether ; // 17. 817 tokens (0.003 tokens to fees)
164164 assertEq (
165165 afterSuffix1,
166166 expectedAfterTotal,
167- "Fenwick sum should be 17, 817 tokens after transfers "
167+ "Fenwick sum should be 17. 817 tokens after transfers "
168168 );
169169 }
170170
171171 function testFenwickTreeAtomicityDuringMintAndBurn () public {
172172 // Initial mint
173173 vm.expectEmit (true , true , true , true );
174- emit Minted (alice, 10 ether, 9900 ether, 100 ether);
174+ emit Minted (alice, 10 ether, 9.9 ether, 0.1 ether);
175175 vm.prank (alice);
176176 monstr.mint {value: 10 ether }();
177177 assertEq (
178178 monstr.balanceOf (alice),
179- 9900 ether,
179+ 9.9 ether,
180180 "Alice should have 9,900 tokens "
181181 );
182182
183183 // Check Fenwick consistency after mint
184184 uint256 suffix1AfterMint = monstr.getSuffixSum (1 );
185185 assertEq (
186186 suffix1AfterMint,
187- 9900 ether,
187+ 9.9 ether,
188188 "Fenwick should be 9,900 after mint "
189189 );
190190
191191 // Move past minting period to enable redemption
192192 vm.warp (block .timestamp + 8 days);
193193
194194 // Trigger max supply setting
195- uint256 redeemAmount = 100 ether ;
196- uint256 redeemFee = 1 ether ; // 1% of 100
197- uint256 netRedeemed = 99 ether ;
198- uint256 monReturned = netRedeemed / 1000 ; // 0.099 MON
195+ uint256 redeemAmount = 0.1 ether ;
196+ uint256 redeemFee = 0.001 ether ; // 1% of 0.1
197+ uint256 netRedeemed = 0.099 ether ;
198+ uint256 monReturned = netRedeemed; // 0.099 MON (1:1 ratio)
199199
200200 vm.expectEmit (true , true , true , true );
201201 emit Redeemed (alice, redeemAmount, monReturned, redeemFee);
202202 vm.prank (alice);
203203 monstr.redeem (redeemAmount);
204204 assertEq (
205205 monstr.balanceOf (alice),
206- 9800 ether,
207- "Alice should have 9,800 tokens after redeem "
206+ 9.8 ether,
207+ "Alice should have 9.8 tokens after redeem "
208208 );
209209
210210 // Check Fenwick consistency after redemption
211211 uint256 suffix1AfterRedeem = monstr.getSuffixSum (1 );
212212 assertEq (
213213 suffix1AfterRedeem,
214- 9800 ether,
215- "Fenwick should be 9,800 after redeem "
214+ 9.8 ether,
215+ "Fenwick should be 9.8 after redeem "
216216 );
217217
218218 // Add another holder - mint slightly more to meet minimum requirement
@@ -240,11 +240,11 @@ contract StrategyAtomicityTest is Test {
240240
241241 // Verify both holders are tracked correctly
242242 uint256 finalSuffix1 = monstr.getSuffixSum (1 );
243- uint256 expectedFinal = 9800 ether + expectedNet;
243+ uint256 expectedFinal = 9.8 ether + expectedNet;
244244 assertEq (
245245 finalSuffix1,
246246 expectedFinal,
247- "Fenwick should be 9,889.1 with both holders "
247+ "Fenwick should be correct with both holders "
248248 );
249249 }
250250
@@ -272,7 +272,7 @@ contract StrategyAtomicityTest is Test {
272272 for (uint256 round = 0 ; round < 20 ; round++ ) {
273273 uint256 from = round % 10 ;
274274 uint256 to = (round + 3 ) % 10 ;
275- uint256 amount = 50 ether + (round * 10 ether);
275+ uint256 amount = 0.05 ether + (round * 0.01 ether);
276276
277277 if (monstr.balanceOf (users[from]) >= amount) {
278278 vm.prank (users[from]);
@@ -316,8 +316,8 @@ contract StrategyAtomicityTest is Test {
316316
317317 // Try to transfer to malicious contract
318318 // The reentrancy guard should prevent any issues
319- uint256 transferAmount = 100 ether ;
320- uint256 netTransferred = 99 ether ;
319+ uint256 transferAmount = 0.1 ether ;
320+ uint256 netTransferred = 0.099 ether ;
321321
322322 vm.expectEmit (true , true , true , true );
323323 emit Transfer (alice, address (malicious), netTransferred);
@@ -341,18 +341,18 @@ contract StrategyAtomicityTest is Test {
341341 // Verify the transfer happened correctly with exact amounts
342342 assertEq (
343343 aliceBalance,
344- 9800 ether,
345- "Alice should have exactly 9,800 tokens "
344+ 9.8 ether,
345+ "Alice should have exactly 9.8 tokens "
346346 );
347347 assertEq (
348348 maliciousBalance,
349349 netTransferred,
350- "Malicious contract should have exactly 99 tokens "
350+ "Malicious contract should have exactly 0.099 tokens "
351351 );
352352 assertEq (
353353 monstr.balanceOf (monstr.FEES_POOL ()),
354- 101 ether,
355- "Fees pool should have 101 tokens total "
354+ 0. 101 ether,
355+ "Fees pool should have 0. 101 tokens total "
356356 );
357357 }
358358
0 commit comments