diff --git a/script/DeployTokenWithProxy.s.sol b/script/DeployTokenWithProxy.s.sol index 6fba27b..c61561f 100644 --- a/script/DeployTokenWithProxy.s.sol +++ b/script/DeployTokenWithProxy.s.sol @@ -15,7 +15,7 @@ contract DeployTokenWithProxy is BaseScript { address implementation = address(new TestStableToken()); // Encode the initialize call - bytes memory data = abi.encodeCall(TestStableToken.initialize, (1000000 * 10 ** 18)); + bytes memory data = abi.encodeCall(TestStableToken.initialize, (1_000_000 * 10 ** 18)); // Deploy the proxy with initialization data return new ERC1967Proxy(implementation, data); diff --git a/test/TestStableToken.sol b/test/TestStableToken.sol index a2d13c6..13355cc 100644 --- a/test/TestStableToken.sol +++ b/test/TestStableToken.sol @@ -44,7 +44,7 @@ contract TestStableToken is __ERC20Permit_init("TestStableToken"); __Ownable_init(); __UUPSUpgradeable_init(); - + maxSupply = _maxSupply; } @@ -81,10 +81,10 @@ contract TestStableToken is function setMaxSupply(uint256 _maxSupply) external onlyOwner { if (_maxSupply < totalSupply()) revert ExceedsMaxSupply(); - + uint256 oldMaxSupply = maxSupply; maxSupply = _maxSupply; - + emit MaxSupplySet(oldMaxSupply, _maxSupply); } } diff --git a/test/TestStableToken.t.sol b/test/TestStableToken.t.sol index 8ce63f4..de7cb72 100644 --- a/test/TestStableToken.t.sol +++ b/test/TestStableToken.t.sol @@ -288,13 +288,13 @@ contract TestStableTokenTest is Test { function test__MaxSupplyIsSetCorrectly() external { // maxSupply should be set to 1000000 * 10^18 by deployment script - uint256 expectedMaxSupply = 1000000 * 10 ** 18; + uint256 expectedMaxSupply = 1_000_000 * 10 ** 18; assertEq(token.maxSupply(), expectedMaxSupply); } function test__CannotMintExceedingMaxSupply() external { uint256 currentMaxSupply = token.maxSupply(); - + // Try to mint more than maxSupply vm.prank(owner); vm.expectRevert(abi.encodeWithSelector(ExceedsMaxSupply.selector)); @@ -304,7 +304,7 @@ contract TestStableTokenTest is Test { function test__CannotMintWithETHExceedingMaxSupply() external { uint256 currentMaxSupply = token.maxSupply(); uint256 ethAmount = 1 ether; - + // Try to mint more than maxSupply with ETH vm.deal(owner, ethAmount); vm.prank(owner); @@ -313,15 +313,15 @@ contract TestStableTokenTest is Test { } function test__OwnerCanSetMaxSupply() external { - uint256 newMaxSupply = 2000000 * 10 ** 18; + uint256 newMaxSupply = 2_000_000 * 10 ** 18; uint256 oldMaxSupply = token.maxSupply(); - + vm.expectEmit(true, true, false, false); emit MaxSupplySet(oldMaxSupply, newMaxSupply); - + vm.prank(owner); token.setMaxSupply(newMaxSupply); - + assertEq(token.maxSupply(), newMaxSupply); } @@ -330,7 +330,7 @@ contract TestStableTokenTest is Test { uint256 mintAmount = 1000 ether; vm.prank(owner); token.mint(user1, mintAmount); - + // Try to set maxSupply below current totalSupply vm.prank(owner); vm.expectRevert(abi.encodeWithSelector(ExceedsMaxSupply.selector)); @@ -338,8 +338,8 @@ contract TestStableTokenTest is Test { } function test__NonOwnerCannotSetMaxSupply() external { - uint256 newMaxSupply = 2000000 * 10 ** 18; - + uint256 newMaxSupply = 2_000_000 * 10 ** 18; + vm.prank(user1); vm.expectRevert("Ownable: caller is not the owner"); token.setMaxSupply(newMaxSupply);