diff --git a/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol b/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol index d1cf94287..1af1a28b4 100644 --- a/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol +++ b/packages/horizon/contracts/data-service/utilities/ProvisionManager.sol @@ -23,6 +23,14 @@ import { ProvisionManagerV1Storage } from "./ProvisionManagerStorage.sol"; abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionManagerV1Storage { using UintRange for uint256; + // Constants + uint32 internal constant DEFAULT_MIN_VERIFIER_CUT = type(uint32).min; + uint32 internal constant DEFAULT_MAX_VERIFIER_CUT = uint32(PPMMath.MAX_PPM); + uint64 internal constant DEFAULT_MIN_THAWING_PERIOD = type(uint64).min; + uint64 internal constant DEFAULT_MAX_THAWING_PERIOD = type(uint64).max; + uint256 internal constant DEFAULT_MIN_PROVISION_TOKENS = type(uint256).min; + uint256 internal constant DEFAULT_MAX_PROVISION_TOKENS = type(uint256).max; + /** * @notice Emitted when the provision tokens range is set. * @param min The minimum allowed value for the provision tokens. @@ -115,9 +123,9 @@ abstract contract ProvisionManager is Initializable, GraphDirectory, ProvisionMa */ // solhint-disable-next-line func-name-mixedcase function __ProvisionManager_init_unchained() internal onlyInitializing { - _setProvisionTokensRange(type(uint256).min, type(uint256).max); - _setVerifierCutRange(type(uint32).min, uint32(PPMMath.MAX_PPM)); - _setThawingPeriodRange(type(uint64).min, type(uint64).max); + _setProvisionTokensRange(DEFAULT_MIN_PROVISION_TOKENS, DEFAULT_MAX_PROVISION_TOKENS); + _setVerifierCutRange(DEFAULT_MIN_VERIFIER_CUT, DEFAULT_MAX_VERIFIER_CUT); + _setThawingPeriodRange(DEFAULT_MIN_THAWING_PERIOD, DEFAULT_MAX_THAWING_PERIOD); } /** diff --git a/packages/subgraph-service/contracts/SubgraphService.sol b/packages/subgraph-service/contracts/SubgraphService.sol index 50adc9913..39b12a4c9 100644 --- a/packages/subgraph-service/contracts/SubgraphService.sol +++ b/packages/subgraph-service/contracts/SubgraphService.sol @@ -372,7 +372,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); } /** @@ -485,7 +485,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); } /** @@ -495,7 +495,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); } /**