@@ -23,13 +23,13 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
23
23
/// @notice The EIP712 typehash for the RecurringCollectionAgreement struct
24
24
bytes32 public constant EIP712_RCA_TYPEHASH =
25
25
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) "
27
27
);
28
28
29
29
/// @notice The EIP712 typehash for the RecurringCollectionAgreementUpgrade struct
30
30
bytes32 public constant EIP712_RCAU_TYPEHASH =
31
31
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) "
33
33
);
34
34
35
35
/// @notice Sentinel value to indicate an agreement has been canceled
@@ -77,11 +77,11 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
77
77
function accept (SignedRCA calldata signedRCA ) external {
78
78
require (
79
79
msg .sender == signedRCA.rca.dataService,
80
- RecurringCollectorCallerNotDataService (msg .sender , signedRCA.rca.dataService)
80
+ RecurringCollectorUnauthorizedCaller (msg .sender , signedRCA.rca.dataService)
81
81
);
82
82
require (
83
- signedRCA.rca.acceptDeadline >= block .timestamp ,
84
- RecurringCollectorAgreementAcceptanceElapsed (signedRCA.rca.acceptDeadline )
83
+ signedRCA.rca.deadline >= block .timestamp ,
84
+ RecurringCollectorAgreementDeadlineElapsed (signedRCA.rca.deadline )
85
85
);
86
86
87
87
// check that the voucher is signed by the payer (or proxy)
@@ -101,7 +101,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
101
101
agreement.maxOngoingTokensPerSecond = signedRCA.rca.maxOngoingTokensPerSecond;
102
102
agreement.minSecondsPerCollection = signedRCA.rca.minSecondsPerCollection;
103
103
agreement.maxSecondsPerCollection = signedRCA.rca.maxSecondsPerCollection;
104
- _requireValidAgreement (agreement, signedRCA.rca.agreementId );
104
+ _requireValidAgreement (agreement);
105
105
106
106
emit AgreementAccepted (
107
107
agreement.dataService,
@@ -147,8 +147,8 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
147
147
*/
148
148
function upgrade (SignedRCAU calldata signedRCAU ) external {
149
149
require (
150
- signedRCAU.rcau.upgradeDeadline >= block .timestamp ,
151
- RecurringCollectorAgreementUpgradeElapsed (signedRCAU.rcau.upgradeDeadline )
150
+ signedRCAU.rcau.deadline >= block .timestamp ,
151
+ RecurringCollectorAgreementDeadlineElapsed (signedRCAU.rcau.deadline )
152
152
);
153
153
154
154
AgreementData storage agreement = _getForUpdateAgreement (signedRCAU.rcau.agreementId);
@@ -167,7 +167,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
167
167
agreement.maxOngoingTokensPerSecond = signedRCAU.rcau.maxOngoingTokensPerSecond;
168
168
agreement.minSecondsPerCollection = signedRCAU.rcau.minSecondsPerCollection;
169
169
agreement.maxSecondsPerCollection = signedRCAU.rcau.maxSecondsPerCollection;
170
- _requireValidAgreement (agreement, signedRCAU.rcau.agreementId );
170
+ _requireValidAgreement (agreement);
171
171
172
172
emit AgreementUpgraded (
173
173
agreement.dataService,
@@ -236,10 +236,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
236
236
*/
237
237
function _collect (CollectParams memory _params ) private returns (uint256 ) {
238
238
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));
243
240
require (
244
241
msg .sender == agreement.dataService,
245
242
RecurringCollectorDataServiceNotAuthorized (_params.agreementId, msg .sender )
@@ -283,36 +280,33 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
283
280
return _params.tokens;
284
281
}
285
282
286
- function _requireValidAgreement (AgreementData memory _agreement , bytes16 _agreementId ) private view {
283
+ function _requireValidAgreement (AgreementData memory _agreement ) private view {
287
284
require (
288
285
_agreement.dataService != address (0 ) &&
289
286
_agreement.payer != address (0 ) &&
290
287
_agreement.serviceProvider != address (0 ),
291
- RecurringCollectorAgreementInvalidParams (_agreementId )
288
+ RecurringCollectorAgreementInvalidParameters ( )
292
289
);
293
290
294
291
// Agreement needs to end in the future
295
- require (_agreementEndsAt (_agreement) > block .timestamp , RecurringCollectorAgreementInvalidParams (_agreementId ));
292
+ require (_agreementEndsAt (_agreement) > block .timestamp , RecurringCollectorAgreementInvalidParameters ( ));
296
293
297
294
// Collection window needs to be at least 2 hours
298
295
require (
299
296
_agreement.maxSecondsPerCollection > _agreement.minSecondsPerCollection &&
300
297
(_agreement.maxSecondsPerCollection - _agreement.minSecondsPerCollection >= 7200 ),
301
- RecurringCollectorAgreementInvalidParams (_agreementId )
298
+ RecurringCollectorAgreementInvalidParameters ( )
302
299
);
303
300
304
301
// Agreement needs to last at least one min collection window
305
302
require (
306
303
_agreement.duration >= _agreement.minSecondsPerCollection + 7200 ,
307
- RecurringCollectorAgreementInvalidParams (_agreementId )
304
+ RecurringCollectorAgreementInvalidParameters ( )
308
305
);
309
306
}
310
307
311
308
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));
316
310
317
311
uint256 agreementEnd = _agreement.duration < type (uint256 ).max - _agreement.acceptedAt
318
312
? _agreement.acceptedAt + _agreement.duration
@@ -367,7 +361,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
367
361
abi.encode (
368
362
EIP712_RCA_TYPEHASH,
369
363
_rca.agreementId,
370
- _rca.acceptDeadline ,
364
+ _rca.deadline ,
371
365
_rca.duration,
372
366
_rca.payer,
373
367
_rca.dataService,
@@ -392,7 +386,7 @@ contract RecurringCollector is EIP712, GraphDirectory, Authorizable, IRecurringC
392
386
abi.encode (
393
387
EIP712_RCAU_TYPEHASH,
394
388
_rcau.agreementId,
395
- _rcau.upgradeDeadline ,
389
+ _rcau.deadline ,
396
390
_rcau.duration,
397
391
_rcau.maxInitialTokens,
398
392
_rcau.maxOngoingTokensPerSecond,
0 commit comments