From 593701f67fdf2129e8fdb373fb52ede672583986 Mon Sep 17 00:00:00 2001 From: Aimen Sahnoun Date: Fri, 8 Nov 2024 18:40:16 +0300 Subject: [PATCH 1/9] refactor: add all data to deployment events --- .../contracts/SingleRequestProxyFactory.sol | 29 ++++++++++++++++--- .../SingleRequestProxyFactory/index.ts | 4 --- .../SingleRequestProxyFactory.test.ts | 21 +++++++++++--- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol b/packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol index 6ac89e9d9..a88b1bb90 100644 --- a/packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol +++ b/packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol @@ -21,14 +21,20 @@ contract SingleRequestProxyFactory is Ownable { event EthereumSingleRequestProxyCreated( address proxyAddress, address payee, - bytes indexed paymentReference + bytes indexed paymentReference, + address feeAddress, + uint256 feeAmount, + address feeProxyUsed ); event ERC20SingleRequestProxyCreated( address proxyAddress, address payee, address tokenAddress, - bytes indexed paymentReference + bytes indexed paymentReference, + address feeAddress, + uint256 feeAmount, + address feeProxyUsed ); event ERC20FeeProxyUpdated(address indexed newERC20FeeProxy); @@ -64,7 +70,14 @@ contract SingleRequestProxyFactory is Ownable { _feeAddress, _feeAmount ); - emit EthereumSingleRequestProxyCreated(address(proxy), _payee, _paymentReference); + emit EthereumSingleRequestProxyCreated( + address(proxy), + _payee, + _paymentReference, + _feeAddress, + _feeAmount, + ethereumFeeProxy + ); return address(proxy); } @@ -93,7 +106,15 @@ contract SingleRequestProxyFactory is Ownable { erc20FeeProxy ); - emit ERC20SingleRequestProxyCreated(address(proxy), _payee, _tokenAddress, _paymentReference); + emit ERC20SingleRequestProxyCreated( + address(proxy), + _payee, + _tokenAddress, + _paymentReference, + _feeAddress, + _feeAmount, + erc20FeeProxy + ); return address(proxy); } diff --git a/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts b/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts index 43493b04b..7ca4e4f55 100644 --- a/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts +++ b/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts @@ -13,10 +13,6 @@ export const singleRequestProxyFactoryArtifact = new ContractArtifact { expect(proxyAddress).to.not.equal(ethers.constants.AddressZero); expect(proxyAddress).to.be.properAddress; - // Check if the event was emitted with correct parameters await expect(tx) .to.emit(singleRequestProxyFactory, 'EthereumSingleRequestProxyCreated') - .withArgs(proxyAddress, payeeAddress, paymentReference); + .withArgs( + proxyAddress, + payeeAddress, + paymentReference, + feeRecipientAddress, + feeAmount, + ethereumFeeProxy.address, + ); const proxy = (await ethers.getContractAt( 'EthereumSingleRequestProxy', @@ -119,10 +125,17 @@ describe('contract: SingleRequestProxyFactory', () => { expect(proxyAddress).to.not.equal(ethers.constants.AddressZero); expect(proxyAddress).to.be.properAddress; - // Check if the event was emitted with correct parameters await expect(tx) .to.emit(singleRequestProxyFactory, 'ERC20SingleRequestProxyCreated') - .withArgs(proxyAddress, payeeAddress, testToken.address, paymentReference); + .withArgs( + proxyAddress, + payeeAddress, + testToken.address, + paymentReference, + feeRecipientAddress, + feeAmount, + erc20FeeProxy.address, + ); const proxy = (await ethers.getContractAt( 'ERC20SingleRequestProxy', From c2e4d1b034b05cc5f9a48ff10a36134a20c8451f Mon Sep 17 00:00:00 2001 From: Aimen Sahnoun Date: Fri, 8 Nov 2024 18:52:16 +0300 Subject: [PATCH 2/9] chore: update payment-processor tests --- .../test/payment/single-request-proxy.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/payment-processor/test/payment/single-request-proxy.test.ts b/packages/payment-processor/test/payment/single-request-proxy.test.ts index 6f5cf0f27..c96fc912e 100644 --- a/packages/payment-processor/test/payment/single-request-proxy.test.ts +++ b/packages/payment-processor/test/payment/single-request-proxy.test.ts @@ -189,7 +189,10 @@ describe('deploySingleRequestProxy', () => { expect(events.length).toBeGreaterThan(0); - const eventData = utils.defaultAbiCoder.decode(['address', 'address'], events[0].data); + const eventData = utils.defaultAbiCoder.decode( + ['address', 'address', 'address', 'uint256', 'address'], + events[0].data, + ); expect(eventData[0]).toBe(proxyAddress); }); @@ -216,7 +219,10 @@ describe('deploySingleRequestProxy', () => { expect(events.length).toBeGreaterThan(0); - const eventData = utils.defaultAbiCoder.decode(['address', 'address'], events[0].data); + const eventData = utils.defaultAbiCoder.decode( + ['address', 'address', 'address', 'uint256', 'address'], + events[0].data, + ); expect(eventData[0]).toBe(proxyAddress); }); From 4c7a987781ed31e964f1af6383247839f5d069aa Mon Sep 17 00:00:00 2001 From: Aimen Sahnoun Date: Fri, 8 Nov 2024 18:55:54 +0300 Subject: [PATCH 3/9] chore: update payment-processor SRP tests --- .../payment-processor/test/payment/single-request-proxy.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/payment-processor/test/payment/single-request-proxy.test.ts b/packages/payment-processor/test/payment/single-request-proxy.test.ts index c96fc912e..f016f2b75 100644 --- a/packages/payment-processor/test/payment/single-request-proxy.test.ts +++ b/packages/payment-processor/test/payment/single-request-proxy.test.ts @@ -220,7 +220,7 @@ describe('deploySingleRequestProxy', () => { expect(events.length).toBeGreaterThan(0); const eventData = utils.defaultAbiCoder.decode( - ['address', 'address', 'address', 'uint256', 'address'], + ['address', 'address', 'address', 'address', 'uint256', 'address'], events[0].data, ); From 91492f8ad5b0429984812b344585c2a61ed11ada Mon Sep 17 00:00:00 2001 From: MantisClone Date: Fri, 8 Nov 2024 12:52:06 -0500 Subject: [PATCH 4/9] Reorder function parameters for consistency. Improve test assertions --- .../test/payment/single-request-proxy.test.ts | 19 +++++++++++++++++++ .../src/contracts/ERC20SingleRequestProxy.sol | 6 +++--- .../contracts/EthereumSingleRequestProxy.sol | 2 +- .../contracts/SingleRequestProxyFactory.sol | 6 +++--- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/packages/payment-processor/test/payment/single-request-proxy.test.ts b/packages/payment-processor/test/payment/single-request-proxy.test.ts index f016f2b75..cfcc34e22 100644 --- a/packages/payment-processor/test/payment/single-request-proxy.test.ts +++ b/packages/payment-processor/test/payment/single-request-proxy.test.ts @@ -195,6 +195,15 @@ describe('deploySingleRequestProxy', () => { ); expect(eventData[0]).toBe(proxyAddress); + expect(eventData[1]).toBe(ethRequest.payee?.value); + expect(eventData[2]).toBe( + ethRequest.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT].values + .feeAddress, + ); + expect(eventData[3]).toBe( + ethRequest.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT].values + .feeAmount, + ); }); it('should deploy ERC20SingleRequestProxy and emit event', async () => { @@ -225,6 +234,16 @@ describe('deploySingleRequestProxy', () => { ); expect(eventData[0]).toBe(proxyAddress); + expect(eventData[1]).toBe(erc20Request.payee?.value); + expect(eventData[2]).toBe(erc20Request.currencyInfo.value); + expect(eventData[3]).toBe( + erc20Request.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ERC20_FEE_PROXY_CONTRACT].values + .feeAddress, + ); + expect(eventData[4]).toBe( + erc20Request.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ERC20_FEE_PROXY_CONTRACT].values + .feeAmount, + ); }); it('should throw error when trying to pay with invalid single request proxy', async () => { diff --git a/packages/smart-contracts/src/contracts/ERC20SingleRequestProxy.sol b/packages/smart-contracts/src/contracts/ERC20SingleRequestProxy.sol index c2cf1b534..69223555b 100644 --- a/packages/smart-contracts/src/contracts/ERC20SingleRequestProxy.sol +++ b/packages/smart-contracts/src/contracts/ERC20SingleRequestProxy.sol @@ -13,24 +13,24 @@ import './lib/SafeERC20.sol'; contract ERC20SingleRequestProxy { address public payee; address public tokenAddress; + bytes public paymentReference; address public feeAddress; uint256 public feeAmount; - bytes public paymentReference; IERC20FeeProxy public erc20FeeProxy; constructor( address _payee, address _tokenAddress, + bytes memory _paymentReference, address _feeAddress, uint256 _feeAmount, - bytes memory _paymentReference, address _erc20FeeProxy ) { payee = _payee; tokenAddress = _tokenAddress; + paymentReference = _paymentReference; feeAddress = _feeAddress; feeAmount = _feeAmount; - paymentReference = _paymentReference; erc20FeeProxy = IERC20FeeProxy(_erc20FeeProxy); } diff --git a/packages/smart-contracts/src/contracts/EthereumSingleRequestProxy.sol b/packages/smart-contracts/src/contracts/EthereumSingleRequestProxy.sol index 03d8752da..5eafe8209 100644 --- a/packages/smart-contracts/src/contracts/EthereumSingleRequestProxy.sol +++ b/packages/smart-contracts/src/contracts/EthereumSingleRequestProxy.sol @@ -30,9 +30,9 @@ contract EthereumSingleRequestProxy { constructor( address _payee, bytes memory _paymentReference, - address _ethereumFeeProxy, address _feeAddress, uint256 _feeAmount + address _ethereumFeeProxy, ) { payee = _payee; paymentReference = _paymentReference; diff --git a/packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol b/packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol index a88b1bb90..55c99c035 100644 --- a/packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol +++ b/packages/smart-contracts/src/contracts/SingleRequestProxyFactory.sol @@ -66,9 +66,9 @@ contract SingleRequestProxyFactory is Ownable { EthereumSingleRequestProxy proxy = new EthereumSingleRequestProxy( _payee, _paymentReference, - ethereumFeeProxy, _feeAddress, - _feeAmount + _feeAmount, + ethereumFeeProxy ); emit EthereumSingleRequestProxyCreated( address(proxy), @@ -100,9 +100,9 @@ contract SingleRequestProxyFactory is Ownable { ERC20SingleRequestProxy proxy = new ERC20SingleRequestProxy( _payee, _tokenAddress, + _paymentReference, _feeAddress, _feeAmount, - _paymentReference, erc20FeeProxy ); From 74281b697d6d8a36fe9b0c6912ecde67edf8107b Mon Sep 17 00:00:00 2001 From: MantisClone Date: Fri, 8 Nov 2024 12:57:33 -0500 Subject: [PATCH 5/9] fixup! Reorder function parameters for consistency. Improve test assertions --- .../src/contracts/EthereumSingleRequestProxy.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/smart-contracts/src/contracts/EthereumSingleRequestProxy.sol b/packages/smart-contracts/src/contracts/EthereumSingleRequestProxy.sol index 5eafe8209..259e62233 100644 --- a/packages/smart-contracts/src/contracts/EthereumSingleRequestProxy.sol +++ b/packages/smart-contracts/src/contracts/EthereumSingleRequestProxy.sol @@ -31,8 +31,8 @@ contract EthereumSingleRequestProxy { address _payee, bytes memory _paymentReference, address _feeAddress, - uint256 _feeAmount - address _ethereumFeeProxy, + uint256 _feeAmount, + address _ethereumFeeProxy ) { payee = _payee; paymentReference = _paymentReference; From 29145ed5c9b9bc9e897a1dab0cf20156d6a6a35e Mon Sep 17 00:00:00 2001 From: MantisClone Date: Fri, 8 Nov 2024 13:18:06 -0500 Subject: [PATCH 6/9] fix: SingleRequestProxy smart-contract tests --- .../test/contracts/ERC20SingleRequestProxy.test.ts | 6 +++--- .../test/contracts/EthereumSingleRequestProxy.test.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/smart-contracts/test/contracts/ERC20SingleRequestProxy.test.ts b/packages/smart-contracts/test/contracts/ERC20SingleRequestProxy.test.ts index 838464179..8652fe255 100644 --- a/packages/smart-contracts/test/contracts/ERC20SingleRequestProxy.test.ts +++ b/packages/smart-contracts/test/contracts/ERC20SingleRequestProxy.test.ts @@ -47,9 +47,9 @@ describe('contract: ERC20SingleRequestProxy', () => { erc20SingleRequestProxy = await new ERC20SingleRequestProxy__factory(deployer).deploy( user2Addr, testToken.address, + paymentReference, feeRecipientAddr, feeAmount, - paymentReference, erc20FeeProxy.address, ); @@ -156,9 +156,9 @@ describe('contract: ERC20SingleRequestProxy', () => { const usdtProxy = await new ERC20SingleRequestProxy__factory(deployer).deploy( user2Addr, usdtFake.address, + paymentReference, feeRecipientAddr, usdtFeeAmount, - paymentReference, erc20FeeProxy.address, ); @@ -210,9 +210,9 @@ describe('contract: ERC20SingleRequestProxy', () => { const zeroFeeProxy = await new ERC20SingleRequestProxy__factory(deployer).deploy( user2Addr, testToken.address, + paymentReference, feeRecipientAddr, 0, - paymentReference, erc20FeeProxy.address, ); diff --git a/packages/smart-contracts/test/contracts/EthereumSingleRequestProxy.test.ts b/packages/smart-contracts/test/contracts/EthereumSingleRequestProxy.test.ts index 7cb7982e5..90d370a61 100644 --- a/packages/smart-contracts/test/contracts/EthereumSingleRequestProxy.test.ts +++ b/packages/smart-contracts/test/contracts/EthereumSingleRequestProxy.test.ts @@ -30,9 +30,9 @@ describe('contract : EthereumSingleRequestProxy', () => { ethereumSingleRequestProxy = await ethereumSingleRequestProxyFactory.deploy( payeeAddress, paymentReference, - ethereumFeeProxy.address, feeRecipientAddress, feeAmount, + ethereumFeeProxy.address, ); await ethereumSingleRequestProxy.deployed(); }); @@ -87,9 +87,9 @@ describe('contract : EthereumSingleRequestProxy', () => { const newEthereumSingleRequestProxy = await newEthereumSingleRequestProxyFactory.deploy( payeeAddress, paymentReference, - mockEthereumFeeProxy.address, feeRecipientAddress, feeAmount, + mockEthereumFeeProxy.address, ); await newEthereumSingleRequestProxy.deployed(); From 9a37cec04a94726c60f84af34784e209aba150f7 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Fri, 8 Nov 2024 13:34:47 -0500 Subject: [PATCH 7/9] fix: CodeRabbit comments --- .../test/payment/single-request-proxy.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/payment-processor/test/payment/single-request-proxy.test.ts b/packages/payment-processor/test/payment/single-request-proxy.test.ts index cfcc34e22..50600bcae 100644 --- a/packages/payment-processor/test/payment/single-request-proxy.test.ts +++ b/packages/payment-processor/test/payment/single-request-proxy.test.ts @@ -204,6 +204,8 @@ describe('deploySingleRequestProxy', () => { ethRequest.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT].values .feeAmount, ); + const feeProxyUsed = await singleRequestProxyFactory.ethereumFeeProxy(); + expect(eventData[4]).toBe(feeProxyUsed); }); it('should deploy ERC20SingleRequestProxy and emit event', async () => { @@ -244,6 +246,8 @@ describe('deploySingleRequestProxy', () => { erc20Request.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ERC20_FEE_PROXY_CONTRACT].values .feeAmount, ); + const feeProxyUsed = await singleRequestProxyFactory.erc20FeeProxy(); + expect(eventData[5]).toBe(feeProxyUsed); }); it('should throw error when trying to pay with invalid single request proxy', async () => { From 35e327c3d7ec840a343bdb8d0be5fff3cdcf1443 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Fri, 8 Nov 2024 14:29:25 -0500 Subject: [PATCH 8/9] fix: variable name, remove unused variable --- .../test/payment/single-request-proxy.test.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/payment-processor/test/payment/single-request-proxy.test.ts b/packages/payment-processor/test/payment/single-request-proxy.test.ts index 50600bcae..e9036d880 100644 --- a/packages/payment-processor/test/payment/single-request-proxy.test.ts +++ b/packages/payment-processor/test/payment/single-request-proxy.test.ts @@ -170,9 +170,7 @@ describe('deploySingleRequestProxy', () => { it('should deploy EthereumSingleRequestProxy and emit event', async () => { const singleRequestProxyFactory = singleRequestProxyFactoryArtifact.connect('private', wallet); - const initialEventCount = await provider.getBlockNumber(); - - const walletAddress = await wallet.getAddress(); + const initialBlock = await provider.getBlockNumber(); const proxyAddress = await deploySingleRequestProxy(ethRequest, wallet); @@ -183,7 +181,7 @@ describe('deploySingleRequestProxy', () => { const latestBlock = await provider.getBlockNumber(); const events = await singleRequestProxyFactory.queryFilter( singleRequestProxyFactory.filters.EthereumSingleRequestProxyCreated(), - initialEventCount, + initialBlock, latestBlock, ); @@ -211,9 +209,7 @@ describe('deploySingleRequestProxy', () => { it('should deploy ERC20SingleRequestProxy and emit event', async () => { const singleRequestProxyFactory = singleRequestProxyFactoryArtifact.connect('private', wallet); - const initialEventCount = await provider.getBlockNumber(); - - const walletAddress = await wallet.getAddress(); + const initialBlock = await provider.getBlockNumber(); const proxyAddress = await deploySingleRequestProxy(erc20Request, wallet); @@ -224,7 +220,7 @@ describe('deploySingleRequestProxy', () => { const latestBlock = await provider.getBlockNumber(); const events = await singleRequestProxyFactory.queryFilter( singleRequestProxyFactory.filters.ERC20SingleRequestProxyCreated(), - initialEventCount, + initialBlock, latestBlock, ); From 93279f271539be4bfa161a066aaec199e6f7ff28 Mon Sep 17 00:00:00 2001 From: Aimen Sahnoun Date: Fri, 8 Nov 2024 22:55:12 +0300 Subject: [PATCH 9/9] chore: update event handling for deployment --- .../src/payment/single-request-proxy.ts | 8 +++-- .../test/payment/single-request-proxy.test.ts | 34 +++++++----------- .../SingleRequestProxyFactory/0.1.0.json | 36 +++++++++++++++++++ .../SingleRequestProxyFactory/index.ts | 4 +++ 4 files changed, 59 insertions(+), 23 deletions(-) diff --git a/packages/payment-processor/src/payment/single-request-proxy.ts b/packages/payment-processor/src/payment/single-request-proxy.ts index eb5e4f62b..17c1c2b2f 100644 --- a/packages/payment-processor/src/payment/single-request-proxy.ts +++ b/packages/payment-processor/src/payment/single-request-proxy.ts @@ -91,13 +91,17 @@ export async function deploySingleRequestProxy( const receipt = await tx.wait(); - const event = receipt.events?.[0]; + const event = receipt.events?.find( + (e) => + e.event === + (isERC20 ? 'ERC20SingleRequestProxyCreated' : 'EthereumSingleRequestProxyCreated'), + ); if (!event) { throw new Error('Single request proxy creation event not found'); } - const proxyAddress = ethers.utils.defaultAbiCoder.decode(['address', 'address'], event.data)[0]; + const proxyAddress = event.args?.proxyAddress || event.args?.[0]; if (!proxyAddress) { throw new Error('Proxy address not found in event data'); diff --git a/packages/payment-processor/test/payment/single-request-proxy.test.ts b/packages/payment-processor/test/payment/single-request-proxy.test.ts index e9036d880..7db5bb8f4 100644 --- a/packages/payment-processor/test/payment/single-request-proxy.test.ts +++ b/packages/payment-processor/test/payment/single-request-proxy.test.ts @@ -187,23 +187,19 @@ describe('deploySingleRequestProxy', () => { expect(events.length).toBeGreaterThan(0); - const eventData = utils.defaultAbiCoder.decode( - ['address', 'address', 'address', 'uint256', 'address'], - events[0].data, - ); - - expect(eventData[0]).toBe(proxyAddress); - expect(eventData[1]).toBe(ethRequest.payee?.value); - expect(eventData[2]).toBe( + const event = events[0]; + expect(event.args?.proxyAddress).toBe(proxyAddress); + expect(event.args?.payee).toBe(ethRequest.payee?.value); + expect(event.args?.feeAddress).toBe( ethRequest.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT].values .feeAddress, ); - expect(eventData[3]).toBe( + expect(event.args?.feeAmount.toString()).toBe( ethRequest.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT].values .feeAmount, ); const feeProxyUsed = await singleRequestProxyFactory.ethereumFeeProxy(); - expect(eventData[4]).toBe(feeProxyUsed); + expect(event.args?.feeProxyUsed).toBe(feeProxyUsed); }); it('should deploy ERC20SingleRequestProxy and emit event', async () => { @@ -226,24 +222,20 @@ describe('deploySingleRequestProxy', () => { expect(events.length).toBeGreaterThan(0); - const eventData = utils.defaultAbiCoder.decode( - ['address', 'address', 'address', 'address', 'uint256', 'address'], - events[0].data, - ); - - expect(eventData[0]).toBe(proxyAddress); - expect(eventData[1]).toBe(erc20Request.payee?.value); - expect(eventData[2]).toBe(erc20Request.currencyInfo.value); - expect(eventData[3]).toBe( + const event = events[0]; + expect(event.args?.proxyAddress).toBe(proxyAddress); + expect(event.args?.payee).toBe(erc20Request.payee?.value); + expect(event.args?.tokenAddress).toBe(erc20Request.currencyInfo.value); + expect(event.args?.feeAddress).toBe( erc20Request.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ERC20_FEE_PROXY_CONTRACT].values .feeAddress, ); - expect(eventData[4]).toBe( + expect(event.args?.feeAmount.toString()).toBe( erc20Request.extensions[ExtensionTypes.PAYMENT_NETWORK_ID.ERC20_FEE_PROXY_CONTRACT].values .feeAmount, ); const feeProxyUsed = await singleRequestProxyFactory.erc20FeeProxy(); - expect(eventData[5]).toBe(feeProxyUsed); + expect(event.args?.feeProxyUsed).toBe(feeProxyUsed); }); it('should throw error when trying to pay with invalid single request proxy', async () => { diff --git a/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/0.1.0.json b/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/0.1.0.json index e5aae47dc..d2b1b9f61 100644 --- a/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/0.1.0.json +++ b/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/0.1.0.json @@ -60,6 +60,24 @@ "internalType": "bytes", "name": "paymentReference", "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "feeAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "feeProxyUsed", + "type": "address" } ], "name": "ERC20SingleRequestProxyCreated", @@ -98,6 +116,24 @@ "internalType": "bytes", "name": "paymentReference", "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "feeAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "feeProxyUsed", + "type": "address" } ], "name": "EthereumSingleRequestProxyCreated", diff --git a/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts b/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts index 7ca4e4f55..6eed98ac9 100644 --- a/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts +++ b/packages/smart-contracts/src/lib/artifacts/SingleRequestProxyFactory/index.ts @@ -13,6 +13,10 @@ export const singleRequestProxyFactoryArtifact = new ContractArtifact