-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: cleaned code changed event name
- Loading branch information
Showing
10 changed files
with
151 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected] | ||
* 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) | ||
|
92 changes: 0 additions & 92 deletions
92
src/modules/paymentProcessor/abstracts/CrossChainBase_v1.sol
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected] | ||
* 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]; | ||
} | ||
{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected] | ||
* 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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/modules/paymentProcessor/interfaces/IPP_Connext_Crosschain.sol
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.