@@ -13,88 +13,114 @@ import { IAuthorizable } from "./IAuthorizable.sol";
13
13
* recurrent payments.
14
14
*/
15
15
interface IRecurringCollector is IAuthorizable , IPaymentsCollector {
16
- // @notice The state of an agreement
16
+ /// @notice The state of an agreement
17
17
enum AgreementState {
18
18
NotAccepted,
19
19
Accepted,
20
20
CanceledByServiceProvider,
21
21
CanceledByPayer
22
22
}
23
23
24
- // @notice The party that can cancel an agreement
24
+ /// @notice The party that can cancel an agreement
25
25
enum CancelAgreementBy {
26
26
ServiceProvider,
27
27
Payer,
28
28
ThirdParty
29
29
}
30
30
31
- /// @notice A representation of a signed Recurring Collection Agreement (RCA)
31
+ /**
32
+ * @notice A representation of a signed Recurring Collection Agreement (RCA)
33
+ * @param rca The Recurring Collection Agreement to be signed
34
+ * @param signature The signature of the RCA - 65 bytes: r (32 Bytes) || s (32 Bytes) || v (1 Byte)
35
+ */
32
36
struct SignedRCA {
33
- // The RCA
34
37
RecurringCollectionAgreement rca;
35
- // Signature - 65 bytes: r (32 Bytes) || s (32 Bytes) || v (1 Byte)
36
38
bytes signature;
37
39
}
38
40
39
- /// @notice The Recurring Collection Agreement (RCA)
41
+ /**
42
+ * @notice The Recurring Collection Agreement (RCA)
43
+ * @param agreementId The agreement ID of the RCA
44
+ * @param deadline The deadline for accepting the RCA
45
+ * @param endsAt The timestamp when the agreement ends
46
+ * @param payer The address of the payer the RCA was issued by
47
+ * @param dataService The address of the data service the RCA was issued to
48
+ * @param serviceProvider The address of the service provider the RCA was issued to
49
+ * @param maxInitialTokens The maximum amount of tokens that can be collected in the first collection
50
+ * on top of the amount allowed for subsequent collections
51
+ * @param maxOngoingTokensPerSecond The maximum amount of tokens that can be collected per second
52
+ * except for the first collection
53
+ * @param minSecondsPerCollection The minimum amount of seconds that must pass between collections
54
+ * @param maxSecondsPerCollection The maximum amount of seconds that can pass between collections
55
+ * @param metadata Arbitrary metadata to extend functionality if a data service requires it
56
+ *
57
+ */
40
58
struct RecurringCollectionAgreement {
41
- // The agreement ID of the RCA
42
59
bytes16 agreementId;
43
- // The deadline for accepting the RCA
44
60
uint64 deadline;
45
- // The timestamp when the agreement ends
46
61
uint64 endsAt;
47
- // The address of the payer the RCA was issued by
48
62
address payer;
49
- // The address of the data service the RCA was issued to
50
63
address dataService;
51
- // The address of the service provider the RCA was issued to
52
64
address serviceProvider;
53
- // The maximum amount of tokens that can be collected in the first collection
54
- // on top of the amount allowed for subsequent collections
55
65
uint256 maxInitialTokens;
56
- // The maximum amount of tokens that can be collected per second
57
- // except for the first collection
58
66
uint256 maxOngoingTokensPerSecond;
59
- // The minimum amount of seconds that must pass between collections
60
67
uint32 minSecondsPerCollection;
61
- // The maximum amount of seconds that can pass between collections
62
68
uint32 maxSecondsPerCollection;
63
- // Arbitrary metadata to extend functionality if a data service requires it
64
69
bytes metadata;
65
70
}
66
71
67
- /// @notice A representation of a signed Recurring Collection Agreement Update (RCAU)
72
+ /**
73
+ * @notice A representation of a signed Recurring Collection Agreement Update (RCAU)
74
+ * @param rcau The Recurring Collection Agreement Update to be signed
75
+ * @param signature The signature of the RCAU - 65 bytes: r (32 Bytes) || s (32 Bytes) || v (1 Byte)
76
+ */
68
77
struct SignedRCAU {
69
- // The RCAU
70
78
RecurringCollectionAgreementUpdate rcau;
71
- // Signature - 65 bytes: r (32 Bytes) || s (32 Bytes) || v (1 Byte)
72
79
bytes signature;
73
80
}
74
81
75
- /// @notice The Recurring Collection Agreement Update (RCAU)
82
+ /**
83
+ * @notice The Recurring Collection Agreement Update (RCAU)
84
+ * @param agreementId The agreement ID of the RCAU
85
+ * @param deadline The deadline for upgrading the RCA
86
+ * @param endsAt The timestamp when the agreement ends
87
+ * @param maxInitialTokens The maximum amount of tokens that can be collected in the first collection
88
+ * on top of the amount allowed for subsequent collections
89
+ * @param maxOngoingTokensPerSecond The maximum amount of tokens that can be collected per second
90
+ * except for the first collection
91
+ * @param minSecondsPerCollection The minimum amount of seconds that must pass between collections
92
+ * @param maxSecondsPerCollection The maximum amount of seconds that can pass between collections
93
+ * @param metadata Arbitrary metadata to extend functionality if a data service requires it
94
+ */
76
95
struct RecurringCollectionAgreementUpdate {
77
- // The agreement ID
78
96
bytes16 agreementId;
79
- // The deadline for upgrading
80
97
uint64 deadline;
81
- // The timestamp when the agreement ends
82
98
uint64 endsAt;
83
- // The maximum amount of tokens that can be collected in the first collection
84
- // on top of the amount allowed for subsequent collections
85
99
uint256 maxInitialTokens;
86
- // The maximum amount of tokens that can be collected per second
87
- // except for the first collection
88
100
uint256 maxOngoingTokensPerSecond;
89
- // The minimum amount of seconds that must pass between collections
90
101
uint32 minSecondsPerCollection;
91
- // The maximum amount of seconds that can pass between collections
92
102
uint32 maxSecondsPerCollection;
93
- // Arbitrary metadata to extend functionality if a data service requires it
94
103
bytes metadata;
95
104
}
96
105
97
- /// @notice The data for an agreement
106
+ /**
107
+ * @notice The data for an agreement
108
+ * @dev This struct is used to store the data of an agreement in the contract
109
+ * @param dataService The address of the data service
110
+ * @param payer The address of the payer
111
+ * @param serviceProvider The address of the service provider
112
+ * @param acceptedAt The timestamp when the agreement was accepted
113
+ * @param lastCollectionAt The timestamp when the agreement was last collected at
114
+ * @param endsAt The timestamp when the agreement ends
115
+ * @param maxInitialTokens The maximum amount of tokens that can be collected in the first collection
116
+ * on top of the amount allowed for subsequent collections
117
+ * @param maxOngoingTokensPerSecond The maximum amount of tokens that can be collected per second
118
+ * except for the first collection
119
+ * @param minSecondsPerCollection The minimum amount of seconds that must pass between collections
120
+ * @param maxSecondsPerCollection The maximum amount of seconds that can pass between collections
121
+ * @param canceledAt The timestamp when the agreement was canceled
122
+ * @param state The state of the agreement
123
+ */
98
124
struct AgreementData {
99
125
// The address of the data service
100
126
address dataService;
@@ -124,14 +150,17 @@ interface IRecurringCollector is IAuthorizable, IPaymentsCollector {
124
150
AgreementState state;
125
151
}
126
152
127
- /// @notice The params for collecting an agreement
153
+ /**
154
+ * @notice The params for collecting an agreement
155
+ * @param agreementId The agreement ID of the RCA
156
+ * @param collectionId The collection ID of the RCA
157
+ * @param tokens The amount of tokens to collect
158
+ * @param dataServiceCut The data service cut in parts per million
159
+ */
128
160
struct CollectParams {
129
161
bytes16 agreementId;
130
- // The collection ID
131
162
bytes32 collectionId;
132
- // The amount of tokens to collect
133
163
uint256 tokens;
134
- // The data service cut in PPM
135
164
uint256 dataServiceCut;
136
165
}
137
166
@@ -226,77 +255,77 @@ interface IRecurringCollector is IAuthorizable, IPaymentsCollector {
226
255
);
227
256
228
257
/**
229
- * Thrown when accepting an agreement with a zero ID
258
+ * @notice Thrown when accepting an agreement with a zero ID
230
259
*/
231
260
error RecurringCollectorAgreementIdZero ();
232
261
233
262
/**
234
- * Thrown when interacting with an agreement not owned by the message sender
263
+ * @notice Thrown when interacting with an agreement not owned by the message sender
235
264
* @param agreementId The agreement ID
236
265
* @param unauthorizedDataService The address of the unauthorized data service
237
266
*/
238
267
error RecurringCollectorDataServiceNotAuthorized (bytes16 agreementId , address unauthorizedDataService );
239
268
240
269
/**
241
- * Thrown when interacting with an agreement with an elapsed deadline
270
+ * @notice Thrown when interacting with an agreement with an elapsed deadline
242
271
* @param currentTimestamp The current timestamp
243
272
* @param deadline The elapsed deadline timestamp
244
273
*/
245
274
error RecurringCollectorAgreementDeadlineElapsed (uint256 currentTimestamp , uint64 deadline );
246
275
247
276
/**
248
- * Thrown when the signer is invalid
277
+ * @notice Thrown when the signer is invalid
249
278
*/
250
279
error RecurringCollectorInvalidSigner ();
251
280
252
281
/**
253
- * Thrown when the payment type is not IndexingFee
282
+ * @notice Thrown when the payment type is not IndexingFee
254
283
* @param invalidPaymentType The invalid payment type
255
284
*/
256
285
error RecurringCollectorInvalidPaymentType (IGraphPayments.PaymentTypes invalidPaymentType );
257
286
258
287
/**
259
- * Thrown when the caller is not the data service the RCA was issued to
288
+ * @notice Thrown when the caller is not the data service the RCA was issued to
260
289
* @param unauthorizedCaller The address of the caller
261
290
* @param dataService The address of the data service
262
291
*/
263
292
error RecurringCollectorUnauthorizedCaller (address unauthorizedCaller , address dataService );
264
293
265
294
/**
266
- * Thrown when calling collect() with invalid data
295
+ * @notice Thrown when calling collect() with invalid data
267
296
* @param invalidData The invalid data
268
297
*/
269
298
error RecurringCollectorInvalidCollectData (bytes invalidData );
270
299
271
300
/**
272
- * Thrown when calling collect() on a payer canceled agreement
301
+ * @notice Thrown when calling collect() on a payer canceled agreement
273
302
* where the final collection has already been done
274
303
* @param agreementId The agreement ID
275
304
* @param finalCollectionAt The timestamp when the final collection was done
276
305
*/
277
306
error RecurringCollectorFinalCollectionDone (bytes16 agreementId , uint256 finalCollectionAt );
278
307
279
308
/**
280
- * Thrown when interacting with an agreement that has an incorrect state
309
+ * @notice Thrown when interacting with an agreement that has an incorrect state
281
310
* @param agreementId The agreement ID
282
311
* @param incorrectState The incorrect state
283
312
*/
284
313
error RecurringCollectorAgreementIncorrectState (bytes16 agreementId , AgreementState incorrectState );
285
314
286
315
/**
287
- * Thrown when accepting an agreement with an address that is not set
316
+ * @notice Thrown when accepting an agreement with an address that is not set
288
317
*/
289
318
error RecurringCollectorAgreementAddressNotSet ();
290
319
291
320
/**
292
- * Thrown when accepting or upgrading an agreement with an elapsed endsAt
321
+ * @notice Thrown when accepting or upgrading an agreement with an elapsed endsAt
293
322
* @param currentTimestamp The current timestamp
294
323
* @param endsAt The agreement end timestamp
295
324
*/
296
325
error RecurringCollectorAgreementElapsedEndsAt (uint256 currentTimestamp , uint64 endsAt );
297
326
298
327
/**
299
- * Thrown when accepting or upgrading an agreement with an elapsed endsAt
328
+ * @notice Thrown when accepting or upgrading an agreement with an elapsed endsAt
300
329
* @param allowedMinCollectionWindow The allowed minimum collection window
301
330
* @param minSecondsPerCollection The minimum seconds per collection
302
331
* @param maxSecondsPerCollection The maximum seconds per collection
@@ -308,29 +337,29 @@ interface IRecurringCollector is IAuthorizable, IPaymentsCollector {
308
337
);
309
338
310
339
/**
311
- * Thrown when accepting or upgrading an agreement with an invalid duration
340
+ * @notice Thrown when accepting or upgrading an agreement with an invalid duration
312
341
* @param requiredMinDuration The required minimum duration
313
342
* @param invalidDuration The invalid duration
314
343
*/
315
344
error RecurringCollectorAgreementInvalidDuration (uint32 requiredMinDuration , uint256 invalidDuration );
316
345
317
346
/**
318
- * Thrown when calling collect() on an elapsed agreement
347
+ * @notice Thrown when calling collect() on an elapsed agreement
319
348
* @param agreementId The agreement ID
320
349
* @param endsAt The agreement end timestamp
321
350
*/
322
351
error RecurringCollectorAgreementElapsed (bytes16 agreementId , uint64 endsAt );
323
352
324
353
/**
325
- * Thrown when calling collect() too soon
354
+ * @notice Thrown when calling collect() too soon
326
355
* @param agreementId The agreement ID
327
356
* @param secondsSinceLast Seconds since last collection
328
357
* @param minSeconds Minimum seconds between collections
329
358
*/
330
359
error RecurringCollectorCollectionTooSoon (bytes16 agreementId , uint32 secondsSinceLast , uint32 minSeconds );
331
360
332
361
/**
333
- * Thrown when calling collect() too late
362
+ * @notice Thrown when calling collect() too late
334
363
* @param agreementId The agreement ID
335
364
* @param secondsSinceLast Seconds since last collection
336
365
* @param maxSeconds Maximum seconds between collections
0 commit comments