From 4aa8384baec9effc6dfc8e45eb36b548e01ff6f5 Mon Sep 17 00:00:00 2001 From: Leandro Faria Date: Wed, 27 Nov 2024 16:49:27 -0500 Subject: [PATCH] chore: cleaned code changed event name --- .../PP_Connext_Crosschain_v1.sol | 45 +++++++-- .../abstracts/CrossChainBase_v1.sol | 92 ------------------- .../abstracts/CrosschainBase_v1.sol | 46 +++------- .../abstracts/PP_Crosschain_v1.sol | 20 ++-- .../interfaces/ICrosschainBase_v1.sol | 28 +++--- .../interfaces/IPP_Connext_Crosschain.sol | 13 --- .../interfaces/IPP_Connext_Crosschain_v1.sol | 30 +++++- .../interfaces/IPP_Crosschain_v1.sol | 14 +-- .../abstracts/CrossChainBase_v1.t.sol | 14 ++- .../PP_Connext_Crosschain_v1_Test.t.sol | 41 ++++++--- 10 files changed, 151 insertions(+), 192 deletions(-) delete mode 100644 src/modules/paymentProcessor/abstracts/CrossChainBase_v1.sol delete mode 100644 src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain.sol diff --git a/src/modules/paymentProcessor/PP_Connext_Crosschain_v1.sol b/src/modules/paymentProcessor/PP_Connext_Crosschain_v1.sol index 401406ee3..1a83e122d 100644 --- a/src/modules/paymentProcessor/PP_Connext_Crosschain_v1.sol +++ b/src/modules/paymentProcessor/PP_Connext_Crosschain_v1.sol @@ -4,6 +4,8 @@ import {CrossChainBase_v1} from "src/modules/paymentProcessor/abstracts/CrossChainBase_v1.sol"; import {ICrossChainBase_v1} from "src/modules/paymentProcessor/interfaces/ICrosschainBase_v1.sol"; +import {IPP_Connext_Crosschain_v1} from + "src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain_v1.sol"; import {IERC20PaymentClientBase_v1} from "@lm/interfaces/IERC20PaymentClientBase_v1.sol"; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; @@ -16,9 +18,23 @@ import {IOrchestrator_v1} from "src/orchestrator/interfaces/IOrchestrator_v1.sol"; import {Module_v1} from "src/modules/base/Module_v1.sol"; -/// @title PP_Connext_Crosschain_v1 -/// @notice Payment processor implementation for cross-chain payments using Connext -/// @dev Extends PP_Crosschain_v1 to handle cross-chain token transfers +/** + * @title Connext Cross-chain Payment Processor + * + * @notice Payment processor implementation for cross-chain payments using the Connext protocol. + * + * @dev This contract implements cross-chain payment processing via Connext and provides: + * - Integration with Connext's EverClear protocol for cross-chain transfers + * - WETH handling for native token wrapping + * - Implementation of bridge-specific transfer logic + * - Payment order processing and validation + * - Bridge data storage and retrieval + * - Support for Base network (chainId: 8453) + * + * @custom:security-contact security@inverter.network + * In case of any concerns or findings, please refer to our Security Policy + * at security.inverter.network + */ contract PP_Connext_Crosschain_v1 is PP_Crosschain_v1 { IEverclearSpoke public everClearSpoke; IWETH public weth; @@ -50,6 +66,11 @@ contract PP_Connext_Crosschain_v1 is PP_Crosschain_v1 { ) internal override returns (bytes memory) { //@notice call the connextBridgeLogic to execute the bridge transfer bytes32 intentId = xcall(order, executionData); + if (intentId == bytes32(0)) { + revert Module__PP_Crosschain__MessageDeliveryFailed( + 8453, 8453, executionData + ); + } return abi.encode(intentId); } @@ -69,11 +90,14 @@ contract PP_Connext_Crosschain_v1 is PP_Crosschain_v1 { _executeBridgeTransfer(orders[i], executionData); _bridgeData[i] = bridgeData; - emit PaymentProcessed( - _paymentId, + emit PaymentOrderProcessed( + address(client), orders[i].recipient, orders[i].paymentToken, - orders[i].amount + orders[i].amount, + orders[i].start, + orders[i].cliff, + orders[i].end ); _paymentId++; @@ -102,10 +126,13 @@ contract PP_Connext_Crosschain_v1 is PP_Crosschain_v1 { if (order.recipient == address(0)) { revert ICrossChainBase_v1.Module__CrossChainBase__InvalidRecipient(); } - + // Decode the execution data (uint maxFee, uint ttl) = abi.decode(executionData, (uint, uint)); + if (ttl == 0) { - revert ICrossChainBase_v1.Module__CrossChainBase_InvalidTTL(); + revert + IPP_Connext_Crosschain_v1 + .Module__PP_Connext_Crosschain__InvalidTTL(); } // Wrap ETH into WETH to send with the xcall @@ -143,7 +170,7 @@ contract PP_Connext_Crosschain_v1 is PP_Crosschain_v1 { /// @param paymentId The unique identifier of the payment /// @return The bridge data associated with the payment (encoded intentId) function getBridgeData(uint paymentId) - external + public view override returns (bytes memory) diff --git a/src/modules/paymentProcessor/abstracts/CrossChainBase_v1.sol b/src/modules/paymentProcessor/abstracts/CrossChainBase_v1.sol deleted file mode 100644 index 78f987b6e..000000000 --- a/src/modules/paymentProcessor/abstracts/CrossChainBase_v1.sol +++ /dev/null @@ -1,92 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-only -pragma solidity 0.8.23; - -import {IOrchestrator_v1} from - "src/orchestrator/interfaces/IOrchestrator_v1.sol"; -import {IPaymentProcessor_v1} from "@pp/IPaymentProcessor_v1.sol"; -import {IERC20PaymentClientBase_v1} from - "@lm/interfaces/IERC20PaymentClientBase_v1.sol"; -import {Module_v1} from "src/modules/base/Module_v1.sol"; -//import {IPP_CrossChain_v1} from "./IPP_Template_v1.sol"; -import {ERC165Upgradeable, Module_v1} from "src/modules/base/Module_v1.sol"; -import {ICrossChainBase_v1} from "../interfaces/ICrosschainBase_v1.sol"; -/** - * @title Inverter Template Payment Processor - * - * @notice Basic template payment processor used as base for developing new payment processors. - * - * @dev This contract is used to showcase a basic setup for a payment processor. The contract showcases the - * following: - * - Inherit from the Module_v1 contract to enable interaction with the Inverter workflow. - * - Use of the IPaymentProcessor_v1 interface to facilitate interaction with a payment client. - * - Implement custom interface which has all the public facing functions, errors, events and structs. - * - Pre-defined layout for all contract functions, modifiers, state variables etc. - * - Use of the ERC165Upgradeable contract to check for interface support. - * - * @custom:security-contact security@inverter.network - * In case of any concerns or findings, please refer to our Security Policy - * at security.inverter.network or email us directly! - * - * @author Inverter Network - */ - -abstract contract CrossChainBase_v1 is ICrossChainBase_v1, Module_v1 { - mapping(uint => bytes) internal _bridgeData; - /// @inheritdoc ERC165Upgradeable - - function supportsInterface(bytes4 interfaceId_) - public - view - virtual - override(Module_v1) - returns (bool) - { - return interfaceId_ == type(ICrossChainBase_v1).interfaceId - || super.supportsInterface(interfaceId_); - } - //-------------------------------------------------------------------------- - // State - - /// @dev The number of payment orders. - uint internal _paymentId; - - //-------------------------------------------------------------------------- - // Events - - event PaymentProcessed( - uint indexed paymentId, address recipient, address token, uint amount - ); - - //-------------------------------------------------------------------------- - // Virtual Functions - - /// @notice Execute the cross-chain bridge transfer - /// @dev Override this function to implement specific bridge logic - /// @param order The payment order containing all necessary transfer details - /// @return bridgeData Arbitrary data returned by the bridge implementation - function _executeBridgeTransfer( - IERC20PaymentClientBase_v1.PaymentOrder memory order, - bytes memory executionData - ) internal virtual returns (bytes memory) { - emit BridgeTransferExecuted(executionData); - return bytes(""); - } - /// @notice Process payments for a given payment client - /// @param client The payment client to process payments for - - function processPayments(IERC20PaymentClientBase_v1 client) - external - virtual - {} - - /// @notice Get the bridge data for a given payment ID - /// @param paymentId The ID of the payment to get the bridge data for - /// @return The bridge data for the given payment ID - function getBridgeData(uint paymentId) - external - view - returns (bytes memory) - { - return _bridgeData[paymentId]; - } -} diff --git a/src/modules/paymentProcessor/abstracts/CrosschainBase_v1.sol b/src/modules/paymentProcessor/abstracts/CrosschainBase_v1.sol index 78f987b6e..a954223f0 100644 --- a/src/modules/paymentProcessor/abstracts/CrosschainBase_v1.sol +++ b/src/modules/paymentProcessor/abstracts/CrosschainBase_v1.sol @@ -7,21 +7,19 @@ import {IPaymentProcessor_v1} from "@pp/IPaymentProcessor_v1.sol"; import {IERC20PaymentClientBase_v1} from "@lm/interfaces/IERC20PaymentClientBase_v1.sol"; import {Module_v1} from "src/modules/base/Module_v1.sol"; -//import {IPP_CrossChain_v1} from "./IPP_Template_v1.sol"; import {ERC165Upgradeable, Module_v1} from "src/modules/base/Module_v1.sol"; import {ICrossChainBase_v1} from "../interfaces/ICrosschainBase_v1.sol"; /** - * @title Inverter Template Payment Processor + * @title Cross-chain Base Contract * - * @notice Basic template payment processor used as base for developing new payment processors. + * @notice Abstract base contract providing core cross-chain functionality for payment processors. * - * @dev This contract is used to showcase a basic setup for a payment processor. The contract showcases the - * following: - * - Inherit from the Module_v1 contract to enable interaction with the Inverter workflow. - * - Use of the IPaymentProcessor_v1 interface to facilitate interaction with a payment client. - * - Implement custom interface which has all the public facing functions, errors, events and structs. - * - Pre-defined layout for all contract functions, modifiers, state variables etc. - * - Use of the ERC165Upgradeable contract to check for interface support. + * @dev This contract implements fundamental cross-chain operations and provides: + * - Bridge data storage and retrieval functionality + * - Abstract interface for bridge transfer execution + * - Integration with the Module_v1 base contract + * - Implementation of ICrossChainBase_v1 interface + * - ERC165 interface support for cross-chain functionality * * @custom:security-contact security@inverter.network * In case of any concerns or findings, please refer to our Security Policy @@ -32,8 +30,8 @@ import {ICrossChainBase_v1} from "../interfaces/ICrosschainBase_v1.sol"; abstract contract CrossChainBase_v1 is ICrossChainBase_v1, Module_v1 { mapping(uint => bytes) internal _bridgeData; - /// @inheritdoc ERC165Upgradeable + /// @inheritdoc ERC165Upgradeable function supportsInterface(bytes4 interfaceId_) public view @@ -44,18 +42,6 @@ abstract contract CrossChainBase_v1 is ICrossChainBase_v1, Module_v1 { return interfaceId_ == type(ICrossChainBase_v1).interfaceId || super.supportsInterface(interfaceId_); } - //-------------------------------------------------------------------------- - // State - - /// @dev The number of payment orders. - uint internal _paymentId; - - //-------------------------------------------------------------------------- - // Events - - event PaymentProcessed( - uint indexed paymentId, address recipient, address token, uint amount - ); //-------------------------------------------------------------------------- // Virtual Functions @@ -67,13 +53,10 @@ abstract contract CrossChainBase_v1 is ICrossChainBase_v1, Module_v1 { function _executeBridgeTransfer( IERC20PaymentClientBase_v1.PaymentOrder memory order, bytes memory executionData - ) internal virtual returns (bytes memory) { - emit BridgeTransferExecuted(executionData); - return bytes(""); - } + ) internal virtual returns (bytes memory) {} + /// @notice Process payments for a given payment client /// @param client The payment client to process payments for - function processPayments(IERC20PaymentClientBase_v1 client) external virtual @@ -83,10 +66,9 @@ abstract contract CrossChainBase_v1 is ICrossChainBase_v1, Module_v1 { /// @param paymentId The ID of the payment to get the bridge data for /// @return The bridge data for the given payment ID function getBridgeData(uint paymentId) - external + public view + virtual returns (bytes memory) - { - return _bridgeData[paymentId]; - } + {} } diff --git a/src/modules/paymentProcessor/abstracts/PP_Crosschain_v1.sol b/src/modules/paymentProcessor/abstracts/PP_Crosschain_v1.sol index ebe49d1b2..3a9f45206 100644 --- a/src/modules/paymentProcessor/abstracts/PP_Crosschain_v1.sol +++ b/src/modules/paymentProcessor/abstracts/PP_Crosschain_v1.sol @@ -23,17 +23,16 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; import {IPP_Crosschain_v1} from "../interfaces/IPP_Crosschain_v1.sol"; /** - * @title Inverter Template Payment Processor + * @title Cross-chain Payment Processor Base Contract * - * @notice Basic template payment processor used as base for developing new payment processors. + * @notice Abstract base contract for implementing cross-chain payment processing functionality. * - * @dev This contract is used to showcase a basic setup for a payment processor. The contract showcases the - * following: - * - Inherit from the Module_v1 contract to enable interaction with the Inverter workflow. - * - Use of the IPaymentProcessor_v1 interface to facilitate interaction with a payment client. - * - Implement custom interface which has all the public facing functions, errors, events and structs. - * - Pre-defined layout for all contract functions, modifiers, state variables etc. - * - Use of the ERC165Upgradeable contract to check for interface support. + * @dev This contract serves as the base for cross-chain payment processors and provides: + * - Extension of CrossChainBase_v1 for cross-chain functionality + * - Implementation of IPP_Crosschain_v1 interface + * - Core payment validation logic + * - Basic security checks for payment processing + * - Abstract functions for bridge-specific implementations * * @custom:security-contact security@inverter.network * In case of any concerns or findings, please refer to our Security Policy @@ -81,6 +80,9 @@ abstract contract PP_Crosschain_v1 is CrossChainBase_v1, IPP_Crosschain_v1 { /// @dev Gap for possible future upgrades. uint[50] private __gap; + //@dev paymentId + uint public _paymentId; + //-------------------------------------------------------------------------- // Virtual Functions diff --git a/src/modules/paymentProcessor/interfaces/ICrosschainBase_v1.sol b/src/modules/paymentProcessor/interfaces/ICrosschainBase_v1.sol index 17fd04707..5e5c7825f 100644 --- a/src/modules/paymentProcessor/interfaces/ICrosschainBase_v1.sol +++ b/src/modules/paymentProcessor/interfaces/ICrosschainBase_v1.sol @@ -7,11 +7,15 @@ pragma solidity ^0.8.0; import {IERC20PaymentClientBase_v1} from "@lm/interfaces/IERC20PaymentClientBase_v1.sol"; +/// @title ICrossChainBase_v1 +/// @notice Base interface for cross-chain payment processing functionality interface ICrossChainBase_v1 { - //-------------------------------------------------------------------------- - // Structs - /// @notice Struct to hold cross-chain message data + /// @param messageId Unique identifier for the cross-chain message + /// @param sourceChain Address or identifier of the source chain + /// @param targetChain Address or identifier of the target chain + /// @param payload The encoded data being sent across chains + /// @param executed Boolean flag indicating if the message has been processed struct CrossChainMessage { uint messageId; address sourceChain; @@ -24,32 +28,30 @@ interface ICrossChainBase_v1 { // Events /// @notice Emitted when a bridge transfer is executed + /// @param bridgeData The encoded data of the bridge transfer event BridgeTransferExecuted(bytes indexed bridgeData); //-------------------------------------------------------------------------- // Errors - /// @notice Amount can not be zero. + /// @notice Thrown when attempting to process a transfer with zero amount error Module__CrossChainBase__InvalidAmount(); - /// @notice Client is not valid. + /// @notice Thrown when an unauthorized client attempts to interact with the contract error Module__CrossChainBase__NotValidClient(); - /// @notice Message has already been executed + /// @notice Thrown when attempting to execute a message that has already been processed error Module__CrossChainBase_MessageAlreadyExecuted(); - /// @notice Invalid TTL provided - error Module__CrossChainBase_InvalidTTL(); - - /// @notice Invalid chain ID provided + /// @notice Thrown when an unsupported or invalid chain ID is provided error Module__CrossChainBase_InvalidChainId(); - /// @notice Message verification failed + /// @notice Thrown when the cross-chain message fails verification error Module__CrossChainBase_MessageVerificationFailed(); - /// @notice Invalid execution data + /// @notice Thrown when the provided execution data is malformed or invalid error Module__CrossChainBase_InvalidExecutionData(); - /// @notice Invalid recipient + /// @notice Thrown when the recipient address is invalid or not allowed error Module__CrossChainBase__InvalidRecipient(); } diff --git a/src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain.sol b/src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain.sol deleted file mode 100644 index dd034d85a..000000000 --- a/src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-only -pragma solidity ^0.8.0; - -// Internal Interfaces -import {IERC20PaymentClientBase_v1} from - "@lm/interfaces/IERC20PaymentClientBase_v1.sol"; -import {IPaymentProcessor_v1} from - "src/modules/paymentProcessor/IPaymentProcessor_v1.sol"; - -// External Interfaces -import {IERC20} from "@oz/token/ERC20/IERC20.sol"; - -interface IPP_Connext_Crosschain is IPaymentProcessor_v1 {} diff --git a/src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain_v1.sol b/src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain_v1.sol index 795bcdefb..c296de066 100644 --- a/src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain_v1.sol +++ b/src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain_v1.sol @@ -1,23 +1,42 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.20; +// Internal Dependencies import {IPaymentProcessor_v1} from "src/modules/paymentProcessor/IPaymentProcessor_v1.sol"; -import {IERC20PaymentClientBase_v1} from - "@lm/interfaces/IERC20PaymentClientBase_v1.sol"; import {IEverclearSpoke} from "src/modules/paymentProcessor/interfaces/IEverclear.sol"; + +// External Dependencies +import {IERC20PaymentClientBase_v1} from + "@lm/interfaces/IERC20PaymentClientBase_v1.sol"; import {IWETH} from "src/modules/paymentProcessor/interfaces/IWETH.sol"; +/// @notice Interface for cross-chain payment processing using Connext protocol interface IPP_Connext_Crosschain_v1 is IPaymentProcessor_v1 { + //-------------------------------------------------------------------------- + // Errors + + /// @notice Thrown when the provided Time-To-Live (TTL) parameter is invalid + error Module__PP_Connext_Crosschain__InvalidTTL(); + + //-------------------------------------------------------------------------- + // View Functions + /// @notice Returns the Everclear spoke contract instance + /// @return The IEverclearSpoke contract interface function everClearSpoke() external view returns (IEverclearSpoke); /// @notice Returns the WETH contract instance + /// @return The IWETH contract interface used for wrapping/unwrapping ETH function weth() external view returns (IWETH); + //-------------------------------------------------------------------------- + // External Functions + /// @notice Process payments for a given client with execution data - /// @param client The payment client contract + /// @dev This function handles the cross-chain payment processing using Connext + /// @param client The payment client contract initiating the payment /// @param executionData The encoded execution parameters (maxFee, ttl) function processPayments( IERC20PaymentClientBase_v1 client, @@ -25,8 +44,9 @@ interface IPP_Connext_Crosschain_v1 is IPaymentProcessor_v1 { ) external; /// @notice Get bridge data for a specific payment ID - /// @param paymentId The ID of the payment - /// @return The bridge data associated with the payment + /// @dev Used to retrieve information about a cross-chain payment + /// @param paymentId The ID of the payment to query + /// @return The bridge data associated with the payment (encoded bytes) function getBridgeData(uint paymentId) external view diff --git a/src/modules/paymentProcessor/interfaces/IPP_Crosschain_v1.sol b/src/modules/paymentProcessor/interfaces/IPP_Crosschain_v1.sol index bb147c27f..0efaba763 100644 --- a/src/modules/paymentProcessor/interfaces/IPP_Crosschain_v1.sol +++ b/src/modules/paymentProcessor/interfaces/IPP_Crosschain_v1.sol @@ -1,17 +1,21 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -// Internal Interfaces +// Internal Dependencies import {IPaymentProcessor_v1} from "src/modules/paymentProcessor/IPaymentProcessor_v1.sol"; +/// @notice Interface for cross-chain payment processing functionality interface IPP_Crosschain_v1 is IPaymentProcessor_v1 { + //-------------------------------------------------------------------------- + // Errors + /// @notice Thrown when the cross-chain message fails to be delivered /// @param sourceChain The chain ID where the message originated /// @param destinationChain The chain ID where the message was meant to be delivered - /// @param messageId The unique identifier of the failed message + /// @param executionData The encoded execution parameters (maxFee, ttl) error Module__PP_Crosschain__MessageDeliveryFailed( - uint sourceChain, uint destinationChain, bytes32 messageId + uint sourceChain, uint destinationChain, bytes executionData ); /// @notice Thrown when attempting to process a cross-chain payment with invalid parameters @@ -23,7 +27,5 @@ interface IPP_Crosschain_v1 is IPaymentProcessor_v1 { ); /// @notice Thrown when the cross-chain bridge fees exceed the maximum allowed - /// @param actualFee The actual fee required - /// @param maxFee The maximum fee allowed - error Module__PP_Crosschain__BridgeFeeTooHigh(uint actualFee, uint maxFee); + error Module__PP_Crosschain__InvalidBridgeFee(); } diff --git a/test/modules/paymentProcessor/bridging/abstracts/CrossChainBase_v1.t.sol b/test/modules/paymentProcessor/bridging/abstracts/CrossChainBase_v1.t.sol index 9b7827362..b6107074d 100644 --- a/test/modules/paymentProcessor/bridging/abstracts/CrossChainBase_v1.t.sol +++ b/test/modules/paymentProcessor/bridging/abstracts/CrossChainBase_v1.t.sol @@ -81,12 +81,19 @@ contract CrossChainBase_v1_Test is ModuleTest { //-------------------------------------------------------------------------- //Test: Initialization + /* Given the contract is initialized + When checking the initialization + Then it should have the correct orchestrator address */ function testInit() public override(ModuleTest) { assertEq(address(crossChainBase.orchestrator()), address(_orchestrator)); } //-------------------------------------------------------------------------- //Test: Interface Support + /* Given the contract is initialized + When checking interface support + Then it should support ICrossChainBase_v1 + And it should not support random interfaces */ function testSupportsInterface() public { // Test for ICrossChainBase_v1 interface support bytes4 interfaceId = type(ICrossChainBase_v1).interfaceId; @@ -97,7 +104,9 @@ contract CrossChainBase_v1_Test is ModuleTest { assertFalse(crossChainBase.supportsInterface(randomInterfaceId)); } - //Test the reinit function + /* Given the contract is already initialized + When trying to reinitialize + Then it should revert */ function testReinitFails() public override(ModuleTest) { vm.expectRevert(OZErrors.Initializable__InvalidInitialization); crossChainBase.init(_orchestrator, _METADATA, abi.encode(1)); @@ -105,6 +114,9 @@ contract CrossChainBase_v1_Test is ModuleTest { //-------------------------------------------------------------------------- //Test: executeBridgeTransfer + /* Given a valid payment order + When executeBridgeTransfer is called + Then it should return empty bytes */ function testExecuteBridgeTransfer() public { address[] memory setupRecipients = new address[](1); setupRecipients[0] = address(1); diff --git a/test/modules/paymentProcessor/bridging/abstracts/PP_Connext_Crosschain_v1_Test.t.sol b/test/modules/paymentProcessor/bridging/abstracts/PP_Connext_Crosschain_v1_Test.t.sol index 3a4935972..02331995f 100644 --- a/test/modules/paymentProcessor/bridging/abstracts/PP_Connext_Crosschain_v1_Test.t.sol +++ b/test/modules/paymentProcessor/bridging/abstracts/PP_Connext_Crosschain_v1_Test.t.sol @@ -47,11 +47,14 @@ contract PP_Connext_Crosschain_v1_Test is ModuleTest { uint public chainId; // Add this event definition at the contract level - event PaymentProcessed( - uint indexed paymentId, - address recipient, - address paymentToken, - uint amount + event PaymentOrderProcessed( + address indexed paymentClient, + address indexed recipient, + address indexed paymentToken, + uint amount, + uint start, + uint cliff, + uint end ); // Add these as contract state variables @@ -178,11 +181,14 @@ contract PP_Connext_Crosschain_v1_Test is ModuleTest { // Expect the event vm.expectEmit(true, true, true, true); - emit PaymentProcessed( - 0, // paymentId + emit PaymentOrderProcessed( + address(paymentClient), testRecipient, address(token), - testAmount + testAmount, + block.timestamp, + 0, + block.timestamp + 1 days ); // Process payments @@ -230,11 +236,14 @@ contract PP_Connext_Crosschain_v1_Test is ModuleTest { // Expect events for each payment for (uint i = 0; i < numRecipients; i++) { vm.expectEmit(true, true, true, true); - emit PaymentProcessed( - i, // paymentId + emit PaymentOrderProcessed( + address(paymentClient), setupRecipients[i], address(token), - setupAmounts[i] + setupAmounts[i], + block.timestamp, + 0, + block.timestamp + 1 days ); } @@ -476,7 +485,15 @@ contract PP_Connext_Crosschain_v1_Test is ModuleTest { // Expectations vm.expectEmit(true, true, true, true); - emit PaymentProcessed(0, testRecipient, address(token), testAmount); + emit PaymentOrderProcessed( + address(paymentClient), + testRecipient, + address(token), + testAmount, + block.timestamp, + 0, + block.timestamp + 1 days + ); // Action paymentProcessor.processPayments(