Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
34 changes: 17 additions & 17 deletions test/BalanceManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)));
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -347,7 +347,7 @@ contract BalanceManagerTest is Test {
vm.stopPrank();
}

function testWithdrawExcessTokens() public {
function test_withdrawExcessTokens() public {
// Set up initial balances
vm.startPrank(_admin1);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
22 changes: 11 additions & 11 deletions test/InflationToken.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -66,15 +66,15 @@ 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");
vm.expectRevert(InflationToken.CannotMintToBlockedAddress.selector);
_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());
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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");
Expand Down