「🏗️」 wip(wallet): seemingly working
This commit is contained in:
57
code/test/KNL_wallet.t.sol
Normal file
57
code/test/KNL_wallet.t.sol
Normal file
@ -0,0 +1,57 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity 0.8.28;
|
||||
|
||||
import "../lib/forge-std/src/Test.sol";
|
||||
import { console } from "../lib/forge-std/src/console.sol";
|
||||
import "../knlWallet.sol";
|
||||
import "../Kanel42_token.sol";
|
||||
|
||||
contract KNLwalletTest is Test {
|
||||
Kanel42_token public token;
|
||||
knlWallet public wallet;
|
||||
|
||||
address owner1 = address(1);
|
||||
address owner2 = address(2);
|
||||
address owner3 = address(3);
|
||||
address owner4 = address(4);
|
||||
|
||||
address to = address(5);
|
||||
|
||||
function setUp() public {
|
||||
address[] memory owners = new address[](4);
|
||||
owners[0] = owner1;
|
||||
owners[1] = owner2;
|
||||
owners[2] = owner3;
|
||||
owners[3] = owner4;
|
||||
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()));
|
||||
token.transfer(address(wallet), 4 * (10 ** token.decimals()));
|
||||
}
|
||||
|
||||
function testAdd() public {
|
||||
vm.prank(owner1);
|
||||
wallet.addTransaction(payable(to), 1, address(token));
|
||||
}
|
||||
|
||||
function testConfirm() public {
|
||||
vm.prank(owner1);
|
||||
wallet.submitTransaction(payable(to), 1, address(token));
|
||||
|
||||
uint tr = wallet.transactionCount() - 1;
|
||||
|
||||
vm.prank(owner2);
|
||||
wallet.confirmTransaction(tr);
|
||||
|
||||
vm.prank(owner3);
|
||||
wallet.confirmTransaction(tr);
|
||||
|
||||
vm.prank(owner4);
|
||||
wallet.confirmTransaction(tr);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user