diff --git a/README.md b/README.md index 19de175..5d719ca 100644 --- a/README.md +++ b/README.md @@ -58,16 +58,6 @@ For detailed info on branches and contribution, check out the [Contributing Guid > See [sync script usage](CONTRIBUTING.md#syncing-changes-between-branches) for automating branch sync. -## Documentation - -For detailed guides on various aspects of LazerForge, check out: - -- [Setup Guide](lazerTutorial/setup.md) - Initial setup and configuration -- [Testing Guide](lazerTutorial/testing.md) - Writing and running tests -- [Deployment Guide](lazerTutorial/deployment.md) - Deploying contracts -- [Network Configuration](lazerTutorial/networks.md) - Setting up networks and RPC endpoints -- [Profiles](lazerTutorial/profiles.md) - Using different Foundry profiles - ## Reinitialize Submodules When working across branches with different dependencies, submodules may need to be reinitialized. Run @@ -99,3 +89,13 @@ To generate reports, run ```bash ./coverage-report ``` + +## Documentation + +For detailed guides on various aspects of LazerForge, check out: + +- [Setup Guide](lazerTutorial/setup.md) - Initial setup and configuration +- [Testing Guide](lazerTutorial/testing.md) - Writing and running tests +- [Deployment Guide](lazerTutorial/deployment.md) - Deploying contracts +- [Network Configuration](lazerTutorial/networks.md) - Setting up networks and RPC endpoints +- [Profiles](lazerTutorial/profiles.md) - Using different Foundry profiles diff --git a/test/BalanceManager.t.sol b/test/BalanceManager.t.sol index 433ac97..495102c 100644 --- a/test/BalanceManager.t.sol +++ b/test/BalanceManager.t.sol @@ -89,7 +89,7 @@ contract BalanceManagerTest is Test { console.log("User2 address:", _user2); } - function testAddRemoveAdmin() public { + function test_addRemoveAdmin() public { address newAdmin = vm.addr(5); // Add new admin @@ -103,7 +103,7 @@ contract BalanceManagerTest is Test { console.log("Removed new admin:", newAdmin); } - function testRemovedAdminWorks() public { + function test_removedAdminWorks() public { vm.startPrank(_owner); // Add user1 as admin @@ -136,7 +136,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testUserCannotCallAdmin() public { + function test_userCannotCallAdmin() public { vm.startPrank(_user1); // Attempt to set balance as a regular user @@ -157,7 +157,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testSetBalance() public { + function test_setBalance() public { vm.startPrank(_admin1); console.log("Initial balance:", _balanceManager.balances(address(_user1), address(_mockTokenA))); @@ -171,7 +171,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testIncreaseBalance() public { + function test_increaseBalance() public { vm.startPrank(_admin1); uint256 initialAmount = 300 * 10 ** 18; @@ -197,7 +197,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testReduceBalance() public { + function test_reduceBalance() public { vm.startPrank(_admin1); uint256 initialAmount = 500 * 10 ** 18; @@ -223,7 +223,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testFuzzSetBalance(uint256 amount) public { + function test_fuzzSetBalance(uint256 amount) public { vm.assume(amount <= _hundredThousand); vm.startPrank(_admin1); @@ -237,7 +237,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testFuzzIncreaseBalance(uint256 amount) public { + function test_fuzzIncreaseBalance(uint256 amount) public { vm.assume(amount <= _hundredThousand); vm.startPrank(_admin1); @@ -251,7 +251,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testFuzzReduceBalance(uint256 initialAmount, uint256 reduceAmount) public { + function test_fuzzReduceBalance(uint256 initialAmount, uint256 reduceAmount) public { vm.assume(initialAmount <= _hundredThousand); vm.assume(reduceAmount <= initialAmount); @@ -270,7 +270,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testClaimBalance() public { + function test_claimBalance() public { vm.startPrank(_admin1); uint256 amount = 500 * 10 ** 18; @@ -300,7 +300,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testClaimAllBalances() public { + function test_claimAllBalances() public { vm.startPrank(_admin1); _balanceManager.setBalance(_user1, address(_mockTokenA), _fiveHundred); // set token A balance to 500 @@ -347,7 +347,7 @@ contract BalanceManagerTest is Test { vm.stopPrank(); } - function testWithdrawExcessTokens() public { + function test_withdrawExcessTokens() public { // Set up initial balances vm.startPrank(_admin1); @@ -406,7 +406,7 @@ contract BalanceManagerTest is Test { assertEq(finalContractBalance, userBalance, "Contract should still have enough Token A to cover user balance"); } - function testWithdrawExcessTokensThenClaim() public { + function test_withdrawExcessTokensThenClaim() public { // Set up initial balances vm.startPrank(_admin1); @@ -477,7 +477,7 @@ contract BalanceManagerTest is Test { assertEq(finalContractBalance, 0, "Contract should have zero Token A after user's claim"); } - function testAdminFundsUserClaims() public { + function test_adminFundsUserClaims() public { // Log initial user balance uint256 initialUser1Balance = _mockTokenA.balanceOf(_user1); console.log("Initial User1 Token A balance:", initialUser1Balance); @@ -514,18 +514,18 @@ contract BalanceManagerTest is Test { } // attempt to set balance for contract address - function testCannotAddContractBalance() public { + function test_cannotAddContractBalance() public { vm.startPrank(_admin1); address contractAddress = address(_balanceManager); - vm.expectRevert("Contract cannot be the user"); + vm.expectRevert(BalanceManager.ContractCannotBeTheUser.selector); _balanceManager.setBalance(contractAddress, address(_mockTokenA), _fiveHundred); vm.stopPrank(); } // assert contract cannot receive ETH - function testCannotReceiveEth() public { + function test_cannotReceiveEth() public { vm.expectRevert(bytes("Contract should not accept ETH")); (bool success,) = address(_balanceManager).call{value: 1 ether}(""); console.log("ETH transfer success status:", success); diff --git a/test/InflationToken.t.sol b/test/InflationToken.t.sol index 1644184..44bb587 100644 --- a/test/InflationToken.t.sol +++ b/test/InflationToken.t.sol @@ -27,7 +27,7 @@ contract InflationTokenTest is Test { console.log("Setup completed. Owner address:", _owner, "User address:", _user); } - function testInitialSupply() public { + function test_initialSupply() public { uint256 initialSupply = 1_000_000_000 * 10 ** _token.decimals(); console.log("Testing Initial Supply"); console.log("Expected initial supply:", initialSupply); @@ -38,7 +38,7 @@ contract InflationTokenTest is Test { assertEq(_token.balanceOf(_owner), initialSupply); } - function testInflation() public { + function test_inflation() public { uint256 initialSupply = 1_000_000_000 * 10 ** _token.decimals(); // Try minting after 1 day - should fail @@ -66,7 +66,7 @@ contract InflationTokenTest is Test { assertEq(_token.totalSupply(), initialSupply + (_token.MINT_CAP() * 2)); } - function testMintToContractAddressBlocked() public { + function test_mintToContractAddressBlocked() public { vm.warp(block.timestamp + 365 days); console.log("Attempting to mint to contract address, expecting revert"); @@ -74,7 +74,7 @@ contract InflationTokenTest is Test { _token.mint(address(_token)); } - function testRecoverTokens() public { + function test_recoverTokens() public { vm.warp(block.timestamp + 365 days); _token.mint(_owner); _token.transfer(address(_token), _token.MINT_CAP()); @@ -95,7 +95,7 @@ contract InflationTokenTest is Test { assertEq(ownerBalanceAfter, ownerBalanceBefore + _token.MINT_CAP()); } - function testTotalSupplyAfterInflation() public { + function test_totalSupplyAfterInflation() public { console.log("Testing Total Supply After Inflation for 5 years"); console.log("Inflation is a constant 5% of the initial supply each year"); uint256 initialSupply = 1_000_000_000 * 10 ** _token.decimals(); @@ -111,13 +111,13 @@ contract InflationTokenTest is Test { } } - function testTransferOwnership() public { + function test_transferOwnership() public { console.log("Testing Ownership Transfer"); _token.transferOwnership(_user); console.log("Ownership transferred to user"); } - function testTokenTransfers() public { + function test_tokenTransfers() public { console.log("Testing Token Transfers"); uint256 ownerBalanceBefore = _token.balanceOf(_owner); console.log("Owner balance before transfer:", ownerBalanceBefore); @@ -129,7 +129,7 @@ contract InflationTokenTest is Test { console.log("Owner balance after transfer:", _token.balanceOf(_owner)); } - function testRecoverOtherToken() public { + function test_recoverOtherToken() public { console.log("Testing Recover Other Token"); _otherToken.mint(address(_token), 100); console.log("Transferred 100 OtherToken to contract"); @@ -138,7 +138,7 @@ contract InflationTokenTest is Test { assertEq(_otherToken.balanceOf(_owner), 100); } - function testBurnTokens() public { + function test_burnTokens() public { console.log("Testing Token Burning"); uint256 initialSupply = _token.totalSupply(); console.log("Initial total supply:", initialSupply); @@ -148,14 +148,14 @@ contract InflationTokenTest is Test { console.log("Total supply after burning:", _token.totalSupply()); } - function testCannotReceiveEth() public { + function test_cannotReceiveEth() public { vm.expectRevert(bytes("Contract should not accept ETH")); (bool success,) = address(_token).call{value: 1 ether}(""); console.log("ETH transfer success status:", success); assertFalse(success, "Contract should not be able to accept ETH"); } - function testAccess() public { + function test_access() public { console.log("Testing access to token attributes and ownership"); assertEq(_token.name(), "InflationToken", "Token name should be InflationToken"); assertEq(_token.symbol(), "INFLA", "Token symbol should be INFLA");