@@ -4,6 +4,7 @@ import "@openzeppelin/contracts/math/SafeMath.sol";
4
4
5
5
import "../governance/Governed.sol " ;
6
6
import "../upgrades/GraphProxy.sol " ;
7
+ import "../upgrades/GraphUpgradeable.sol " ;
7
8
8
9
import "./CurationStorage.sol " ;
9
10
import "./ICuration.sol " ;
@@ -20,7 +21,7 @@ import "./ICuration.sol";
20
21
* Holders can burn GST tokens using this contract to get GRT tokens back according to the
21
22
* bonding curve.
22
23
*/
23
- contract Curation is CurationV1Storage , ICuration , Governed {
24
+ contract Curation is CurationV1Storage , GraphUpgradeable , ICuration , Governed {
24
25
using SafeMath for uint256 ;
25
26
26
27
// 100% in parts per million
@@ -61,23 +62,18 @@ contract Curation is CurationV1Storage, ICuration, Governed {
61
62
*/
62
63
event Collected (bytes32 indexed subgraphDeploymentID , uint256 tokens );
63
64
64
- /**
65
- * @dev Check if the caller is the governor or initializing the implementation.
66
- */
67
- modifier onlyGovernorOrInit {
68
- require (msg .sender == governor || msg .sender == implementation, "Only Governor can call " );
69
- _;
70
- }
71
-
72
65
/**
73
66
* @dev Initialize this contract.
74
67
*/
75
68
function initialize (
69
+ address _governor ,
76
70
address _token ,
77
71
uint32 _defaultReserveRatio ,
78
72
uint256 _minimumCurationStake
79
- ) external onlyGovernorOrInit {
73
+ ) external onlyImpl {
74
+ Governed._initialize (_governor);
80
75
BancorFormula._initialize ();
76
+
81
77
token = IGraphToken (_token);
82
78
defaultReserveRatio = _defaultReserveRatio;
83
79
minimumCurationStake = _minimumCurationStake;
@@ -96,21 +92,24 @@ contract Curation is CurationV1Storage, ICuration, Governed {
96
92
uint32 _defaultReserveRatio ,
97
93
uint256 _minimumCurationStake
98
94
) external {
99
- require (msg .sender == _proxy.governor (), "Only proxy governor can upgrade " );
100
-
101
95
// Accept to be the implementation for this proxy
102
- _proxy. acceptImplementation ( );
96
+ _acceptUpgrade (_proxy );
103
97
104
98
// Initialization
105
- Curation (address (_proxy)).initialize (_token, _defaultReserveRatio, _minimumCurationStake);
99
+ Curation (address (_proxy)).initialize (
100
+ _proxy.admin (), // default governor is proxy admin
101
+ _token,
102
+ _defaultReserveRatio,
103
+ _minimumCurationStake
104
+ );
106
105
}
107
106
108
107
/**
109
108
* @dev Set the staking contract used for fees distribution.
110
109
* @notice Update the staking contract to `_staking`
111
110
* @param _staking Address of the staking contract
112
111
*/
113
- function setStaking (address _staking ) external override onlyGovernorOrInit {
112
+ function setStaking (address _staking ) external override onlyGovernor {
114
113
staking = IStaking (_staking);
115
114
emit ParameterUpdated ("staking " );
116
115
}
@@ -120,11 +119,7 @@ contract Curation is CurationV1Storage, ICuration, Governed {
120
119
* @notice Update the default reserver ratio to `_defaultReserveRatio`
121
120
* @param _defaultReserveRatio Reserve ratio (in PPM)
122
121
*/
123
- function setDefaultReserveRatio (uint32 _defaultReserveRatio )
124
- external
125
- override
126
- onlyGovernorOrInit
127
- {
122
+ function setDefaultReserveRatio (uint32 _defaultReserveRatio ) external override onlyGovernor {
128
123
// Reserve Ratio must be within 0% to 100% (exclusive, in PPM)
129
124
require (_defaultReserveRatio > 0 , "Default reserve ratio must be > 0 " );
130
125
require (
@@ -141,11 +136,7 @@ contract Curation is CurationV1Storage, ICuration, Governed {
141
136
* @notice Update the minimum stake amount to `_minimumCurationStake`
142
137
* @param _minimumCurationStake Minimum amount of tokens required stake
143
138
*/
144
- function setMinimumCurationStake (uint256 _minimumCurationStake )
145
- external
146
- override
147
- onlyGovernorOrInit
148
- {
139
+ function setMinimumCurationStake (uint256 _minimumCurationStake ) external override onlyGovernor {
149
140
require (_minimumCurationStake > 0 , "Minimum curation stake cannot be 0 " );
150
141
minimumCurationStake = _minimumCurationStake;
151
142
emit ParameterUpdated ("minimumCurationStake " );
@@ -155,7 +146,7 @@ contract Curation is CurationV1Storage, ICuration, Governed {
155
146
* @dev Set the fee percentage to charge when a curator withdraws stake.
156
147
* @param _percentage Percentage fee charged when withdrawing stake
157
148
*/
158
- function setWithdrawalFeePercentage (uint32 _percentage ) external override onlyGovernorOrInit {
149
+ function setWithdrawalFeePercentage (uint32 _percentage ) external override onlyGovernor {
159
150
// Must be within 0% to 100% (inclusive)
160
151
require (
161
152
_percentage <= MAX_PPM,
0 commit comments