1
0

🏗️」 wip(wallet): seemingly working

This commit is contained in:
2025-08-10 20:03:08 +02:00
parent c52bfff536
commit 164f8b80c8
6 changed files with 196 additions and 37 deletions

View File

@ -11,7 +11,7 @@ contract Kanel42TokenTest is Test {
// This function runs before each test
function setUp() public {
token = new Kanel42_token();
vm.deal(address(token), 1 ether);
vm.deal(address(token), 1 ether);
}
// Test the initial supply of the token
@ -20,40 +20,25 @@ contract Kanel42TokenTest is Test {
assertEq(token.totalMinted(), 0);
}
function testMint() public {
// Define the amount of ether to send for minting
uint256 mintAmount = 1 * (10 ** token.decimals());
function testMint() public {
// Define the amount of ether to send for minting
uint256 mintAmount = 1 * (10 ** token.decimals());
// Get the initial balance of the sender
uint256 initialBalance = token.balanceOf(address(this));
// Get the initial balance of the sender
uint256 initialBalance = token.balanceOf(address(this));
// Mint tokens by sending ether
token.mint(mintAmount);
// Mint tokens by sending ether
token.mint(mintAmount);
// Check if the balance increased as expected
uint256 expectedMintedAmount = mintAmount;
uint256 finalBalance = token.balanceOf(address(this));
assertEq(finalBalance - initialBalance, expectedMintedAmount, "Minted amount is incorrect");
}
function testBurn() public {
// First, mint some tokens to burn
uint256 mintAmount = 1 * (10 ** token.decimals());
token.mint(mintAmount);
// Get the initial balance of the sender
uint256 initialBalance = token.balanceOf(address(this));
// Define the amount of tokens to burn
uint256 burnAmount = mintAmount;
// Burn tokens
token.burn(burnAmount);
// Check if the balance decreased as expected
uint256 finalBalance = token.balanceOf(address(this));
assertEq(initialBalance - finalBalance, burnAmount, "Burned amount is incorrect");
}
// Check if the balance increased as expected
uint256 expectedMintedAmount = mintAmount;
uint256 finalBalance = token.balanceOf(address(this));
assertEq(
finalBalance - initialBalance,
expectedMintedAmount,
"Minted amount is incorrect"
);
}
// Test transferring tokens
function testTransfer() public {