-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathTestGovernance.sol
More file actions
56 lines (45 loc) · 1.45 KB
/
TestGovernance.sol
File metadata and controls
56 lines (45 loc) · 1.45 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
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.11;
import {
ISuperfluid,
ISuperfluidToken
} from "../interfaces/superfluid/ISuperfluid.sol";
import { SuperfluidGovernanceBase } from "../gov/SuperfluidGovernanceBase.sol";
import { Ownable } from "@openzeppelin-v5/contracts/access/Ownable.sol";
/**
* @title Test governance contract
* @author Superfluid
* @dev A initializable version of the governance for testing purpose
*/
contract TestGovernance is
Ownable,
SuperfluidGovernanceBase
{
ISuperfluid private _host;
constructor() Ownable(_msgSender()) {}
function initialize(
ISuperfluid host,
address rewardAddress,
uint256 liquidationPeriod,
uint256 patricianPeriod,
address[] calldata trustedForwarders
)
external
{
// can initialize only once
assert(address(host) != address(0));
assert(address(_host) == address(0));
_host = host;
setRewardAddress(_host, ISuperfluidToken(address(0)), rewardAddress);
setPPPConfig(host, ISuperfluidToken(address(0)), liquidationPeriod, patricianPeriod);
for (uint i = 0; i < trustedForwarders.length; ++i) {
enableTrustedForwarder(_host, ISuperfluidToken(address(0)), trustedForwarders[i]);
}
}
function _requireAuthorised(ISuperfluid host)
internal view override
{
assert(host == _host);
assert(owner() == _msgSender());
}
}