diff --git a/contracts/package-lock.json b/contracts/package-lock.json index 1d18fc2c..2d84db02 100644 --- a/contracts/package-lock.json +++ b/contracts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@iden3/contracts", - "version": "2.4.3", + "version": "2.4.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@iden3/contracts", - "version": "2.4.3", + "version": "2.4.6", "license": "GPL-3.0", "dependencies": { "@openzeppelin/contracts": "^5.0.2", diff --git a/contracts/package.json b/contracts/package.json index 871acc25..5c0cd201 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -1,7 +1,7 @@ { "name": "@iden3/contracts", "description": "Smart Contract library for Solidity", - "version": "2.4.5", + "version": "2.4.6", "files": [ "**/*.sol", "/build/contracts/*.json", diff --git a/contracts/payment/MCPayment.sol b/contracts/payment/MCPayment.sol index 7d246cc8..5f10db4a 100644 --- a/contracts/payment/MCPayment.sol +++ b/contracts/payment/MCPayment.sol @@ -152,7 +152,7 @@ contract MCPayment is Ownable2StepUpgradeable, EIP712Upgradeable { bytes memory signature ) external { _checkERC20Payment(paymentData, signature); - _transferERC20(paymentData, signature); + _transferERC20(paymentData); } function payERC20Permit( @@ -187,7 +187,7 @@ contract MCPayment is Ownable2StepUpgradeable, EIP712Upgradeable { r, s ); - _transferERC20(paymentData, signature); + _transferERC20(paymentData); } function isPaymentDone(address recipient, uint256 nonce) external view returns (bool) { @@ -209,7 +209,7 @@ contract MCPayment is Ownable2StepUpgradeable, EIP712Upgradeable { keccak256(paymentData.metadata) ) ); - if (!_isSignatureValid(structHash, signature, paymentData.recipient)) { + if (!_isSignatureValid(structHash, signature)) { revert InvalidSignature("MCPayment: invalid signature for Iden3PaymentRailsRequestV1"); } } @@ -230,7 +230,7 @@ contract MCPayment is Ownable2StepUpgradeable, EIP712Upgradeable { ) ); - if (!_isSignatureValid(structHash, signature, paymentData.recipient)) { + if (!_isSignatureValid(structHash, signature)) { revert InvalidSignature( "MCPayment: invalid signature for Iden3PaymentRailsERC20RequestV1" ); @@ -253,10 +253,7 @@ contract MCPayment is Ownable2StepUpgradeable, EIP712Upgradeable { } } - function _transferERC20( - Iden3PaymentRailsERC20RequestV1 memory paymentData, - bytes memory signature - ) internal { + function _transferERC20(Iden3PaymentRailsERC20RequestV1 memory paymentData) internal { IERC20 token = IERC20(paymentData.tokenAddress); if (token.transferFrom(msg.sender, address(this), paymentData.amount)) { MCPaymentStorage storage $ = _getMCPaymentStorage(); @@ -277,13 +274,12 @@ contract MCPayment is Ownable2StepUpgradeable, EIP712Upgradeable { function _isSignatureValid( bytes32 structHash, - bytes memory signature, - address recipient + bytes memory signature ) internal view returns (bool) { bytes32 hashTypedData = _hashTypedDataV4(structHash); - (address recovered, ECDSA.RecoverError err, ) = hashTypedData.tryRecover(signature); + (, ECDSA.RecoverError err, ) = hashTypedData.tryRecover(signature); - if (err != ECDSA.RecoverError.NoError || recovered != recipient) { + if (err != ECDSA.RecoverError.NoError) { return false; }