Skip to content

Commit 3639241

Browse files
authored
Merge pull request #1256 from graphprotocol/rewards-eligibility-oracle-4
Rewards Eligibility Oracle (REO) (rebased)
2 parents 3d274a4 + ff2f00a commit 3639241

File tree

11 files changed

+1762
-0
lines changed

11 files changed

+1762
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
pragma solidity ^0.7.6 || ^0.8.0;
4+
5+
import { IRewardsEligibilityEvents } from "./IRewardsEligibilityEvents.sol";
6+
7+
/**
8+
* @title IRewardsEligibilityAdministration
9+
* @author Edge & Node
10+
* @notice Interface for administrative operations on rewards eligibility
11+
* @dev Functions in this interface are restricted to accounts with OPERATOR_ROLE
12+
*/
13+
interface IRewardsEligibilityAdministration is IRewardsEligibilityEvents {
14+
/**
15+
* @notice Set the eligibility period for indexers
16+
* @dev Only callable by accounts with the OPERATOR_ROLE
17+
* @param eligibilityPeriod New eligibility period in seconds
18+
* @return True if the state is as requested (eligibility period is set to the specified value)
19+
*/
20+
function setEligibilityPeriod(uint256 eligibilityPeriod) external returns (bool);
21+
22+
/**
23+
* @notice Set the oracle update timeout
24+
* @dev Only callable by accounts with the OPERATOR_ROLE
25+
* @param oracleUpdateTimeout New timeout period in seconds
26+
* @return True if the state is as requested (timeout is set to the specified value)
27+
*/
28+
function setOracleUpdateTimeout(uint256 oracleUpdateTimeout) external returns (bool);
29+
30+
/**
31+
* @notice Set eligibility validation state
32+
* @dev Only callable by accounts with the OPERATOR_ROLE
33+
* @param enabled True to enable eligibility validation, false to disable
34+
* @return True if successfully set (always the case for current code)
35+
*/
36+
function setEligibilityValidation(bool enabled) external returns (bool);
37+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
pragma solidity ^0.7.6 || ^0.8.0;
4+
5+
/**
6+
* @title IRewardsEligibilityEvents
7+
* @author Edge & Node
8+
* @notice Shared events for rewards eligibility interfaces
9+
*/
10+
interface IRewardsEligibilityEvents {
11+
/// @notice Emitted when an oracle submits eligibility data
12+
/// @param oracle The address of the oracle that submitted the data
13+
/// @param data The eligibility data submitted by the oracle
14+
event IndexerEligibilityData(address indexed oracle, bytes data);
15+
16+
/// @notice Emitted when an indexer's eligibility is renewed by an oracle
17+
/// @param indexer The address of the indexer whose eligibility was renewed
18+
/// @param oracle The address of the oracle that renewed the indexer's eligibility
19+
event IndexerEligibilityRenewed(address indexed indexer, address indexed oracle);
20+
21+
/// @notice Emitted when the eligibility period is updated
22+
/// @param oldPeriod The previous eligibility period in seconds
23+
/// @param newPeriod The new eligibility period in seconds
24+
event EligibilityPeriodUpdated(uint256 indexed oldPeriod, uint256 indexed newPeriod);
25+
26+
/// @notice Emitted when eligibility validation is enabled or disabled
27+
/// @param enabled True if eligibility validation is enabled, false if disabled
28+
event EligibilityValidationUpdated(bool indexed enabled);
29+
30+
/// @notice Emitted when the oracle update timeout is updated
31+
/// @param oldTimeout The previous timeout period in seconds
32+
/// @param newTimeout The new timeout period in seconds
33+
event OracleUpdateTimeoutUpdated(uint256 indexed oldTimeout, uint256 indexed newTimeout);
34+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
pragma solidity ^0.7.6 || ^0.8.0;
4+
5+
import { IRewardsEligibilityEvents } from "./IRewardsEligibilityEvents.sol";
6+
7+
/**
8+
* @title IRewardsEligibilityReporting
9+
* @author Edge & Node
10+
* @notice Interface for oracle reporting of indexer eligibility
11+
* @dev Functions in this interface are restricted to accounts with ORACLE_ROLE
12+
*/
13+
interface IRewardsEligibilityReporting is IRewardsEligibilityEvents {
14+
/**
15+
* @notice Renew eligibility for provided indexers to receive rewards
16+
* @param indexers Array of indexer addresses. Zero addresses are ignored.
17+
* @param data Arbitrary calldata for future extensions
18+
* @return Number of indexers whose eligibility renewal timestamp was updated
19+
*/
20+
function renewIndexerEligibility(address[] calldata indexers, bytes calldata data) external returns (uint256);
21+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
pragma solidity ^0.7.6 || ^0.8.0;
4+
5+
/**
6+
* @title IRewardsEligibilityStatus
7+
* @author Edge & Node
8+
* @notice Interface for querying rewards eligibility status and configuration
9+
* @dev All functions are view-only and can be called by anyone
10+
*/
11+
interface IRewardsEligibilityStatus {
12+
/**
13+
* @notice Get the last eligibility renewal timestamp for an indexer
14+
* @param indexer Address of the indexer
15+
* @return The last eligibility renewal timestamp, or 0 if the indexer's eligibility has never been renewed
16+
*/
17+
function getEligibilityRenewalTime(address indexer) external view returns (uint256);
18+
19+
/**
20+
* @notice Get the eligibility period
21+
* @return The current eligibility period in seconds
22+
*/
23+
function getEligibilityPeriod() external view returns (uint256);
24+
25+
/**
26+
* @notice Get the oracle update timeout
27+
* @return The current oracle update timeout in seconds
28+
*/
29+
function getOracleUpdateTimeout() external view returns (uint256);
30+
31+
/**
32+
* @notice Get the last oracle update time
33+
* @return The timestamp of the last oracle update
34+
*/
35+
function getLastOracleUpdateTime() external view returns (uint256);
36+
37+
/**
38+
* @notice Get eligibility validation state
39+
* @return True if eligibility validation is enabled, false otherwise
40+
*/
41+
function getEligibilityValidation() external view returns (bool);
42+
}

0 commit comments

Comments
 (0)