SignerERC7702.sol 763 B

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