@@ -23,13 +23,13 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
2323 /// @notice The EIP712 typehash for the RecurringCollectionAgreement struct
2424 bytes32 public constant EIP712_RCA_TYPEHASH =
2525 keccak256 (
26- "RecurringCollectionAgreement(bytes16 agreementId,uint256 acceptDeadline ,uint256 duration,address payer,address dataService,address serviceProvider,uint256 maxInitialTokens,uint256 maxOngoingTokensPerSecond,uint32 minSecondsPerCollection,uint32 maxSecondsPerCollection,bytes metadata) "
26+ "RecurringCollectionAgreement(bytes16 agreementId,uint256 deadline ,uint256 duration,address payer,address dataService,address serviceProvider,uint256 maxInitialTokens,uint256 maxOngoingTokensPerSecond,uint32 minSecondsPerCollection,uint32 maxSecondsPerCollection,bytes metadata) "
2727 );
2828
2929 /// @notice The EIP712 typehash for the RecurringCollectionAgreementUpgrade struct
3030 bytes32 public constant EIP712_RCAU_TYPEHASH =
3131 keccak256 (
32- "RecurringCollectionAgreementUpgrade(bytes16 agreementId,uint256 upgradeDeadline ,uint256 duration,uint256 maxInitialTokens,uint256 maxOngoingTokensPerSecond,uint32 minSecondsPerCollection,uint32 maxSecondsPerCollection,bytes metadata) "
32+ "RecurringCollectionAgreementUpgrade(bytes16 agreementId,uint256 deadline ,uint256 duration,uint256 maxInitialTokens,uint256 maxOngoingTokensPerSecond,uint32 minSecondsPerCollection,uint32 maxSecondsPerCollection,bytes metadata) "
3333 );
3434
3535 /// @notice Sentinel value to indicate an agreement has been canceled
@@ -77,11 +77,11 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
7777 function accept (SignedRCA calldata signedRCA ) external {
7878 require (
7979 msg .sender == signedRCA.rca.dataService,
80- RecurringCollectorCallerNotDataService (msg .sender , signedRCA.rca.dataService)
80+ RecurringCollectorUnauthorizedCaller (msg .sender , signedRCA.rca.dataService)
8181 );
8282 require (
83- signedRCA.rca.acceptDeadline >= block .timestamp ,
84- RecurringCollectorAgreementAcceptanceElapsed (signedRCA.rca.acceptDeadline )
83+ signedRCA.rca.deadline >= block .timestamp ,
84+ RecurringCollectorAgreementDeadlineElapsed (signedRCA.rca.deadline )
8585 );
8686
8787 // check that the voucher is signed by the payer (or proxy)
@@ -101,7 +101,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
101101 agreement.maxOngoingTokensPerSecond = signedRCA.rca.maxOngoingTokensPerSecond;
102102 agreement.minSecondsPerCollection = signedRCA.rca.minSecondsPerCollection;
103103 agreement.maxSecondsPerCollection = signedRCA.rca.maxSecondsPerCollection;
104- _requireValidAgreement (agreement, signedRCA.rca.agreementId );
104+ _requireValidAgreement (agreement);
105105
106106 emit AgreementAccepted (
107107 agreement.dataService,
@@ -147,8 +147,8 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
147147 */
148148 function upgrade (SignedRCAU calldata signedRCAU ) external {
149149 require (
150- signedRCAU.rcau.upgradeDeadline >= block .timestamp ,
151- RecurringCollectorAgreementUpgradeElapsed (signedRCAU.rcau.upgradeDeadline )
150+ signedRCAU.rcau.deadline >= block .timestamp ,
151+ RecurringCollectorAgreementDeadlineElapsed (signedRCAU.rcau.deadline )
152152 );
153153
154154 AgreementData storage agreement = _getForUpdateAgreement (signedRCAU.rcau.agreementId);
@@ -167,7 +167,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
167167 agreement.maxOngoingTokensPerSecond = signedRCAU.rcau.maxOngoingTokensPerSecond;
168168 agreement.minSecondsPerCollection = signedRCAU.rcau.minSecondsPerCollection;
169169 agreement.maxSecondsPerCollection = signedRCAU.rcau.maxSecondsPerCollection;
170- _requireValidAgreement (agreement, signedRCAU.rcau.agreementId );
170+ _requireValidAgreement (agreement);
171171
172172 emit AgreementUpgraded (
173173 agreement.dataService,
@@ -236,10 +236,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
236236 */
237237 function _collect (CollectParams memory _params ) private returns (uint256 ) {
238238 AgreementData storage agreement = _getForUpdateAgreement (_params.agreementId);
239- require (
240- agreement.acceptedAt > 0 ,
241- RecurringCollectorAgreementInvalid (_params.agreementId, agreement.acceptedAt)
242- );
239+ require (agreement.acceptedAt > 0 , RecurringCollectorAgreementNeverAccepted (_params.agreementId));
243240 require (
244241 msg .sender == agreement.dataService,
245242 RecurringCollectorDataServiceNotAuthorized (_params.agreementId, msg .sender )
@@ -283,36 +280,33 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
283280 return _params.tokens;
284281 }
285282
286- function _requireValidAgreement (AgreementData memory _agreement , bytes16 _agreementId ) private view {
283+ function _requireValidAgreement (AgreementData memory _agreement ) private view {
287284 require (
288285 _agreement.dataService != address (0 ) &&
289286 _agreement.payer != address (0 ) &&
290287 _agreement.serviceProvider != address (0 ),
291- RecurringCollectorAgreementInvalidParams (_agreementId )
288+ RecurringCollectorAgreementInvalidParameters ( )
292289 );
293290
294291 // Agreement needs to end in the future
295- require (_agreementEndsAt (_agreement) > block .timestamp , RecurringCollectorAgreementInvalidParams (_agreementId ));
292+ require (_agreementEndsAt (_agreement) > block .timestamp , RecurringCollectorAgreementInvalidParameters ( ));
296293
297294 // Collection window needs to be at least 2 hours
298295 require (
299296 _agreement.maxSecondsPerCollection > _agreement.minSecondsPerCollection &&
300297 (_agreement.maxSecondsPerCollection - _agreement.minSecondsPerCollection >= 7200 ),
301- RecurringCollectorAgreementInvalidParams (_agreementId )
298+ RecurringCollectorAgreementInvalidParameters ( )
302299 );
303300
304301 // Agreement needs to last at least one min collection window
305302 require (
306303 _agreement.duration >= _agreement.minSecondsPerCollection + 7200 ,
307- RecurringCollectorAgreementInvalidParams (_agreementId )
304+ RecurringCollectorAgreementInvalidParameters ( )
308305 );
309306 }
310307
311308 function _requireCollectableAgreement (AgreementData memory _agreement , bytes16 _agreementId ) private view {
312- require (
313- _agreement.acceptedAt > 0 && _agreement.acceptedAt != CANCELED,
314- RecurringCollectorAgreementInvalid (_agreementId, _agreement.acceptedAt)
315- );
309+ require (_agreement.acceptedAt != CANCELED, RecurringCollectorAgreementCanceled (_agreementId));
316310
317311 uint256 agreementEnd = _agreement.duration < type (uint256 ).max - _agreement.acceptedAt
318312 ? _agreement.acceptedAt + _agreement.duration
@@ -367,7 +361,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
367361 abi.encode (
368362 EIP712_RCA_TYPEHASH,
369363 _rca.agreementId,
370- _rca.acceptDeadline ,
364+ _rca.deadline ,
371365 _rca.duration,
372366 _rca.payer,
373367 _rca.dataService,
@@ -392,7 +386,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
392386 abi.encode (
393387 EIP712_RCAU_TYPEHASH,
394388 _rcau.agreementId,
395- _rcau.upgradeDeadline ,
389+ _rcau.deadline ,
396390 _rcau.duration,
397391 _rcau.maxInitialTokens,
398392 _rcau.maxOngoingTokensPerSecond,
0 commit comments