Skip to content

Commit 552ebbb

Browse files
committed
rename ConversionDetail into RequestDetail
1 parent 69d76a7 commit 552ebbb

File tree

7 files changed

+231
-240
lines changed

7 files changed

+231
-240
lines changed

packages/smart-contracts/src/contracts/BatchConversionPayments.sol

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ contract BatchConversionPayments is BatchNoConversionPayments {
2727
/**
2828
* @dev Used by the batchRouter to handle information for heterogeneous batches, grouped by payment network.
2929
* - 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
3131
*/
3232
struct MetaDetail {
3333
uint256 paymentNetworkId;
34-
ConversionDetail[] conversionDetails;
34+
RequestDetail[] requestDetails;
3535
}
3636

3737
/**
@@ -63,7 +63,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
6363

6464
/**
6565
* @notice Batch payments on different payment networks at once.
66-
* @param metaDetails contains paymentNetworkId and conversionDetails
66+
* @param metaDetails contains paymentNetworkId and requestDetails
6767
* - batchMultiERC20ConversionPayments, paymentNetworkId=0
6868
* - batchERC20Payments, paymentNetworkId=1
6969
* - batchMultiERC20Payments, paymentNetworkId=2
@@ -76,7 +76,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
7676
* @dev batchRouter only reduces gas consumption when using more than a single payment network.
7777
* For single payment network payments, it is more efficient to use the suited batch function.
7878
*/
79-
function batchRouter(
79+
function batchPayment(
8080
MetaDetail[] calldata metaDetails,
8181
address[][] calldata pathsToUSD,
8282
address feeAddress
@@ -91,44 +91,44 @@ contract BatchConversionPayments is BatchNoConversionPayments {
9191

9292
uint256 batchFeeAmountUSD = 0;
9393
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) {
9696
batchFeeAmountUSD += batchMultiERC20ConversionPayments(
97-
metaConversionDetail.conversionDetails,
97+
metaDetail.requestDetails,
9898
batchFeeAmountUSD,
9999
pathsToUSD,
100100
feeAddress
101101
);
102-
} else if (metaConversionDetail.paymentNetworkId == 1) {
102+
} else if (metaDetail.paymentNetworkId == 1) {
103103
batchFeeAmountUSD += batchERC20Payments(
104-
metaConversionDetail.conversionDetails,
104+
metaDetail.requestDetails,
105105
pathsToUSD,
106106
batchFeeAmountUSD,
107107
feeAddress
108108
);
109-
} else if (metaConversionDetail.paymentNetworkId == 2) {
109+
} else if (metaDetail.paymentNetworkId == 2) {
110110
batchFeeAmountUSD += batchMultiERC20Payments(
111-
metaConversionDetail.conversionDetails,
111+
metaDetail.requestDetails,
112112
pathsToUSD,
113113
batchFeeAmountUSD,
114114
feeAddress
115115
);
116-
} else if (metaConversionDetail.paymentNetworkId == 3) {
116+
} else if (metaDetail.paymentNetworkId == 3) {
117117
if (metaDetails[metaDetails.length - 1].paymentNetworkId == 4) {
118118
// Set to false only if batchEthConversionPayments is called after this function
119119
transferBackRemainingEth = false;
120120
}
121121
batchFeeAmountUSD += batchEthPayments(
122-
metaConversionDetail.conversionDetails,
122+
metaDetail.requestDetails,
123123
batchFeeAmountUSD,
124124
payable(feeAddress)
125125
);
126126
if (metaDetails[metaDetails.length - 1].paymentNetworkId == 4) {
127127
transferBackRemainingEth = true;
128128
}
129-
} else if (metaConversionDetail.paymentNetworkId == 4) {
129+
} else if (metaDetail.paymentNetworkId == 4) {
130130
batchFeeAmountUSD += batchEthConversionPayments(
131-
metaConversionDetail.conversionDetails,
131+
metaDetail.requestDetails,
132132
batchFeeAmountUSD,
133133
payable(feeAddress)
134134
);
@@ -144,14 +144,14 @@ contract BatchConversionPayments is BatchNoConversionPayments {
144144
/**
145145
* @notice Send a batch of ERC20 payments with amounts based on a request
146146
* 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.
148148
* @param batchFeeAmountUSD The batch fee amount in USD already paid.
149149
* @param pathsToUSD The list of paths into USD for every token, used to limit the batch fees.
150150
* Without paths, there is not limitation.
151151
* @param feeAddress The fee recipient
152152
*/
153153
function batchMultiERC20ConversionPayments(
154-
ConversionDetail[] calldata conversionDetails,
154+
RequestDetail[] calldata requestDetails,
155155
uint256 batchFeeAmountUSD,
156156
address[][] calldata pathsToUSD,
157157
address feeAddress
@@ -160,7 +160,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
160160
if (batchPaymentOrigin != true) {
161161
batchFeeAmountUSD = 0;
162162
}
163-
Token[] memory uTokens = getUTokens(conversionDetails);
163+
Token[] memory uTokens = getUTokens(requestDetails);
164164

165165
IERC20 requestedToken;
166166
// 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 {
176176
}
177177

178178
// 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];
181181
paymentErc20ConversionProxy.transferFromWithReferenceAndFee(
182182
rI.recipient,
183183
rI.requestAmount,
@@ -224,7 +224,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
224224
/**
225225
* @notice Send a batch of ETH conversion payments with fees and paymentReferences to multiple accounts.
226226
* 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.
228228
* @param batchFeeAmountUSD The batch fee amount in USD already paid.
229229
* @param feeAddress The fee recipient.
230230
* @dev It uses EthereumConversionProxy to pay an invoice and fees.
@@ -234,7 +234,7 @@ contract BatchConversionPayments is BatchNoConversionPayments {
234234
* This choice reduces the gas significantly, by delegating the whole conversion to the payment proxy.
235235
*/
236236
function batchEthConversionPayments(
237-
ConversionDetail[] calldata conversionDetails,
237+
RequestDetail[] calldata requestDetails,
238238
uint256 batchFeeAmountUSD,
239239
address payable feeAddress
240240
) public payable returns (uint256) {
@@ -246,16 +246,16 @@ contract BatchConversionPayments is BatchNoConversionPayments {
246246
payerAuthorized = true;
247247

248248
// 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];
251251
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,
257257
feeAddress,
258-
cD.maxRateTimespan
258+
rD.maxRateTimespan
259259
);
260260
}
261261

0 commit comments

Comments
 (0)