Skip to content

Commit 6de03f6

Browse files
committed
Merge branch 'fix/btach-conversion-capped' into chore/payment-processor-batch-fee-usd-limited
2 parents d215a6a + 9436290 commit 6de03f6

File tree

7 files changed

+44
-18
lines changed

7 files changed

+44
-18
lines changed

packages/payment-detection/src/thegraph/info-retriever.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class TheGraphInfoRetriever {
108108
'feeAmountInCrypto',
109109
'maxRateTimespan',
110110
),
111-
String,
111+
(val) => (val !== null ? String(val) : undefined),
112112
),
113113
// Make sure the checksum is right for addresses.
114114
...mapValues(pick(payment, 'from', 'feeAddress', 'tokenAddress'), (str, key) =>

packages/payment-detection/test/erc20/fee-proxy-contract.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ describe('api/erc20/fee-proxy-contract', () => {
425425
txHash: '0x456d67cba236778e91a901e97c71684e82317dc2679d1b5c6bfa6d420d636b7d',
426426
gasUsed: '73152',
427427
gasPrice: '12709127644',
428+
timestamp: 1666002347,
429+
amountInCrypto: null,
430+
feeAddress: '0x35d0e078755cd84d3e0656caab417dee1d7939c7',
431+
feeAmountInCrypto: null,
432+
maxRateTimespan: null,
428433
},
429434
].filter((x) => x.reference.toLowerCase() === reference.toLowerCase()),
430435
escrowEvents: [],
@@ -434,8 +439,29 @@ describe('api/erc20/fee-proxy-contract', () => {
434439
}),
435440
});
436441

437-
const { balance, error } = await erc20FeeProxyContract.getBalance(mockRequest);
442+
const { balance, error, events } = await erc20FeeProxyContract.getBalance(mockRequest);
438443
expect(error).toBeUndefined();
439444
expect(balance).toBe('168040800000000000000000');
445+
expect(events).toMatchObject([
446+
{
447+
amount: '168040800000000000000000',
448+
name: 'payment',
449+
parameters: {
450+
amountInCrypto: undefined,
451+
block: 15767215,
452+
feeAddress: '0x35d0e078755Cd84D3E0656cAaB417Dee1d7939c7',
453+
feeAmount: '13386000000000000000',
454+
feeAmountInCrypto: undefined,
455+
from: '0x15339d48Fbe31E349A507FD6d48Eb01c45Fdc79A',
456+
gasPrice: '12709127644',
457+
gasUsed: '73152',
458+
maxRateTimespan: undefined,
459+
to: '0x6c9E04997000d6A8a353951231923d776d4Cdff2',
460+
tokenAddress: '0x967da4048cD07aB37855c090aAF366e4ce1b9F48',
461+
txHash: '0x456d67cba236778e91a901e97c71684e82317dc2679d1b5c6bfa6d420d636b7d',
462+
},
463+
timestamp: 1666002347,
464+
},
465+
]);
440466
});
441467
});

packages/payment-detection/test/near/near-native.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('Near payments detection', () => {
6464
expect(events).toHaveLength(1);
6565

6666
expect(events[0].amount).toBe('1000000000000000000000000');
67-
expect(events[0].timestamp).toBe(1631788427230);
67+
expect(events[0].timestamp).toBe(1631788427);
6868
expect(events[0].parameters?.receiptId).toBe('FYVnCvJFoNtK7LE2uAdTFfReFMGiCUHMczLsvEni1Cpf');
6969
expect(events[0].parameters?.txHash).toBeUndefined();
7070
expect(events[0].parameters?.block).toBe(47891257);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ contract BatchConversionPayments is BatchNoConversionPayments {
4242
* @param _paymentNativeProxy The native payment proxy address to use.
4343
* @param _paymentErc20ConversionProxy The ERC20 Conversion payment proxy address to use.
4444
* @param _paymentNativeConversionFeeProxy The native Conversion payment proxy address to use.
45-
* @param _chainlinkConversionPathAddress The address of the conversion path contract.
45+
* @param _chainlinkConversionPath The address of the conversion path contract.
4646
* @param _owner Owner of the contract.
4747
*/
4848
constructor(
4949
address _paymentErc20Proxy,
5050
address _paymentNativeProxy,
5151
address _paymentErc20ConversionProxy,
5252
address _paymentNativeConversionFeeProxy,
53-
address _chainlinkConversionPathAddress,
53+
address _chainlinkConversionPath,
5454
address _owner
5555
)
5656
BatchNoConversionPayments(
5757
_paymentErc20Proxy,
5858
_paymentNativeProxy,
59-
_chainlinkConversionPathAddress,
59+
_chainlinkConversionPath,
6060
_owner
6161
)
6262
{

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ contract BatchNoConversionPayments is Ownable {
7777
/**
7878
* @param _paymentErc20Proxy The address to the ERC20 fee payment proxy to use.
7979
* @param _paymentNativeProxy The address to the Native fee payment proxy to use.
80-
* @param _chainlinkConversionPathAddress The address of the conversion path contract.
80+
* @param _chainlinkConversionPath The address of the conversion path contract.
8181
* @param _owner Owner of the contract.
8282
*/
8383
constructor(
8484
address _paymentErc20Proxy,
8585
address _paymentNativeProxy,
86-
address _chainlinkConversionPathAddress,
86+
address _chainlinkConversionPath,
8787
address _owner
8888
) {
8989
paymentErc20Proxy = IERC20FeeProxy(_paymentErc20Proxy);
9090
paymentNativeProxy = IEthereumFeeProxy(_paymentNativeProxy);
91-
chainlinkConversionPath = ChainlinkConversionPath(_chainlinkConversionPathAddress);
91+
chainlinkConversionPath = ChainlinkConversionPath(_chainlinkConversionPath);
9292
transferOwnership(_owner);
9393
batchFee = 0;
9494
}
@@ -562,10 +562,10 @@ contract BatchNoConversionPayments is Ownable {
562562

563563
/**
564564
* @notice Update the conversion path contract used to fetch conversions.
565-
* @param _chainlinkConversionPathAddress The address of the conversion path contract.
565+
* @param _chainlinkConversionPath The address of the conversion path contract.
566566
*/
567-
function setConversionPathAddress(address _chainlinkConversionPathAddress) external onlyOwner {
568-
chainlinkConversionPath = ChainlinkConversionPath(_chainlinkConversionPathAddress);
567+
function setChainlinkConversionPath(address _chainlinkConversionPath) external onlyOwner {
568+
chainlinkConversionPath = ChainlinkConversionPath(_chainlinkConversionPath);
569569
}
570570

571571
/**

packages/smart-contracts/src/lib/artifacts/BatchConversionPayments/0.1.0.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
{
2626
"internalType": "address",
27-
"name": "_chainlinkConversionPathAddress",
27+
"name": "_chainlinkConversionPath",
2828
"type": "address"
2929
},
3030
{
@@ -648,11 +648,11 @@
648648
"inputs": [
649649
{
650650
"internalType": "address",
651-
"name": "_chainlinkConversionPathAddress",
651+
"name": "_chainlinkConversionPath",
652652
"type": "address"
653653
}
654654
],
655-
"name": "setConversionPathAddress",
655+
"name": "setChainlinkConversionPath",
656656
"outputs": [],
657657
"stateMutability": "nonpayable",
658658
"type": "function"

packages/smart-contracts/src/lib/artifacts/BatchNoConversionPayments/0.1.0.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"internalType": "address",
17-
"name": "_chainlinkConversionPathAddress",
17+
"name": "_chainlinkConversionPath",
1818
"type": "address"
1919
},
2020
{
@@ -408,11 +408,11 @@
408408
"inputs": [
409409
{
410410
"internalType": "address",
411-
"name": "_chainlinkConversionPathAddress",
411+
"name": "_chainlinkConversionPath",
412412
"type": "address"
413413
}
414414
],
415-
"name": "setConversionPathAddress",
415+
"name": "setChainlinkConversionPath",
416416
"outputs": [],
417417
"stateMutability": "nonpayable",
418418
"type": "function"

0 commit comments

Comments
 (0)