-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing documentation contract (#62)
- Loading branch information
1 parent
37fbc20
commit b222457
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
contracts/mocks/docs/utils/cryptography/ERC7739SignerECDSA.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |