From b222457b3bad436974c1edb0b03ab9de118cd08b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernesto=20Garc=C3=ADa?= Date: Wed, 8 Jan 2025 10:27:19 -0600 Subject: [PATCH] Add missing documentation contract (#62) --- .../utils/cryptography/ERC7739SignerECDSA.sol | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 contracts/mocks/docs/utils/cryptography/ERC7739SignerECDSA.sol diff --git a/contracts/mocks/docs/utils/cryptography/ERC7739SignerECDSA.sol b/contracts/mocks/docs/utils/cryptography/ERC7739SignerECDSA.sol new file mode 100644 index 0000000..78a2fbf --- /dev/null +++ b/contracts/mocks/docs/utils/cryptography/ERC7739SignerECDSA.sol @@ -0,0 +1,24 @@ +// contracts/ERC7739SignerECDSA.sol +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; + +import {ERC7739Signer} from "../../../../utils/cryptography/ERC7739Signer.sol"; + +contract ERC7739SignerECDSA is ERC7739Signer { + address private immutable _signer; + + constructor(address signerAddr) EIP712("ERC7739SignerECDSA", "1") { + _signer = signerAddr; + } + + function _rawSignatureValidation( + bytes32 hash, + bytes calldata signature + ) internal view virtual override returns (bool) { + (address recovered, ECDSA.RecoverError err, ) = ECDSA.tryRecover(hash, signature); + return _signer == recovered && err == ECDSA.RecoverError.NoError; + } +}