-
Notifications
You must be signed in to change notification settings - Fork 3
/
GaugePlugin.sol
85 lines (71 loc) · 2.53 KB
/
GaugePlugin.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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "contracts/interfaces/IGaugePlugin.sol";
import "openzeppelin-contracts/contracts/access/Ownable.sol";
contract GaugePlugin is IGaugePlugin, Ownable {
address public governor; // credibly neutral party similar to Curve's Emergency DAO
mapping(address => bool) public isWhitelistedForGaugeCreation; // token => whitelist for permissionless gauge creation
constructor(address flow, address weth, address _governor) {
governor = _governor;
isWhitelistedForGaugeCreation[flow] = true;
isWhitelistedForGaugeCreation[weth] = true;
}
event WhitelistedForGaugeCreation(
address indexed whitelister,
address indexed token
);
event BlacklistedForGaugeCreation(
address indexed blacklister,
address indexed token
);
event GovernorSet(address indexed _newGovernor);
function setGovernor(address _governor) public onlyOwner {
governor = _governor;
emit GovernorSet(_governor);
}
function whitelistForGaugeCreation(address _token) public {
require(msg.sender == governor);
_whitelistForGaugeCreation(_token);
}
function _whitelistForGaugeCreation(address _token) internal {
require(!isWhitelistedForGaugeCreation[_token]);
isWhitelistedForGaugeCreation[_token] = true;
emit WhitelistedForGaugeCreation(msg.sender, _token);
}
function blacklistForGaugeCreation(address _token) public {
require(msg.sender == governor);
_blacklistForGaugeCreation(_token);
}
function _blacklistForGaugeCreation(address _token) internal {
require(isWhitelistedForGaugeCreation[_token]);
isWhitelistedForGaugeCreation[_token] = false;
emit BlacklistedForGaugeCreation(msg.sender, _token);
}
function checkGaugeCreationAllowance(
address caller,
address tokenA,
address tokenB
) external view returns (bool) {
return
isWhitelistedForGaugeCreation[tokenA] ||
isWhitelistedForGaugeCreation[tokenB];
}
function checkGaugePauseAllowance(
address caller,
address gauge
) external view returns (bool) {
return false;
}
function checkGaugeRestartAllowance(
address caller,
address gauge
) external view returns (bool) {
return false;
}
function checkGaugeKillAllowance(
address caller,
address gauge
) external view returns (bool) {
return false;
}
}