@@ -15,9 +15,9 @@ import { IGraphPayments } from "./IGraphPayments.sol";
15
15
* collector contract which implements the {IPaymentsCollector} interface.
16
16
*/
17
17
interface IPaymentsEscrow {
18
- /// @notice Escrow account for a payer-receiver pair
18
+ /// @notice Escrow account for a payer-collector- receiver tuple
19
19
struct EscrowAccount {
20
- // Total token balance for the payer-receiver pair
20
+ // Total token balance for the payer-collector- receiver tuple
21
21
uint256 balance;
22
22
// Amount of tokens currently being thawed
23
23
uint256 tokensThawing;
@@ -70,12 +70,13 @@ interface IPaymentsEscrow {
70
70
event RevokeCollector (address indexed payer , address indexed collector );
71
71
72
72
/**
73
- * @notice Emitted when a payer deposits funds into the escrow for a payer-receiver pair
73
+ * @notice Emitted when a payer deposits funds into the escrow for a payer-collector- receiver tuple
74
74
* @param payer The address of the payer
75
+ * @param collector The address of the collector
75
76
* @param receiver The address of the receiver
76
77
* @param tokens The amount of tokens deposited
77
78
*/
78
- event Deposit (address indexed payer , address indexed receiver , uint256 tokens );
79
+ event Deposit (address indexed payer , address indexed collector , address indexed receiver , uint256 tokens );
79
80
80
81
/**
81
82
* @notice Emitted when a payer cancels an escrow thawing
@@ -85,29 +86,38 @@ interface IPaymentsEscrow {
85
86
event CancelThaw (address indexed payer , address indexed receiver );
86
87
87
88
/**
88
- * @notice Emitted when a payer thaws funds from the escrow for a payer-receiver pair
89
+ * @notice Emitted when a payer thaws funds from the escrow for a payer-collector- receiver tuple
89
90
* @param payer The address of the payer
91
+ * @param collector The address of the collector
90
92
* @param receiver The address of the receiver
91
93
* @param tokens The amount of tokens being thawed
92
94
* @param thawEndTimestamp The timestamp at which the thawing period ends
93
95
*/
94
- event Thaw (address indexed payer , address indexed receiver , uint256 tokens , uint256 thawEndTimestamp );
96
+ event Thaw (
97
+ address indexed payer ,
98
+ address indexed collector ,
99
+ address indexed receiver ,
100
+ uint256 tokens ,
101
+ uint256 thawEndTimestamp
102
+ );
95
103
96
104
/**
97
- * @notice Emitted when a payer withdraws funds from the escrow for a payer-receiver pair
105
+ * @notice Emitted when a payer withdraws funds from the escrow for a payer-collector- receiver tuple
98
106
* @param payer The address of the payer
107
+ * @param collector The address of the collector
99
108
* @param receiver The address of the receiver
100
109
* @param tokens The amount of tokens withdrawn
101
110
*/
102
- event Withdraw (address indexed payer , address indexed receiver , uint256 tokens );
111
+ event Withdraw (address indexed payer , address indexed collector , address indexed receiver , uint256 tokens );
103
112
104
113
/**
105
- * @notice Emitted when a collector collects funds from the escrow for a payer-receiver pair
114
+ * @notice Emitted when a collector collects funds from the escrow for a payer-collector- receiver tuple
106
115
* @param payer The address of the payer
116
+ * @param collector The address of the collector
107
117
* @param receiver The address of the receiver
108
118
* @param tokens The amount of tokens collected
109
119
*/
110
- event EscrowCollected (address indexed payer , address indexed receiver , uint256 tokens );
120
+ event EscrowCollected (address indexed payer , address indexed collector , address indexed receiver , uint256 tokens );
111
121
112
122
// -- Errors --
113
123
@@ -211,26 +221,28 @@ interface IPaymentsEscrow {
211
221
function revokeCollector (address collector ) external ;
212
222
213
223
/**
214
- * @notice Deposits funds into the escrow for a payer-receiver pair , where
224
+ * @notice Deposits funds into the escrow for a payer-collector- receiver tuple , where
215
225
* the payer is the transaction caller.
216
226
* @dev Emits a {Deposit} event
227
+ * @param collector The address of the collector
217
228
* @param receiver The address of the receiver
218
229
* @param tokens The amount of tokens to deposit
219
230
*/
220
- function deposit (address receiver , uint256 tokens ) external ;
231
+ function deposit (address collector , address receiver , uint256 tokens ) external ;
221
232
222
233
/**
223
- * @notice Deposits funds into the escrow for a payer-receiver pair , where
234
+ * @notice Deposits funds into the escrow for a payer-collector- receiver tuple , where
224
235
* the payer can be specified.
225
236
* @dev Emits a {Deposit} event
226
237
* @param payer The address of the payer
238
+ * @param collector The address of the collector
227
239
* @param receiver The address of the receiver
228
240
* @param tokens The amount of tokens to deposit
229
241
*/
230
- function depositTo (address payer , address receiver , uint256 tokens ) external ;
242
+ function depositTo (address payer , address collector , address receiver , uint256 tokens ) external ;
231
243
232
244
/**
233
- * @notice Thaw a specific amount of escrow from a payer-receiver's escrow account.
245
+ * @notice Thaw a specific amount of escrow from a payer-collector- receiver's escrow account.
234
246
* The payer is the transaction caller.
235
247
* If `tokens` is zero and funds were already thawing it will cancel the thawing.
236
248
* Note that repeated calls to this function will overwrite the previous thawing amount
@@ -240,13 +252,14 @@ interface IPaymentsEscrow {
240
252
*
241
253
* Emits a {Thaw} event. If `tokens` is zero it will emit a {CancelThaw} event.
242
254
*
255
+ * @param collector The address of the collector
243
256
* @param receiver The address of the receiver
244
257
* @param tokens The amount of tokens to thaw
245
258
*/
246
- function thaw (address receiver , uint256 tokens ) external ;
259
+ function thaw (address collector , address receiver , uint256 tokens ) external ;
247
260
248
261
/**
249
- * @notice Withdraws all thawed escrow from a payer-receiver's escrow account.
262
+ * @notice Withdraws all thawed escrow from a payer-collector- receiver's escrow account.
250
263
* The payer is the transaction caller.
251
264
* Note that the withdrawn funds might be less than the thawed amount if there were
252
265
* payment collections in the meantime.
@@ -255,12 +268,13 @@ interface IPaymentsEscrow {
255
268
*
256
269
* Emits a {Withdraw} event
257
270
*
271
+ * @param collector The address of the collector
258
272
* @param receiver The address of the receiver
259
273
*/
260
- function withdraw (address receiver ) external ;
274
+ function withdraw (address collector , address receiver ) external ;
261
275
262
276
/**
263
- * @notice Collects funds from the payer-receiver's escrow and sends them to {GraphPayments} for
277
+ * @notice Collects funds from the payer-collector- receiver's escrow and sends them to {GraphPayments} for
264
278
* distribution using the Graph Horizon Payments protocol.
265
279
* The function will revert if there are not enough funds in the escrow.
266
280
* @dev Requirements:
@@ -272,22 +286,23 @@ interface IPaymentsEscrow {
272
286
* @param payer The address of the payer
273
287
* @param receiver The address of the receiver
274
288
* @param tokens The amount of tokens to collect
275
- * @param collector The address of the collector
289
+ * @param dataService The address of the data service
276
290
* @param tokensDataService The amount of tokens that {GraphPayments} should send to the data service
277
291
*/
278
292
function collect (
279
293
IGraphPayments.PaymentTypes paymentType ,
280
294
address payer ,
281
295
address receiver ,
282
296
uint256 tokens ,
283
- address collector ,
297
+ address dataService ,
284
298
uint256 tokensDataService
285
299
) external ;
286
300
287
301
/**
288
- * @notice Get the balance of a payer-receiver pair
302
+ * @notice Get the balance of a payer-collector- receiver tuple
289
303
* @param payer The address of the payer
304
+ * @param collector The address of the collector
290
305
* @param receiver The address of the receiver
291
306
*/
292
- function getBalance (address payer , address receiver ) external view returns (uint256 );
307
+ function getBalance (address payer , address collector , address receiver ) external view returns (uint256 );
293
308
}
0 commit comments