2
2
3
3
pragma solidity ^ 0.7.6 ;
4
4
5
- import { SafeMathUpgradeable } from "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol " ;
6
-
7
5
import { Governed } from "../governance/Governed.sol " ;
8
6
import { IRewardsManager } from "../rewards/IRewardsManager.sol " ;
9
7
@@ -17,8 +15,6 @@ import { IRewardsManager } from "../rewards/IRewardsManager.sol";
17
15
* Governor can transfer ownership to a new governor.
18
16
*/
19
17
contract SubgraphAvailabilityManager is Governed {
20
- using SafeMathUpgradeable for uint256 ;
21
-
22
18
// -- Immutable --
23
19
24
20
/// @notice Number of oracles
@@ -106,14 +102,11 @@ contract SubgraphAvailabilityManager is Governed {
106
102
) {
107
103
require (_governor != address (0 ), "SAM: governor must be set " );
108
104
require (_rewardsManager != address (0 ), "SAM: rewardsManager must be set " );
109
- require (
110
- _executionThreshold >= NUM_ORACLES.div (2 ).add (1 ),
111
- "SAM: executionThreshold too low "
112
- );
105
+ require (_executionThreshold >= (NUM_ORACLES / 2 ) + 1 , "SAM: executionThreshold too low " );
113
106
require (_executionThreshold <= NUM_ORACLES, "SAM: executionThreshold too high " );
114
107
115
108
// Oracles should not be address zero
116
- for (uint256 i = 0 ; i < _oracles.length ; i++ ) {
109
+ for (uint256 i; i < _oracles.length ; i++ ) {
117
110
address oracle = _oracles[i];
118
111
require (oracle != address (0 ), "SAM: oracle cannot be address zero " );
119
112
oracles[i] = oracle;
@@ -183,7 +176,7 @@ contract SubgraphAvailabilityManager is Governed {
183
176
uint256 _oracleIndex
184
177
) external onlyOracle (_oracleIndex) {
185
178
require (_subgraphDeploymentID.length == _deny.length , "!length " );
186
- for (uint256 i = 0 ; i < _subgraphDeploymentID.length ; i++ ) {
179
+ for (uint256 i; i < _subgraphDeploymentID.length ; i++ ) {
187
180
_vote (_subgraphDeploymentID[i], _deny[i], _oracleIndex);
188
181
}
189
182
}
@@ -226,7 +219,7 @@ contract SubgraphAvailabilityManager is Governed {
226
219
* @return True if execution threshold is reached
227
220
*/
228
221
function checkVotes (bytes32 _subgraphDeploymentID , bool _deny ) public view returns (bool ) {
229
- uint256 votes = 0 ;
222
+ uint256 votes;
230
223
231
224
// timeframe for a vote to be valid
232
225
uint256 voteTimeValidity = block .timestamp - voteTimeLimit;
@@ -236,7 +229,7 @@ contract SubgraphAvailabilityManager is Governed {
236
229
? lastDenyVote[currentNonce][_subgraphDeploymentID]
237
230
: lastAllowVote[currentNonce][_subgraphDeploymentID];
238
231
239
- for (uint256 i = 0 ; i < NUM_ORACLES; i++ ) {
232
+ for (uint256 i; i < NUM_ORACLES; i++ ) {
240
233
// check if vote is within the vote time limit
241
234
if (lastVoteForSubgraph[i] > voteTimeValidity) {
242
235
votes++ ;
0 commit comments