-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVoteDelegate.t.sol
More file actions
68 lines (56 loc) · 2.04 KB
/
VoteDelegate.t.sol
File metadata and controls
68 lines (56 loc) · 2.04 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
58
59
60
61
62
63
64
65
66
67
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.8.33;
import {Test, console} from "forge-std/Test.sol";
import {IERC20} from "../src/interfaces/IERC20.sol";
import {IVat} from "../src/interfaces/IVat.sol";
import {ILockstakeEngine} from "../src/interfaces/ILockstakeEngine.sol";
import {IVoteDelegateFactory} from "../src/interfaces/IVoteDelegateFactory.sol";
import {IVoteDelegate} from "../src/interfaces/IVoteDelegate.sol";
import {IChief} from "../src/interfaces/IChief.sol";
import {
VAT,
SKY,
LOCKSTAKE_SKY,
LOCKSTAKE_SKY_A,
USDS,
LOCKSTAKE_ENGINE,
VOTE_DELEGATE_FACTORY,
CHIEF
} from "../src/Constants.sol";
contract VoteDelegateTest is Test {
IVat constant vat = IVat(VAT);
IERC20 constant sky = IERC20(SKY);
IERC20 constant usds = IERC20(USDS);
ILockstakeEngine constant engine = ILockstakeEngine(LOCKSTAKE_ENGINE);
IVoteDelegateFactory constant factory =
IVoteDelegateFactory(VOTE_DELEGATE_FACTORY);
IChief constant chief = IChief(CHIEF);
// Proposal id
bytes32 slate;
IVoteDelegate voteDelegate;
function setUp() public {
IVat.Ilk memory ilk = vat.ilks(LOCKSTAKE_SKY_A);
require(ilk.rate > 0, "ilk is disabled");
require(ilk.line > 0, "ilk is disabled");
require(chief.live() == 1, "chief disabled");
deal(SKY, address(this), 1000 * 1e18);
sky.approve(address(engine), type(uint256).max);
voteDelegate = IVoteDelegate(factory.create());
// Proposal
address[] memory yays = new address[](3);
yays[0] = address(1);
yays[1] = address(2);
yays[2] = address(3);
slate = chief.etch(yays);
}
function test() external {
address urn = engine.open(0);
engine.selectVoteDelegate(address(this), 0, address(voteDelegate));
uint256 amt = 100 * 1e18;
engine.lock(address(this), 0, amt, 0);
assertEq(
engine.urnVoteDelegates(urn), address(voteDelegate), "vote delegate"
);
voteDelegate.vote(slate);
}
}