1
0

🏗️」 wip(wallet): better tests added

This commit is contained in:
2025-08-10 20:35:51 +02:00
parent 164f8b80c8
commit c0deaf6326
2 changed files with 37 additions and 31 deletions

View File

@ -90,7 +90,9 @@ contract knlWallet {
}
function executeTransaction(uint256 transactionId) public isOwner {
require(isConfirmed(transactionId), "transaction has not been confirmed");
require(
isConfirmed(transactionId), "transaction has not been confirmed"
);
Transaction storage _tx = transactions[transactionId];
if (_tx.tokenAddress == address(0)) {

View File

@ -26,8 +26,6 @@ contract KNLwalletTest is Test {
wallet = new knlWallet(owners, 3);
token = new Kanel42_token();
console.log(wallet.owners(0));
token.mint(10 * (10 ** token.decimals()));
vm.prank(owner3);
token.mint(4 * (10 ** token.decimals()));
@ -40,10 +38,14 @@ contract KNLwalletTest is Test {
}
function testConfirm() public {
uint256 initialbalance = token.balanceOf(address(wallet));
uint256 initialbalanceTo = token.balanceOf(to);
vm.prank(owner1);
wallet.submitTransaction(payable(to), 1, address(token));
wallet.submitTransaction(
payable(to), 1 * (10 ** 6), address(token)
);
uint tr = wallet.transactionCount() - 1;
uint256 tr = wallet.transactionCount() - 1;
vm.prank(owner2);
wallet.confirmTransaction(tr);
@ -51,7 +53,9 @@ contract KNLwalletTest is Test {
vm.prank(owner3);
wallet.confirmTransaction(tr);
vm.prank(owner4);
wallet.confirmTransaction(tr);
uint256 finalBalance = token.balanceOf(address(wallet));
assertEq(token.balanceOf(to) - initialbalanceTo, 10 ** token.decimals());
assertEq(initialbalance - finalBalance, 1 * (10 ** token.decimals()));
}
}