SignerERC7702.sol 863 B

12345678910111213141516171819202122232425
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v5.4.0-rc.0) (utils/cryptography/signers/SignerERC7702.sol)
  3. pragma solidity ^0.8.20;
  4. import {AbstractSigner} from "./AbstractSigner.sol";
  5. import {ECDSA} from "../ECDSA.sol";
  6. /**
  7. * @dev Implementation of {AbstractSigner} for implementation for an EOA. Useful for ERC-7702 accounts.
  8. *
  9. * @custom:stateless
  10. */
  11. abstract contract SignerERC7702 is AbstractSigner {
  12. /**
  13. * @dev Validates the signature using the EOA's address (i.e. `address(this)`).
  14. */
  15. function _rawSignatureValidation(
  16. bytes32 hash,
  17. bytes calldata signature
  18. ) internal view virtual override returns (bool) {
  19. (address recovered, ECDSA.RecoverError err, ) = ECDSA.tryRecover(hash, signature);
  20. return address(this) == recovered && err == ECDSA.RecoverError.NoError;
  21. }
  22. }