Skip to content

Commit ac103d7

Browse files
committed
fix: contracts changes
Signed-off-by: Tomás Migone <[email protected]>
1 parent 1d2b76d commit ac103d7

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

packages/contracts/contracts/rewards/RewardsManager.sol

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ import { IRewardsManager } from "@graphprotocol/interfaces/contracts/contracts/r
2121
* @title Rewards Manager Contract
2222
* @author Edge & Node
2323
* @notice Manages rewards distribution for indexers and delegators in the Graph Protocol
24-
* @dev Tracks how inflationary GRT rewards should be handed out. Relies on the Curation contract
25-
* and the Staking contract. Signaled GRT in Curation determine what percentage of the tokens go
26-
* towards each subgraph. Then each Subgraph can have multiple Indexers Staked on it. Thus, the
27-
* total rewards for the Subgraph are split up for each Indexer based on much they have Staked on
28-
* that Subgraph.
24+
* @dev Tracks how inflationary GRT rewards should be handed out. Signaled GRT in Curation determine
25+
* what percentage of the tokens go towards each subgraph. Then each Subgraph can have multiple
26+
* Indexers Staked on it. Thus, the total rewards for the Subgraph are split up for each Indexer based
27+
* on much they have Staked on that Subgraph.
2928
*
3029
* Note:
3130
* The contract provides getter functions to query the state of accrued rewards:
@@ -249,11 +248,8 @@ contract RewardsManager is RewardsManagerV5Storage, GraphUpgradeable, IRewardsMa
249248
subgraph.accRewardsForSubgraphSnapshot
250249
);
251250

252-
// There are two contributors to subgraph allocated tokens:
253-
// - the legacy allocations on the legacy staking contract
254-
// - the new allocations on the subgraph service
255251
uint256 subgraphAllocatedTokens = 0;
256-
address[2] memory rewardsIssuers = [address(staking()), address(subgraphService)];
252+
address[1] memory rewardsIssuers = [address(subgraphService)];
257253
for (uint256 i = 0; i < rewardsIssuers.length; i++) {
258254
if (rewardsIssuers[i] != address(0)) {
259255
subgraphAllocatedTokens += IRewardsIssuer(rewardsIssuers[i]).getSubgraphAllocatedTokens(
@@ -303,7 +299,7 @@ contract RewardsManager is RewardsManagerV5Storage, GraphUpgradeable, IRewardsMa
303299

304300
/**
305301
* @inheritdoc IRewardsManager
306-
* @dev Hook called from the Staking contract on allocate() and close()
302+
* @dev Hook called from the IRewardsIssuer contract on allocate() and close()
307303
*/
308304
function onSubgraphAllocationUpdate(bytes32 _subgraphDeploymentID) public override returns (uint256) {
309305
Subgraph storage subgraph = subgraphs[_subgraphDeploymentID];
@@ -317,10 +313,7 @@ contract RewardsManager is RewardsManagerV5Storage, GraphUpgradeable, IRewardsMa
317313

318314
/// @inheritdoc IRewardsManager
319315
function getRewards(address _rewardsIssuer, address _allocationID) external view override returns (uint256) {
320-
require(
321-
_rewardsIssuer == address(staking()) || _rewardsIssuer == address(subgraphService),
322-
"Not a rewards issuer"
323-
);
316+
require(_rewardsIssuer == address(subgraphService), "Not a rewards issuer");
324317

325318
(
326319
bool isActive,
@@ -372,15 +365,12 @@ contract RewardsManager is RewardsManagerV5Storage, GraphUpgradeable, IRewardsMa
372365
/**
373366
* @inheritdoc IRewardsManager
374367
* @dev This function can only be called by an authorized rewards issuer which are
375-
* the staking contract (for legacy allocations), and the subgraph service (for new allocations).
368+
* - the subgraph service (for new allocations).
376369
* Mints 0 tokens if the allocation is not active.
377370
*/
378371
function takeRewards(address _allocationID) external override returns (uint256) {
379372
address rewardsIssuer = msg.sender;
380-
require(
381-
rewardsIssuer == address(staking()) || rewardsIssuer == address(subgraphService),
382-
"Caller must be a rewards issuer"
383-
);
373+
require(rewardsIssuer == address(subgraphService), "Caller must be a rewards issuer");
384374

385375
(
386376
bool isActive,

packages/horizon/test/unit/shared/horizon-staking/HorizonStakingShared.t.sol

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,7 @@ abstract contract HorizonStakingSharedTest is GraphBaseTest {
205205
assertEq(afterStakingBalance, beforeStakingBalance - _tokens);
206206
assertEq(afterServiceProvider.tokensStaked, beforeServiceProvider.tokensStaked - _tokens);
207207
assertEq(afterServiceProvider.tokensProvisioned, beforeServiceProvider.tokensProvisioned);
208-
assertEq(
209-
afterServiceProvider.__DEPRECATED_tokensAllocated,
210-
beforeServiceProvider.__DEPRECATED_tokensAllocated
211-
);
208+
assertEq(afterServiceProvider.__DEPRECATED_tokensAllocated, beforeServiceProvider.__DEPRECATED_tokensAllocated);
212209
assertEq(afterServiceProvider.__DEPRECATED_tokensLocked, beforeServiceProvider.__DEPRECATED_tokensLocked);
213210
assertEq(
214211
afterServiceProvider.__DEPRECATED_tokensLockedUntil,

0 commit comments

Comments
 (0)