|
| 1 | +// contracts/MyAccountZKEmail.sol |
| 2 | +// SPDX-License-Identifier: MIT |
| 3 | + |
| 4 | +pragma solidity ^0.8.20; |
| 5 | + |
| 6 | +import {Account} from "../../../account/Account.sol"; |
| 7 | +import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; |
| 8 | +import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; |
| 9 | +import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; |
| 10 | +import {ERC7739} from "../../../utils/cryptography/ERC7739.sol"; |
| 11 | +import {ERC7821} from "../../../account/extensions/ERC7821.sol"; |
| 12 | +import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; |
| 13 | +import {SignerZKEmail} from "../../../utils/cryptography/SignerZKEmail.sol"; |
| 14 | +import {IDKIMRegistry} from "@zk-email/contracts/DKIMRegistry.sol"; |
| 15 | +import {IVerifier} from "@zk-email/email-tx-builder/interfaces/IVerifier.sol"; |
| 16 | + |
| 17 | +contract MyAccountZKEmail is Account, SignerZKEmail, ERC7739, ERC7821, ERC721Holder, ERC1155Holder, Initializable { |
| 18 | + constructor() EIP712("MyAccountZKEmail", "1") {} |
| 19 | + |
| 20 | + function initialize( |
| 21 | + bytes32 accountSalt_, |
| 22 | + IDKIMRegistry registry_, |
| 23 | + IVerifier verifier_, |
| 24 | + uint256 templateId_ |
| 25 | + ) public initializer { |
| 26 | + _setAccountSalt(accountSalt_); |
| 27 | + _setDKIMRegistry(registry_); |
| 28 | + _setVerifier(verifier_); |
| 29 | + _setCommandTemplate(templateId_); |
| 30 | + } |
| 31 | + |
| 32 | + /// @dev Allows the entry point as an authorized executor. |
| 33 | + function _erc7821AuthorizedExecutor( |
| 34 | + address caller, |
| 35 | + bytes32 mode, |
| 36 | + bytes calldata executionData |
| 37 | + ) internal view virtual override returns (bool) { |
| 38 | + return caller == address(entryPoint()) || super._erc7821AuthorizedExecutor(caller, mode, executionData); |
| 39 | + } |
| 40 | +} |
0 commit comments