-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAngstromBalancerUnit.t.sol
More file actions
57 lines (42 loc) · 2.1 KB
/
AngstromBalancerUnit.t.sol
File metadata and controls
57 lines (42 loc) · 2.1 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.24;
import "forge-std/Test.sol";
import { IAuthentication } from "@balancer-labs/v3-interfaces/contracts/solidity-utils/helpers/IAuthentication.sol";
import { ArrayHelpers } from "@balancer-labs/v3-solidity-utils/contracts/test/ArrayHelpers.sol";
import { AngstromBalancerMock } from "../../contracts/test/AngstromBalancerMock.sol";
import { AngstromBalancer } from "../../contracts/AngstromBalancer.sol";
import { BaseAngstromTest } from "./utils/BaseAngstromTest.sol";
contract AngstromBalancerUnitTest is BaseAngstromTest {
using ArrayHelpers for *;
function testToggleNodesIsAuthenticated() public {
vm.expectRevert(IAuthentication.SenderNotAllowed.selector);
angstromBalancer.toggleNodes([bob].toMemoryArray());
}
function testToggleNodes() public {
makeAngstromNode(bob);
assertTrue(angstromBalancer.isRegisteredNode(bob), "Bob is not a node");
}
function testAddAndRemoveNodes() public {
makeAngstromNodes([bob, alice].toMemoryArray());
assertTrue(angstromBalancer.isRegisteredNode(bob), "Bob is not a node");
assertTrue(angstromBalancer.isRegisteredNode(alice), "Alice is not a node");
vm.prank(admin);
angstromBalancer.toggleNodes([bob].toMemoryArray());
assertFalse(angstromBalancer.isRegisteredNode(bob), "Bob is still a node");
assertTrue(angstromBalancer.isRegisteredNode(alice), "Alice is not a node after bob was removed");
}
function testUnlockAngstromSetsLastUnlockBlockNumber() public {
makeAngstromNode(bob);
assertEq(angstromBalancer.getLastUnlockBlockNumber(), 0, "Last unlock block number is not 0");
vm.prank(bob);
angstromBalancer.manualUnlockAngstrom();
assertEq(
angstromBalancer.getLastUnlockBlockNumber(),
block.number,
"Last unlock block number is not the current block number"
);
}
function testGetVault() public view {
assertEq(address(angstromBalancer.getVault()), address(vault), "Wrong vault address");
}
}