@@ -66,14 +66,14 @@ contract ProxyTest is Test, ArtifactStorage {
6666 vm.deal (bob, INITIAL_ETH_BALANCE);
6767 }
6868
69- function testInitialState () public view {
69+ function test_InitialState () public view {
7070 assertEq (proxy.ethSupply (), 0 , "Initial ETH supply should be 0 " );
7171 assertEq (proxy.tokenSupply (), INITIAL_TOKEN_SUPPLY, "Initial token supply mismatch " );
7272 assertEq (proxy.tokensLiquidity (), INITIAL_LIQUIDITY_TOKENS, "Initial liquidity tokens mismatch " );
7373 assertFalse (proxy.isMigrated (), "Should not be migrated initially " );
7474 }
7575
76- function testSingleBuyTokens () public {
76+ function test_SingleBuyTokens () public {
7777 uint256 buyAmount = 1 ether ;
7878 uint256 initialTokenBalance = proxy.token ().balanceOf (alice);
7979 uint256 initialEthSupply = proxy.ethSupply ();
@@ -90,7 +90,7 @@ contract ProxyTest is Test, ArtifactStorage {
9090 assertEq (IERC20 (address (proxy.weth ())).balanceOf (address (proxy)), buyAmount, "WETH balance incorrect " );
9191 }
9292
93- function testMultipleBuysIncreasePrices () public {
93+ function test_MultipleBuysIncreasePrices () public {
9494 uint256 buyAmount = 1 ether ;
9595
9696 // First buy
@@ -108,7 +108,7 @@ contract ProxyTest is Test, ArtifactStorage {
108108 assertTrue (secondBuyTokens < firstBuyTokens, "Price should increase after buys " );
109109 }
110110
111- function testSellTokens () public {
111+ function test_SellTokens () public {
112112 // First buy tokens
113113 uint256 buyAmount = 1 ether ;
114114 vm.startPrank (alice);
@@ -136,7 +136,7 @@ contract ProxyTest is Test, ArtifactStorage {
136136 assertEq (proxy.token ().balanceOf (alice), 0 , "Should have no tokens left " );
137137 }
138138
139- function testPriceDecreasesAfterSell () public {
139+ function test_PriceDecreasesAfterSell () public {
140140 // Initial buy
141141 uint256 buyAmount = 2 ether ;
142142 vm.startPrank (alice);
@@ -156,7 +156,7 @@ contract ProxyTest is Test, ArtifactStorage {
156156 assertTrue (priceAfterSell < priceBeforeSell, "Price should decrease after sell " );
157157 }
158158
159- function testThresholdMigration () public {
159+ function test_ThresholdMigration () public {
160160 vm.startPrank (alice);
161161 uint256 thresholdAmount = proxy.THRESHOLD ();
162162
@@ -170,18 +170,20 @@ contract ProxyTest is Test, ArtifactStorage {
170170 vm.stopPrank ();
171171 }
172172
173- function testFailBuyAfterMigration () public {
174- // First reach threshold
173+ function test_CannotBuyAfterMigration () public {
174+ // First reach threshold and verify migration
175175 vm.startPrank (alice);
176- proxy.buyTokens {value: proxy.THRESHOLD ()}(0 );
176+ uint256 exceedingAmount = proxy.THRESHOLD () + 1 ether ;
177+ proxy.buyTokens {value: exceedingAmount}(0 );
178+ assertTrue (proxy.isMigrated (), "Should be migrated after threshold " );
177179
178- // Try to buy after migration
180+ // Should revert when trying to buy after migration
179181 vm.expectRevert (abi.encodeWithSignature ("LaunchpadInvalidState() " ));
180182 proxy.buyTokens {value: 1 ether }(0 );
181183 vm.stopPrank ();
182184 }
183185
184- function testMinimumOutputAmount () public {
186+ function test_MinimumOutputAmount () public {
185187 uint256 buyAmount = 1 ether ;
186188 uint256 expectedTokens = proxy.getTokensOutAtCurrentSupply (buyAmount);
187189
@@ -192,7 +194,7 @@ contract ProxyTest is Test, ArtifactStorage {
192194 vm.stopPrank ();
193195 }
194196
195- function testFailSellMinimumOutputTooHigh () public {
197+ function test_CannotBuyWithHighMinimumOutput () public {
196198 uint256 buyAmount = 1 ether ;
197199 uint256 expectedTokens = proxy.getTokensOutAtCurrentSupply (buyAmount);
198200
@@ -203,6 +205,7 @@ contract ProxyTest is Test, ArtifactStorage {
203205
204206 // Try to buy with minimum output higher than possible
205207 vm.startPrank (alice);
208+ vm.expectRevert (abi.encodeWithSignature ("LaunchpadInsufficientOutputAmount() " ));
206209 proxy.buyTokens {value: buyAmount}(expectedTokens + 1 );
207210 vm.stopPrank ();
208211
0 commit comments