Skip to content

Commit

Permalink
fix: use new constants in subgraphservice.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBoi9001 committed Sep 30, 2024
1 parent 8912125 commit 2729a37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa

// Constants
uint32 private constant DEFAULT_MIN_VERIFIER_CUT = type(uint32).min;
uint32 private constant DEFAULT_MAX_VERIFIER_CUT = uint32(PPMMath.MAX_PPM);
uint32 internal constant DEFAULT_MAX_VERIFIER_CUT = uint32(PPMMath.MAX_PPM);
uint64 private constant DEFAULT_MIN_THAWING_PERIOD = type(uint64).min;
uint64 private constant DEFAULT_MAX_THAWING_PERIOD = type(uint64).max;
uint64 internal constant DEFAULT_MAX_THAWING_PERIOD = type(uint64).max;
uint256 private constant DEFAULT_MIN_PROVISION_TOKENS = type(uint256).min;
uint256 private constant DEFAULT_MAX_PROVISION_TOKENS = type(uint256).max;
uint256 internal constant DEFAULT_MAX_PROVISION_TOKENS = type(uint256).max;

/**
* @notice Emitted when the provision tokens range is set.
Expand Down
11 changes: 8 additions & 3 deletions packages/subgraph-service/contracts/SubgraphService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ import { PPMMath } from "@graphprotocol/horizon/contracts/libraries/PPMMath.sol"
import { Allocation } from "./libraries/Allocation.sol";
import { LegacyAllocation } from "./libraries/LegacyAllocation.sol";

import { ProvisionManager } from "@graphprotocol/horizon/contracts/data-service/utilities/ProvisionManager.sol";



contract SubgraphService is
Initializable,
OwnableUpgradeable,
ProvisionManager,
DataService,
DataServicePausableUpgradeable,
DataServiceFees,
Expand Down Expand Up @@ -359,7 +364,7 @@ contract SubgraphService is
* @notice See {ISubgraphService.setMinimumProvisionTokens}
*/
function setMinimumProvisionTokens(uint256 minimumProvisionTokens) external override onlyOwner {
_setProvisionTokensRange(minimumProvisionTokens, type(uint256).max);
_setProvisionTokensRange(minimumProvisionTokens, DEFAULT_MAX_PROVISION_TOKENS);
}

/**
Expand Down Expand Up @@ -473,7 +478,7 @@ contract SubgraphService is
*/
function _getThawingPeriodRange() internal view override returns (uint64 min, uint64 max) {
uint64 disputePeriod = _disputeManager().getDisputePeriod();
return (disputePeriod, type(uint64).max);
return (disputePeriod, DEFAULT_MAX_THAWING_PERIOD);
}

/**
Expand All @@ -483,7 +488,7 @@ contract SubgraphService is
*/
function _getVerifierCutRange() internal view override returns (uint32 min, uint32 max) {
uint32 verifierCut = _disputeManager().getVerifierCut();
return (verifierCut, uint32(PPMMath.MAX_PPM));
return (verifierCut, DEFAULT_MAX_VERIFIER_CUT);
}

/**
Expand Down

0 comments on commit 2729a37

Please sign in to comment.