Some checks failed
contracts-ci / Install (lockfile) → compile → full test suite (push) Failing after 16m0s
contracts-ci / Ethereum interop (EIP-2537 BLS, prague hardfork) (push) Failing after 27s
contracts-ci / PQC known-answer tests (NIST vectors) (push) Failing after 16m53s
contracts-ci / Coverage (scoped, with artifacts) (push) Has been cancelled
19 lines
946 B
Solidity
19 lines
946 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity 0.8.23;
|
|
|
|
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
|
|
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
|
|
/// @dev Test-only ERC-1271 wallet: a contract wallet whose approvals are ECDSA signatures of `owner`.
|
|
/// Used to prove that AereIdentityRegistry8004V2.setAgentWallet accepts contract wallets (ERC-1271)
|
|
/// and not only EOAs (EIP-712), as the ERC-8004 draft requires.
|
|
contract Mock1271Wallet is IERC1271 {
|
|
address public immutable owner;
|
|
constructor(address owner_) { owner = owner_; }
|
|
function isValidSignature(bytes32 hash, bytes memory signature) external view override returns (bytes4) {
|
|
(address rec, ECDSA.RecoverError err) = ECDSA.tryRecover(hash, signature);
|
|
if (err == ECDSA.RecoverError.NoError && rec == owner) return IERC1271.isValidSignature.selector;
|
|
return bytes4(0);
|
|
}
|
|
}
|