diff --git a/packages/payment-detection/src/thegraph/info-retriever.ts b/packages/payment-detection/src/thegraph/info-retriever.ts index 503ae46d18..7f7fadd888 100644 --- a/packages/payment-detection/src/thegraph/info-retriever.ts +++ b/packages/payment-detection/src/thegraph/info-retriever.ts @@ -108,7 +108,7 @@ export class TheGraphInfoRetriever { 'feeAmountInCrypto', 'maxRateTimespan', ), - String, + (val) => (val !== null ? String(val) : undefined), ), // Make sure the checksum is right for addresses. ...mapValues(pick(payment, 'from', 'feeAddress', 'tokenAddress'), (str, key) => diff --git a/packages/payment-detection/test/erc20/fee-proxy-contract.test.ts b/packages/payment-detection/test/erc20/fee-proxy-contract.test.ts index f2308527a3..2c423a5261 100644 --- a/packages/payment-detection/test/erc20/fee-proxy-contract.test.ts +++ b/packages/payment-detection/test/erc20/fee-proxy-contract.test.ts @@ -425,6 +425,11 @@ describe('api/erc20/fee-proxy-contract', () => { txHash: '0x456d67cba236778e91a901e97c71684e82317dc2679d1b5c6bfa6d420d636b7d', gasUsed: '73152', gasPrice: '12709127644', + timestamp: 1666002347, + amountInCrypto: null, + feeAddress: '0x35d0e078755cd84d3e0656caab417dee1d7939c7', + feeAmountInCrypto: null, + maxRateTimespan: null, }, ].filter((x) => x.reference.toLowerCase() === reference.toLowerCase()), escrowEvents: [], @@ -434,8 +439,29 @@ describe('api/erc20/fee-proxy-contract', () => { }), }); - const { balance, error } = await erc20FeeProxyContract.getBalance(mockRequest); + const { balance, error, events } = await erc20FeeProxyContract.getBalance(mockRequest); expect(error).toBeUndefined(); expect(balance).toBe('168040800000000000000000'); + expect(events).toMatchObject([ + { + amount: '168040800000000000000000', + name: 'payment', + parameters: { + amountInCrypto: undefined, + block: 15767215, + feeAddress: '0x35d0e078755Cd84D3E0656cAaB417Dee1d7939c7', + feeAmount: '13386000000000000000', + feeAmountInCrypto: undefined, + from: '0x15339d48Fbe31E349A507FD6d48Eb01c45Fdc79A', + gasPrice: '12709127644', + gasUsed: '73152', + maxRateTimespan: undefined, + to: '0x6c9E04997000d6A8a353951231923d776d4Cdff2', + tokenAddress: '0x967da4048cD07aB37855c090aAF366e4ce1b9F48', + txHash: '0x456d67cba236778e91a901e97c71684e82317dc2679d1b5c6bfa6d420d636b7d', + }, + timestamp: 1666002347, + }, + ]); }); }); diff --git a/packages/payment-detection/test/near/near-native.test.ts b/packages/payment-detection/test/near/near-native.test.ts index 58ed081cc3..3694bc9297 100644 --- a/packages/payment-detection/test/near/near-native.test.ts +++ b/packages/payment-detection/test/near/near-native.test.ts @@ -64,7 +64,7 @@ describe('Near payments detection', () => { expect(events).toHaveLength(1); expect(events[0].amount).toBe('1000000000000000000000000'); - expect(events[0].timestamp).toBe(1631788427230); + expect(events[0].timestamp).toBe(1631788427); expect(events[0].parameters?.receiptId).toBe('FYVnCvJFoNtK7LE2uAdTFfReFMGiCUHMczLsvEni1Cpf'); expect(events[0].parameters?.txHash).toBeUndefined(); expect(events[0].parameters?.block).toBe(47891257); diff --git a/packages/smart-contracts/src/contracts/BatchConversionPayments.sol b/packages/smart-contracts/src/contracts/BatchConversionPayments.sol index 32b8b16cc5..7fec3f829a 100644 --- a/packages/smart-contracts/src/contracts/BatchConversionPayments.sol +++ b/packages/smart-contracts/src/contracts/BatchConversionPayments.sol @@ -42,7 +42,7 @@ contract BatchConversionPayments is BatchNoConversionPayments { * @param _paymentNativeProxy The native payment proxy address to use. * @param _paymentErc20ConversionProxy The ERC20 Conversion payment proxy address to use. * @param _paymentNativeConversionFeeProxy The native Conversion payment proxy address to use. - * @param _chainlinkConversionPathAddress The address of the conversion path contract. + * @param _chainlinkConversionPath The address of the conversion path contract. * @param _owner Owner of the contract. */ constructor( @@ -50,13 +50,13 @@ contract BatchConversionPayments is BatchNoConversionPayments { address _paymentNativeProxy, address _paymentErc20ConversionProxy, address _paymentNativeConversionFeeProxy, - address _chainlinkConversionPathAddress, + address _chainlinkConversionPath, address _owner ) BatchNoConversionPayments( _paymentErc20Proxy, _paymentNativeProxy, - _chainlinkConversionPathAddress, + _chainlinkConversionPath, _owner ) { diff --git a/packages/smart-contracts/src/contracts/BatchNoConversionPayments.sol b/packages/smart-contracts/src/contracts/BatchNoConversionPayments.sol index 42cca6bc06..7a921b8a48 100644 --- a/packages/smart-contracts/src/contracts/BatchNoConversionPayments.sol +++ b/packages/smart-contracts/src/contracts/BatchNoConversionPayments.sol @@ -77,18 +77,18 @@ contract BatchNoConversionPayments is Ownable { /** * @param _paymentErc20Proxy The address to the ERC20 fee payment proxy to use. * @param _paymentNativeProxy The address to the Native fee payment proxy to use. - * @param _chainlinkConversionPathAddress The address of the conversion path contract. + * @param _chainlinkConversionPath The address of the conversion path contract. * @param _owner Owner of the contract. */ constructor( address _paymentErc20Proxy, address _paymentNativeProxy, - address _chainlinkConversionPathAddress, + address _chainlinkConversionPath, address _owner ) { paymentErc20Proxy = IERC20FeeProxy(_paymentErc20Proxy); paymentNativeProxy = IEthereumFeeProxy(_paymentNativeProxy); - chainlinkConversionPath = ChainlinkConversionPath(_chainlinkConversionPathAddress); + chainlinkConversionPath = ChainlinkConversionPath(_chainlinkConversionPath); transferOwnership(_owner); batchFee = 0; } @@ -562,10 +562,10 @@ contract BatchNoConversionPayments is Ownable { /** * @notice Update the conversion path contract used to fetch conversions. - * @param _chainlinkConversionPathAddress The address of the conversion path contract. + * @param _chainlinkConversionPath The address of the conversion path contract. */ - function setConversionPathAddress(address _chainlinkConversionPathAddress) external onlyOwner { - chainlinkConversionPath = ChainlinkConversionPath(_chainlinkConversionPathAddress); + function setChainlinkConversionPath(address _chainlinkConversionPath) external onlyOwner { + chainlinkConversionPath = ChainlinkConversionPath(_chainlinkConversionPath); } /** diff --git a/packages/smart-contracts/src/lib/artifacts/BatchConversionPayments/0.1.0.json b/packages/smart-contracts/src/lib/artifacts/BatchConversionPayments/0.1.0.json index c04ceade09..48bfae5ed0 100644 --- a/packages/smart-contracts/src/lib/artifacts/BatchConversionPayments/0.1.0.json +++ b/packages/smart-contracts/src/lib/artifacts/BatchConversionPayments/0.1.0.json @@ -24,7 +24,7 @@ }, { "internalType": "address", - "name": "_chainlinkConversionPathAddress", + "name": "_chainlinkConversionPath", "type": "address" }, { @@ -648,11 +648,11 @@ "inputs": [ { "internalType": "address", - "name": "_chainlinkConversionPathAddress", + "name": "_chainlinkConversionPath", "type": "address" } ], - "name": "setConversionPathAddress", + "name": "setChainlinkConversionPath", "outputs": [], "stateMutability": "nonpayable", "type": "function" diff --git a/packages/smart-contracts/src/lib/artifacts/BatchNoConversionPayments/0.1.0.json b/packages/smart-contracts/src/lib/artifacts/BatchNoConversionPayments/0.1.0.json index 06d163c967..e4438f8741 100644 --- a/packages/smart-contracts/src/lib/artifacts/BatchNoConversionPayments/0.1.0.json +++ b/packages/smart-contracts/src/lib/artifacts/BatchNoConversionPayments/0.1.0.json @@ -14,7 +14,7 @@ }, { "internalType": "address", - "name": "_chainlinkConversionPathAddress", + "name": "_chainlinkConversionPath", "type": "address" }, { @@ -408,11 +408,11 @@ "inputs": [ { "internalType": "address", - "name": "_chainlinkConversionPathAddress", + "name": "_chainlinkConversionPath", "type": "address" } ], - "name": "setConversionPathAddress", + "name": "setChainlinkConversionPath", "outputs": [], "stateMutability": "nonpayable", "type": "function"