From 6954b96c9c4fb4db897b107422ea607cbaece511 Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 14 Aug 2024 20:35:07 +0530 Subject: [PATCH] minor fixes --- src/PayGatewayModule.sol | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/PayGatewayModule.sol b/src/PayGatewayModule.sol index 6a7b48c..258a001 100644 --- a/src/PayGatewayModule.sol +++ b/src/PayGatewayModule.sol @@ -119,6 +119,7 @@ contract PayGatewayModule is EIP712, ModularModule, ReentrancyGuard { error PayGatewayVerificationFailed(); error PayGatewayFailedToForward(); error PayGatewayRequestExpired(uint256 expirationTimestamp); + error PaymentsGatewayMsgValueNotZero(); /*////////////////////////////////////////////////////////////// EXTENSION CONFIG @@ -151,6 +152,11 @@ contract PayGatewayModule is EIP712, ModularModule, ReentrancyGuard { External / public functions //////////////////////////////////////////////////////////////*/ + /// @notice check if transaction id has been used / processed + function isProcessed(bytes32 transactionId) external view returns (bool) { + return PayGatewayModuleStorage.data().processed[transactionId]; + } + /// @notice some bridges may refund need a way to get funds back to user function withdrawTo(address tokenAddress, uint256 tokenAmount, address payable receiver) public nonReentrant { if (_isTokenERC20(tokenAddress)) { @@ -269,13 +275,17 @@ contract PayGatewayModule is EIP712, ModularModule, ReentrancyGuard { } if (_isTokenNative(tokenAddress)) { - if (msg.value < tokenAmount) { + if (msg.value != tokenAmount) { revert PayGatewayMismatchedValue(tokenAmount, msg.value); } } // pull user funds if (_isTokenERC20(tokenAddress)) { + if (msg.value != 0) { + revert PaymentsGatewayMsgValueNotZero(); + } + SafeTransferLib.safeTransferFrom(tokenAddress, msg.sender, receiverAddress, tokenAmount); } else { SafeTransferLib.safeTransferETH(receiverAddress, tokenAmount);