@@ -27,11 +27,11 @@ contract BatchConversionPayments is BatchNoConversionPayments {
27
27
/**
28
28
* @dev Used by the batchRouter to handle information for heterogeneous batches, grouped by payment network.
29
29
* - paymentNetworkId: from 0 to 4, cf. `batchRouter()` method.
30
- * - conversionDetails all the data required for conversion and no conversion requests to be paid
30
+ * - requestDetails all the data required for conversion and no conversion requests to be paid
31
31
*/
32
32
struct MetaDetail {
33
33
uint256 paymentNetworkId;
34
- ConversionDetail [] conversionDetails ;
34
+ RequestDetail [] requestDetails ;
35
35
}
36
36
37
37
/**
@@ -63,7 +63,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
63
63
64
64
/**
65
65
* @notice Batch payments on different payment networks at once.
66
- * @param metaDetails contains paymentNetworkId and conversionDetails
66
+ * @param metaDetails contains paymentNetworkId and requestDetails
67
67
* - batchMultiERC20ConversionPayments, paymentNetworkId=0
68
68
* - batchERC20Payments, paymentNetworkId=1
69
69
* - batchMultiERC20Payments, paymentNetworkId=2
@@ -76,7 +76,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
76
76
* @dev batchRouter only reduces gas consumption when using more than a single payment network.
77
77
* For single payment network payments, it is more efficient to use the suited batch function.
78
78
*/
79
- function batchRouter (
79
+ function batchPayment (
80
80
MetaDetail[] calldata metaDetails ,
81
81
address [][] calldata pathsToUSD ,
82
82
address feeAddress
@@ -91,44 +91,44 @@ contract BatchConversionPayments is BatchNoConversionPayments {
91
91
92
92
uint256 batchFeeAmountUSD = 0 ;
93
93
for (uint256 i = 0 ; i < metaDetails.length ; i++ ) {
94
- MetaDetail calldata metaConversionDetail = metaDetails[i];
95
- if (metaConversionDetail .paymentNetworkId == 0 ) {
94
+ MetaDetail calldata metaDetail = metaDetails[i];
95
+ if (metaDetail .paymentNetworkId == 0 ) {
96
96
batchFeeAmountUSD += batchMultiERC20ConversionPayments (
97
- metaConversionDetail.conversionDetails ,
97
+ metaDetail.requestDetails ,
98
98
batchFeeAmountUSD,
99
99
pathsToUSD,
100
100
feeAddress
101
101
);
102
- } else if (metaConversionDetail .paymentNetworkId == 1 ) {
102
+ } else if (metaDetail .paymentNetworkId == 1 ) {
103
103
batchFeeAmountUSD += batchERC20Payments (
104
- metaConversionDetail.conversionDetails ,
104
+ metaDetail.requestDetails ,
105
105
pathsToUSD,
106
106
batchFeeAmountUSD,
107
107
feeAddress
108
108
);
109
- } else if (metaConversionDetail .paymentNetworkId == 2 ) {
109
+ } else if (metaDetail .paymentNetworkId == 2 ) {
110
110
batchFeeAmountUSD += batchMultiERC20Payments (
111
- metaConversionDetail.conversionDetails ,
111
+ metaDetail.requestDetails ,
112
112
pathsToUSD,
113
113
batchFeeAmountUSD,
114
114
feeAddress
115
115
);
116
- } else if (metaConversionDetail .paymentNetworkId == 3 ) {
116
+ } else if (metaDetail .paymentNetworkId == 3 ) {
117
117
if (metaDetails[metaDetails.length - 1 ].paymentNetworkId == 4 ) {
118
118
// Set to false only if batchEthConversionPayments is called after this function
119
119
transferBackRemainingEth = false ;
120
120
}
121
121
batchFeeAmountUSD += batchEthPayments (
122
- metaConversionDetail.conversionDetails ,
122
+ metaDetail.requestDetails ,
123
123
batchFeeAmountUSD,
124
124
payable (feeAddress)
125
125
);
126
126
if (metaDetails[metaDetails.length - 1 ].paymentNetworkId == 4 ) {
127
127
transferBackRemainingEth = true ;
128
128
}
129
- } else if (metaConversionDetail .paymentNetworkId == 4 ) {
129
+ } else if (metaDetail .paymentNetworkId == 4 ) {
130
130
batchFeeAmountUSD += batchEthConversionPayments (
131
- metaConversionDetail.conversionDetails ,
131
+ metaDetail.requestDetails ,
132
132
batchFeeAmountUSD,
133
133
payable (feeAddress)
134
134
);
@@ -144,14 +144,14 @@ contract BatchConversionPayments is BatchNoConversionPayments {
144
144
/**
145
145
* @notice Send a batch of ERC20 payments with amounts based on a request
146
146
* currency (e.g. fiat), with fees and paymentReferences to multiple accounts, with multiple tokens.
147
- * @param conversionDetails List of ERC20 requests denominated in fiat to pay.
147
+ * @param requestDetails List of ERC20 requests denominated in fiat to pay.
148
148
* @param batchFeeAmountUSD The batch fee amount in USD already paid.
149
149
* @param pathsToUSD The list of paths into USD for every token, used to limit the batch fees.
150
150
* Without paths, there is not limitation.
151
151
* @param feeAddress The fee recipient
152
152
*/
153
153
function batchMultiERC20ConversionPayments (
154
- ConversionDetail [] calldata conversionDetails ,
154
+ RequestDetail [] calldata requestDetails ,
155
155
uint256 batchFeeAmountUSD ,
156
156
address [][] calldata pathsToUSD ,
157
157
address feeAddress
@@ -160,7 +160,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
160
160
if (batchPaymentOrigin != true ) {
161
161
batchFeeAmountUSD = 0 ;
162
162
}
163
- Token[] memory uTokens = getUTokens (conversionDetails );
163
+ Token[] memory uTokens = getUTokens (requestDetails );
164
164
165
165
IERC20 requestedToken;
166
166
// For each token: check allowance, transfer funds on the contract and approve the paymentProxy to spend if needed
@@ -176,8 +176,8 @@ contract BatchConversionPayments is BatchNoConversionPayments {
176
176
}
177
177
178
178
// Batch pays the requests using Erc20ConversionFeeProxy
179
- for (uint256 i = 0 ; i < conversionDetails .length ; i++ ) {
180
- ConversionDetail memory rI = conversionDetails [i];
179
+ for (uint256 i = 0 ; i < requestDetails .length ; i++ ) {
180
+ RequestDetail memory rI = requestDetails [i];
181
181
paymentErc20ConversionProxy.transferFromWithReferenceAndFee (
182
182
rI.recipient,
183
183
rI.requestAmount,
@@ -224,7 +224,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
224
224
/**
225
225
* @notice Send a batch of ETH conversion payments with fees and paymentReferences to multiple accounts.
226
226
* If one payment fails, the whole batch is reverted.
227
- * @param conversionDetails List of ETH requests denominated in fiat to pay.
227
+ * @param requestDetails List of ETH requests denominated in fiat to pay.
228
228
* @param batchFeeAmountUSD The batch fee amount in USD already paid.
229
229
* @param feeAddress The fee recipient.
230
230
* @dev It uses EthereumConversionProxy to pay an invoice and fees.
@@ -234,7 +234,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
234
234
* This choice reduces the gas significantly, by delegating the whole conversion to the payment proxy.
235
235
*/
236
236
function batchEthConversionPayments (
237
- ConversionDetail [] calldata conversionDetails ,
237
+ RequestDetail [] calldata requestDetails ,
238
238
uint256 batchFeeAmountUSD ,
239
239
address payable feeAddress
240
240
) public payable returns (uint256 ) {
@@ -246,16 +246,16 @@ contract BatchConversionPayments is BatchNoConversionPayments {
246
246
payerAuthorized = true ;
247
247
248
248
// Batch contract pays the requests through EthConversionProxy
249
- for (uint256 i = 0 ; i < conversionDetails .length ; i++ ) {
250
- ConversionDetail memory cD = conversionDetails [i];
249
+ for (uint256 i = 0 ; i < requestDetails .length ; i++ ) {
250
+ RequestDetail memory rD = requestDetails [i];
251
251
paymentEthConversionProxy.transferWithReferenceAndFee {value: address (this ).balance}(
252
- payable (cD .recipient),
253
- cD .requestAmount,
254
- cD .path,
255
- cD .paymentReference,
256
- cD .feeAmount,
252
+ payable (rD .recipient),
253
+ rD .requestAmount,
254
+ rD .path,
255
+ rD .paymentReference,
256
+ rD .feeAmount,
257
257
feeAddress,
258
- cD .maxRateTimespan
258
+ rD .maxRateTimespan
259
259
);
260
260
}
261
261
0 commit comments