diff --git a/deployments/sepolia/.chainId b/deployments/sepolia/.chainId new file mode 100644 index 0000000..bd8d1cd --- /dev/null +++ b/deployments/sepolia/.chainId @@ -0,0 +1 @@ +11155111 \ No newline at end of file diff --git a/deployments/sepolia/DefaultCallbackHandler.json b/deployments/sepolia/DefaultCallbackHandler.json new file mode 100644 index 0000000..ef9eac5 --- /dev/null +++ b/deployments/sepolia/DefaultCallbackHandler.json @@ -0,0 +1,214 @@ +{ + "address": "0xe485aeaD5dDB58CbeB6104648cBDFbef5b9630F5", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC1155BatchReceived", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC1155Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "tokensReceived", + "outputs": [], + "stateMutability": "pure", + "type": "function" + } + ], + "transactionHash": "0x06ed790576790166850b8fd82eedd8f2a871a838554b3d078587adfb93ea721d", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x962F35D2249B069B38BbE169B2A449f823b8Bf79", + "contractAddress": null, + "transactionIndex": 19, + "gasUsed": "308174", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf04ccb87b357dd559f32708954e4041d53427a8f26c8ec045885e63dce843e0a", + "transactionHash": "0x06ed790576790166850b8fd82eedd8f2a871a838554b3d078587adfb93ea721d", + "logs": [], + "blockNumber": 4462122, + "cumulativeGasUsed": "3503412", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "23f21117f22f82b6c8f285345928df93", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"tokensReceived\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/handler/DefaultCallbackHandler.sol\":\"DefaultCallbackHandler\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"@account-abstraction/contracts/samples/callback/TokenCallbackHandler.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-empty-blocks */\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\n\\n/**\\n * Token callback handler.\\n * Handles supported tokens' callbacks, allowing account receiving these tokens.\\n */\\ncontract TokenCallbackHandler is IERC777Recipient, IERC721Receiver, IERC1155Receiver {\\n function tokensReceived(\\n address,\\n address,\\n address,\\n uint256,\\n bytes calldata,\\n bytes calldata\\n ) external pure override {\\n }\\n\\n function onERC721Received(\\n address,\\n address,\\n uint256,\\n bytes calldata\\n ) external pure override returns (bytes4) {\\n return IERC721Receiver.onERC721Received.selector;\\n }\\n\\n function onERC1155Received(\\n address,\\n address,\\n uint256,\\n uint256,\\n bytes calldata\\n ) external pure override returns (bytes4) {\\n return IERC1155Receiver.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(\\n address,\\n address,\\n uint256[] calldata,\\n uint256[] calldata,\\n bytes calldata\\n ) external pure override returns (bytes4) {\\n return IERC1155Receiver.onERC1155BatchReceived.selector;\\n }\\n\\n function supportsInterface(bytes4 interfaceId) external view virtual override returns (bool) {\\n return\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n interfaceId == type(IERC1155Receiver).interfaceId ||\\n interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xfff3df5f5211d71158bb017ff791dc4fa85db53890f7bd72bac3a43d89e83752\",\"license\":\"GPL-3.0\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\\n *\\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\\n * contract implement this interface (contract holders can be their own\\n * implementer) and registering it on the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\\n *\\n * See {IERC1820Registry} and {ERC1820Implementer}.\\n */\\ninterface IERC777Recipient {\\n /**\\n * @dev Called by an {IERC777} token contract whenever tokens are being\\n * moved or created into a registered account (`to`). The type of operation\\n * is conveyed by `from` being the zero address or not.\\n *\\n * This call occurs _after_ the token contract's state is updated, so\\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\\n *\\n * This function may revert to prevent the operation from being executed.\\n */\\n function tokensReceived(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes calldata userData,\\n bytes calldata operatorData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1a5d61db2733202ba361e6d6741cd2e662380e22b80e987eacfc91973f2267dc\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/handler/DefaultCallbackHandler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@account-abstraction/contracts/samples/callback/TokenCallbackHandler.sol\\\";\\n\\ncontract DefaultCallbackHandler is TokenCallbackHandler {}\\n\",\"keccak256\":\"0xad0bb5fa65107b2fce1afc65a930abb014f70f030e9f2687fee546fad3752571\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061049a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100665760003560e01c8063150b7a0211610050578063150b7a02146100ad578063bc197c81146100e5578063f23a6e611461010757600080fd5b806223de291461006b57806301ffc9a714610085575b600080fd5b6100836100793660046101eb565b5050505050505050565b005b610098610093366004610296565b610127565b60405190151581526020015b60405180910390f35b6100cc6100bb3660046102c7565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016100a4565b6100cc6100f336600461037b565b63bc197c8160e01b98975050505050505050565b6100cc610115366004610415565b63f23a6e6160e01b9695505050505050565b60006001600160e01b03198216630a85bd0160e11b148061015857506001600160e01b03198216630271189760e51b145b8061017357506001600160e01b031982166301ffc9a760e01b145b92915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461019d57600080fd5b919050565b60008083601f8401126101b457600080fd5b50813567ffffffffffffffff8111156101cc57600080fd5b6020830191508360208285010111156101e457600080fd5b9250929050565b60008060008060008060008060c0898b03121561020757600080fd5b61021089610179565b975061021e60208a01610179565b965061022c60408a01610179565b955060608901359450608089013567ffffffffffffffff8082111561025057600080fd5b61025c8c838d016101a2565b909650945060a08b013591508082111561027557600080fd5b506102828b828c016101a2565b999c989b5096995094979396929594505050565b6000602082840312156102a857600080fd5b81356001600160e01b0319811681146102c057600080fd5b9392505050565b6000806000806000608086880312156102df57600080fd5b6102e886610179565b94506102f660208701610179565b935060408601359250606086013567ffffffffffffffff81111561031957600080fd5b610325888289016101a2565b969995985093965092949392505050565b60008083601f84011261034857600080fd5b50813567ffffffffffffffff81111561036057600080fd5b6020830191508360208260051b85010111156101e457600080fd5b60008060008060008060008060a0898b03121561039757600080fd5b6103a089610179565b97506103ae60208a01610179565b9650604089013567ffffffffffffffff808211156103cb57600080fd5b6103d78c838d01610336565b909850965060608b01359150808211156103f057600080fd5b6103fc8c838d01610336565b909650945060808b013591508082111561027557600080fd5b60008060008060008060a0878903121561042e57600080fd5b61043787610179565b955061044560208801610179565b94506040870135935060608701359250608087013567ffffffffffffffff81111561046f57600080fd5b61047b89828a016101a2565b979a969950949750929593949250505056fea164736f6c6343000813000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100665760003560e01c8063150b7a0211610050578063150b7a02146100ad578063bc197c81146100e5578063f23a6e611461010757600080fd5b806223de291461006b57806301ffc9a714610085575b600080fd5b6100836100793660046101eb565b5050505050505050565b005b610098610093366004610296565b610127565b60405190151581526020015b60405180910390f35b6100cc6100bb3660046102c7565b630a85bd0160e11b95945050505050565b6040516001600160e01b031990911681526020016100a4565b6100cc6100f336600461037b565b63bc197c8160e01b98975050505050505050565b6100cc610115366004610415565b63f23a6e6160e01b9695505050505050565b60006001600160e01b03198216630a85bd0160e11b148061015857506001600160e01b03198216630271189760e51b145b8061017357506001600160e01b031982166301ffc9a760e01b145b92915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461019d57600080fd5b919050565b60008083601f8401126101b457600080fd5b50813567ffffffffffffffff8111156101cc57600080fd5b6020830191508360208285010111156101e457600080fd5b9250929050565b60008060008060008060008060c0898b03121561020757600080fd5b61021089610179565b975061021e60208a01610179565b965061022c60408a01610179565b955060608901359450608089013567ffffffffffffffff8082111561025057600080fd5b61025c8c838d016101a2565b909650945060a08b013591508082111561027557600080fd5b506102828b828c016101a2565b999c989b5096995094979396929594505050565b6000602082840312156102a857600080fd5b81356001600160e01b0319811681146102c057600080fd5b9392505050565b6000806000806000608086880312156102df57600080fd5b6102e886610179565b94506102f660208701610179565b935060408601359250606086013567ffffffffffffffff81111561031957600080fd5b610325888289016101a2565b969995985093965092949392505050565b60008083601f84011261034857600080fd5b50813567ffffffffffffffff81111561036057600080fd5b6020830191508360208260051b85010111156101e457600080fd5b60008060008060008060008060a0898b03121561039757600080fd5b6103a089610179565b97506103ae60208a01610179565b9650604089013567ffffffffffffffff808211156103cb57600080fd5b6103d78c838d01610336565b909850965060608b01359150808211156103f057600080fd5b6103fc8c838d01610336565b909650945060808b013591508082111561027557600080fd5b60008060008060008060a0878903121561042e57600080fd5b61043787610179565b955061044560208801610179565b94506040870135935060608701359250608087013567ffffffffffffffff81111561046f57600080fd5b61047b89828a016101a2565b979a969950949750929593949250505056fea164736f6c6343000813000a", + "devdoc": { + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/sepolia/OwnerSessionKeyValidator.json b/deployments/sepolia/OwnerSessionKeyValidator.json new file mode 100644 index 0000000..c37a1c6 --- /dev/null +++ b/deployments/sepolia/OwnerSessionKeyValidator.json @@ -0,0 +1,273 @@ +{ + "address": "0xB8E0e37A1ffB868C9E59Bf828ED7Fb26f3ffB453", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sessionKey", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint48", + "name": "validUntil", + "type": "uint48" + }, + { + "indexed": false, + "internalType": "uint48", + "name": "validAfter", + "type": "uint48" + } + ], + "name": "NewSessionKey", + "type": "event" + }, + { + "inputs": [], + "name": "NAME", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "enable", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sessionKey", + "type": "address" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "sessionKeyStorage", + "outputs": [ + { + "internalType": "uint48", + "name": "validUntil", + "type": "uint48" + }, + { + "internalType": "uint48", + "name": "validAfter", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "validCaller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "validateSignature", + "outputs": [ + { + "internalType": "uint256", + "name": "validationData", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x90b631557ec51000ef719e413466b4849c05eeedc1f47a7e2dc5f2c5feef9c79", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x962F35D2249B069B38BbE169B2A449f823b8Bf79", + "contractAddress": null, + "transactionIndex": 46, + "gasUsed": "638750", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa14cd301c06df3a3094de81788c1d877118b3946b6600895faf154f47f5c72dc", + "transactionHash": "0x90b631557ec51000ef719e413466b4849c05eeedc1f47a7e2dc5f2c5feef9c79", + "logs": [], + "blockNumber": 4462127, + "cumulativeGasUsed": "6615271", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "a280f1a2e68de4d8bf0f5b30b89ec7ed", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sessionKey\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"indexed\":false,\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"}],\"name\":\"NewSessionKey\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"NAME\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VERSION\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"enable\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sessionKey\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"sessionKeyStorage\",\"outputs\":[{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validCaller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"validateSignature\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"validationData\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/validators/sessionkey/OwnerSessionKeyValidator.sol\":\"OwnerSessionKeyValidator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"@account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = Math.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n */\\n function toString(int256 value) internal pure returns (string memory) {\\n return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, Math.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n\\n /**\\n * @dev Returns true if the two strings are equal.\\n */\\n function equal(string memory a, string memory b) internal pure returns (bool) {\\n return keccak256(bytes(a)) == keccak256(bytes(b));\\n }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore(0x00, \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\")\\n mstore(0x1c, hash)\\n message := keccak256(0x00, 0x3c)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40)\\n mstore(ptr, \\\"\\\\x19\\\\x01\\\")\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n data := keccak256(ptr, 0x42)\\n }\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\\n * `validator` and `data` according to the version 0 of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x00\\\", validator, data));\\n }\\n}\\n\",\"keccak256\":\"0x809bc3edb4bcbef8263fa616c1b60ee0004b50a8a1bfa164d8f57fd31f520c58\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n // The surrounding unchecked block does not change this fact.\\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10 ** 64) {\\n value /= 10 ** 64;\\n result += 64;\\n }\\n if (value >= 10 ** 32) {\\n value /= 10 ** 32;\\n result += 32;\\n }\\n if (value >= 10 ** 16) {\\n value /= 10 ** 16;\\n result += 16;\\n }\\n if (value >= 10 ** 8) {\\n value /= 10 ** 8;\\n result += 8;\\n }\\n if (value >= 10 ** 4) {\\n value /= 10 ** 4;\\n result += 4;\\n }\\n if (value >= 10 ** 2) {\\n value /= 10 ** 2;\\n result += 2;\\n }\\n if (value >= 10 ** 1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/common/Contants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nlibrary Contants {\\n address internal constant SENTINEL = address(0x1);\\n\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n}\\n\",\"keccak256\":\"0x4def4c34ea7d1925f182376cda97a69c536491aa43ebadaaf710b58173f5f76b\",\"license\":\"MIT\"},\"contracts/interfaces/IValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"./Metadata.sol\\\";\\n\\ninterface IValidator is Metadata {\\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\\n external\\n payable\\n returns (uint256 validationData);\\n\\n function validCaller(address caller, bytes calldata data) external view returns (bool);\\n\\n function enable(bytes calldata data) external payable;\\n}\\n\",\"keccak256\":\"0x7c6a9305295ecdee128a434cc87514250605c3a3159ecd2dd3ee56dc9ce6f862\",\"license\":\"MIT\"},\"contracts/interfaces/Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface Metadata is IERC165 {\\n function NAME() external view returns (string memory);\\n function VERSION() external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xcbcd27a057fef9d4c42f0e229575bd8fb28a8baad9440869bb30fcaefccc0729\",\"license\":\"MIT\"},\"contracts/validators/BaseValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../interfaces/IValidator.sol\\\";\\n\\nabstract contract BaseValidator is IValidator {\\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\\n return interfaceId == type(IValidator).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x6bc845d709ba4b8925de3dd209016868ca59f6ede3c52c76d1f12a5783a04579\",\"license\":\"MIT\"},\"contracts/validators/sessionkey/OwnerSessionKeyValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport {_packValidationData} from \\\"@account-abstraction/contracts/core/Helpers.sol\\\";\\n\\nimport \\\"../../interfaces/IValidator.sol\\\";\\nimport \\\"../../common/Contants.sol\\\";\\nimport \\\"../BaseValidator.sol\\\";\\n\\nstruct SessionKeyStorage {\\n uint48 validUntil;\\n uint48 validAfter;\\n}\\n\\ncontract OwnerSessionKeyValidator is BaseValidator {\\n string public constant override NAME = \\\"Owner Session Key Validator\\\";\\n string public constant override VERSION = \\\"0.0.1\\\";\\n\\n event NewSessionKey(address indexed account, address indexed sessionKey, uint48 validUntil, uint48 validAfter);\\n\\n mapping(address sessionKey => mapping(address account => SessionKeyStorage)) public sessionKeyStorage;\\n\\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\\n external\\n payable\\n override\\n returns (uint256 validationData)\\n {\\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\\n address recovered = ECDSA.recover(hash, signature);\\n\\n SessionKeyStorage storage sessionKey = sessionKeyStorage[recovered][account];\\n if (sessionKey.validUntil == 0) {\\n return Contants.SIG_VALIDATION_FAILED;\\n }\\n validationData = _packValidationData(false, sessionKey.validUntil, sessionKey.validAfter);\\n }\\n\\n function enable(bytes calldata data) external payable override {\\n address sessionKey = address(bytes20(data[0:20]));\\n uint48 validUntil = uint48(bytes6(data[20:26]));\\n uint48 validAfter = uint48(bytes6(data[26:32]));\\n require(validUntil > validAfter, \\\"OwnerSessionKeyValidator: invalid validUntil/validAfter\\\");\\n sessionKeyStorage[sessionKey][msg.sender] = SessionKeyStorage(validUntil, validAfter);\\n\\n emit NewSessionKey(msg.sender, sessionKey, validUntil, validAfter);\\n }\\n\\n function validCaller(address caller, bytes calldata) external view override returns (bool) {\\n SessionKeyStorage storage sessionKey = sessionKeyStorage[caller][msg.sender];\\n if (block.timestamp <= sessionKey.validAfter) {\\n return false;\\n }\\n if (block.timestamp > sessionKey.validUntil) {\\n return false;\\n }\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x5ddb0cd75bcbbf9f22359a13e7d141826d4605d028d78ebfcba53c7679991519\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610a9a806100206000396000f3fe6080604052600436106100705760003560e01c80639ea9bd591161004e5780639ea9bd5914610109578063a3f4df7e14610129578063fbab6a7a1461017f578063ffa1ad74146101e957600080fd5b806301ffc9a7146100755780630c959556146100d3578063971604c6146100e8575b600080fd5b34801561008157600080fd5b506100be6100903660046107c2565b7fffffffff000000000000000000000000000000000000000000000000000000001663052a2cc960e01b1490565b60405190151581526020015b60405180910390f35b6100e66100e1366004610846565b610232565b005b6100fb6100f63660046108a4565b6103bb565b6040519081526020016100ca565b34801561011557600080fd5b506100be6101243660046108fe565b6104a3565b34801561013557600080fd5b506101726040518060400160405280601b81526020017f4f776e65722053657373696f6e204b65792056616c696461746f72000000000081525081565b6040516100ca9190610951565b34801561018b57600080fd5b506101ca61019a36600461099f565b600060208181529281526040808220909352908152205465ffffffffffff80821691660100000000000090041682565b6040805165ffffffffffff9384168152929091166020830152016100ca565b3480156101f557600080fd5b506101726040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b600061024160148284866109d2565b61024a916109fc565b60601c9050600061025f601a601485876109d2565b61026891610a31565b60d01c9050600061027d6020601a86886109d2565b61028691610a31565b60d01c905065ffffffffffff8216811061030d5760405162461bcd60e51b815260206004820152603760248201527f4f776e657253657373696f6e4b657956616c696461746f723a20696e76616c6960448201527f642076616c6964556e74696c2f76616c6964416674657200000000000000000060648201526084015b60405180910390fd5b60408051808201825265ffffffffffff84811680835284821660208085018281526001600160a01b038a166000818152808452888120338083529085529089902097518854935188166601000000000000026bffffffffffffffffffffffff19909416971696909617919091179095558551928352820152919290917f31b5c77503fad62fe58a0293e3020e533a464b77d0a29f3495d61c90c09086c7910160405180910390a35050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c849052603c8120600061042c8286868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061051092505050565b6001600160a01b03808216600090815260208181526040808320938c16835292905290812080549293509165ffffffffffff169003610471576001935050505061049b565b80546104959060009065ffffffffffff808216916601000000000000900416610534565b93505050505b949350505050565b6001600160a01b038316600090815260208181526040808320338452909152812080546601000000000000900465ffffffffffff1642116104e8576000915050610509565b805465ffffffffffff16421115610503576000915050610509565b60019150505b9392505050565b600080600061051f858561056c565b9150915061052c816105b1565b509392505050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b8561055c57600061055f565b60015b60ff161717949350505050565b60008082516041036105a25760208301516040840151606085015160001a610596878285856106fe565b945094505050506105aa565b506000905060025b9250929050565b60008160048111156105c5576105c5610a77565b036105cd5750565b60018160048111156105e1576105e1610a77565b0361062e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610304565b600281600481111561064257610642610a77565b0361068f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610304565b60038160048111156106a3576106a3610a77565b036106fb5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610304565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561073557506000905060036107b9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610789573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166107b2576000600192509250506107b9565b9150600090505b94509492505050565b6000602082840312156107d457600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461050957600080fd5b60008083601f84011261081657600080fd5b50813567ffffffffffffffff81111561082e57600080fd5b6020830191508360208285010111156105aa57600080fd5b6000806020838503121561085957600080fd5b823567ffffffffffffffff81111561087057600080fd5b61087c85828601610804565b90969095509350505050565b80356001600160a01b038116811461089f57600080fd5b919050565b600080600080606085870312156108ba57600080fd5b6108c385610888565b935060208501359250604085013567ffffffffffffffff8111156108e657600080fd5b6108f287828801610804565b95989497509550505050565b60008060006040848603121561091357600080fd5b61091c84610888565b9250602084013567ffffffffffffffff81111561093857600080fd5b61094486828701610804565b9497909650939450505050565b600060208083528351808285015260005b8181101561097e57858101830151858201604001528201610962565b506000604082860101526040601f19601f8301168501019250505092915050565b600080604083850312156109b257600080fd5b6109bb83610888565b91506109c960208401610888565b90509250929050565b600080858511156109e257600080fd5b838611156109ef57600080fd5b5050820193919092039150565b6bffffffffffffffffffffffff198135818116916014851015610a295780818660140360031b1b83161692505b505092915050565b7fffffffffffff00000000000000000000000000000000000000000000000000008135818116916006851015610a295760069490940360031b84901b1690921692915050565b634e487b7160e01b600052602160045260246000fdfea164736f6c6343000813000a", + "deployedBytecode": "0x6080604052600436106100705760003560e01c80639ea9bd591161004e5780639ea9bd5914610109578063a3f4df7e14610129578063fbab6a7a1461017f578063ffa1ad74146101e957600080fd5b806301ffc9a7146100755780630c959556146100d3578063971604c6146100e8575b600080fd5b34801561008157600080fd5b506100be6100903660046107c2565b7fffffffff000000000000000000000000000000000000000000000000000000001663052a2cc960e01b1490565b60405190151581526020015b60405180910390f35b6100e66100e1366004610846565b610232565b005b6100fb6100f63660046108a4565b6103bb565b6040519081526020016100ca565b34801561011557600080fd5b506100be6101243660046108fe565b6104a3565b34801561013557600080fd5b506101726040518060400160405280601b81526020017f4f776e65722053657373696f6e204b65792056616c696461746f72000000000081525081565b6040516100ca9190610951565b34801561018b57600080fd5b506101ca61019a36600461099f565b600060208181529281526040808220909352908152205465ffffffffffff80821691660100000000000090041682565b6040805165ffffffffffff9384168152929091166020830152016100ca565b3480156101f557600080fd5b506101726040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b600061024160148284866109d2565b61024a916109fc565b60601c9050600061025f601a601485876109d2565b61026891610a31565b60d01c9050600061027d6020601a86886109d2565b61028691610a31565b60d01c905065ffffffffffff8216811061030d5760405162461bcd60e51b815260206004820152603760248201527f4f776e657253657373696f6e4b657956616c696461746f723a20696e76616c6960448201527f642076616c6964556e74696c2f76616c6964416674657200000000000000000060648201526084015b60405180910390fd5b60408051808201825265ffffffffffff84811680835284821660208085018281526001600160a01b038a166000818152808452888120338083529085529089902097518854935188166601000000000000026bffffffffffffffffffffffff19909416971696909617919091179095558551928352820152919290917f31b5c77503fad62fe58a0293e3020e533a464b77d0a29f3495d61c90c09086c7910160405180910390a35050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c849052603c8120600061042c8286868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061051092505050565b6001600160a01b03808216600090815260208181526040808320938c16835292905290812080549293509165ffffffffffff169003610471576001935050505061049b565b80546104959060009065ffffffffffff808216916601000000000000900416610534565b93505050505b949350505050565b6001600160a01b038316600090815260208181526040808320338452909152812080546601000000000000900465ffffffffffff1642116104e8576000915050610509565b805465ffffffffffff16421115610503576000915050610509565b60019150505b9392505050565b600080600061051f858561056c565b9150915061052c816105b1565b509392505050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b8561055c57600061055f565b60015b60ff161717949350505050565b60008082516041036105a25760208301516040840151606085015160001a610596878285856106fe565b945094505050506105aa565b506000905060025b9250929050565b60008160048111156105c5576105c5610a77565b036105cd5750565b60018160048111156105e1576105e1610a77565b0361062e5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610304565b600281600481111561064257610642610a77565b0361068f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610304565b60038160048111156106a3576106a3610a77565b036106fb5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610304565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561073557506000905060036107b9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610789573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166107b2576000600192509250506107b9565b9150600090505b94509492505050565b6000602082840312156107d457600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461050957600080fd5b60008083601f84011261081657600080fd5b50813567ffffffffffffffff81111561082e57600080fd5b6020830191508360208285010111156105aa57600080fd5b6000806020838503121561085957600080fd5b823567ffffffffffffffff81111561087057600080fd5b61087c85828601610804565b90969095509350505050565b80356001600160a01b038116811461089f57600080fd5b919050565b600080600080606085870312156108ba57600080fd5b6108c385610888565b935060208501359250604085013567ffffffffffffffff8111156108e657600080fd5b6108f287828801610804565b95989497509550505050565b60008060006040848603121561091357600080fd5b61091c84610888565b9250602084013567ffffffffffffffff81111561093857600080fd5b61094486828701610804565b9497909650939450505050565b600060208083528351808285015260005b8181101561097e57858101830151858201604001528201610962565b506000604082860101526040601f19601f8301168501019250505092915050565b600080604083850312156109b257600080fd5b6109bb83610888565b91506109c960208401610888565b90509250929050565b600080858511156109e257600080fd5b838611156109ef57600080fd5b5050820193919092039150565b6bffffffffffffffffffffffff198135818116916014851015610a295780818660140360031b1b83161692505b505092915050565b7fffffffffffff00000000000000000000000000000000000000000000000000008135818116916006851015610a295760069490940360031b84901b1690921692915050565b634e487b7160e01b600052602160045260246000fdfea164736f6c6343000813000a", + "devdoc": { + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 1935, + "contract": "contracts/validators/sessionkey/OwnerSessionKeyValidator.sol:OwnerSessionKeyValidator", + "label": "sessionKeyStorage", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(SessionKeyStorage)1908_storage))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_address,t_struct(SessionKeyStorage)1908_storage))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(address => struct SessionKeyStorage))", + "numberOfBytes": "32", + "value": "t_mapping(t_address,t_struct(SessionKeyStorage)1908_storage)" + }, + "t_mapping(t_address,t_struct(SessionKeyStorage)1908_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct SessionKeyStorage)", + "numberOfBytes": "32", + "value": "t_struct(SessionKeyStorage)1908_storage" + }, + "t_struct(SessionKeyStorage)1908_storage": { + "encoding": "inplace", + "label": "struct SessionKeyStorage", + "members": [ + { + "astId": 1905, + "contract": "contracts/validators/sessionkey/OwnerSessionKeyValidator.sol:OwnerSessionKeyValidator", + "label": "validUntil", + "offset": 0, + "slot": "0", + "type": "t_uint48" + }, + { + "astId": 1907, + "contract": "contracts/validators/sessionkey/OwnerSessionKeyValidator.sol:OwnerSessionKeyValidator", + "label": "validAfter", + "offset": 6, + "slot": "0", + "type": "t_uint48" + } + ], + "numberOfBytes": "32" + }, + "t_uint48": { + "encoding": "inplace", + "label": "uint48", + "numberOfBytes": "6" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/P256Validator.json b/deployments/sepolia/P256Validator.json new file mode 100644 index 0000000..2fab5c2 --- /dev/null +++ b/deployments/sepolia/P256Validator.json @@ -0,0 +1,253 @@ +{ + "address": "0x5570b89f0F9b1531c9c5E1aCCAF798a1850654c1", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ISecp256r1", + "name": "_impl", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "oldPk", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newPk", + "type": "bytes" + } + ], + "name": "PkChanged", + "type": "event" + }, + { + "inputs": [], + "name": "NAME", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "enable", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "impl", + "outputs": [ + { + "internalType": "contract ISecp256r1", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pks", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "validCaller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "validateSignature", + "outputs": [ + { + "internalType": "uint256", + "name": "validationData", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x89a0a70a3a6dc333163ec150e6936e27d49d6539277bf8480e31f07f0001745d", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x962F35D2249B069B38BbE169B2A449f823b8Bf79", + "contractAddress": null, + "transactionIndex": 32, + "gasUsed": "611547", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb8c97ec8839fa3c1bd31f61fdd990cd52271ad7916ca4f4d09523a46db16b2e1", + "transactionHash": "0x89a0a70a3a6dc333163ec150e6936e27d49d6539277bf8480e31f07f0001745d", + "logs": [], + "blockNumber": 4462125, + "cumulativeGasUsed": "5721833", + "status": 1, + "byzantium": true + }, + "args": [ + "0x7F805c1078EDF7b23c025Fa0dD024c2Fb1E86417" + ], + "numDeployments": 1, + "solcInputHash": "23f21117f22f82b6c8f285345928df93", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ISecp256r1\",\"name\":\"_impl\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"oldPk\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newPk\",\"type\":\"bytes\"}],\"name\":\"PkChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"NAME\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VERSION\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"enable\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"impl\",\"outputs\":[{\"internalType\":\"contract ISecp256r1\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pks\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validCaller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"validateSignature\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"validationData\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/validators/p256/P256Validator.sol\":\"P256Validator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/common/Contants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nlibrary Contants {\\n address internal constant SENTINEL = address(0x1);\\n\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n}\\n\",\"keccak256\":\"0x4def4c34ea7d1925f182376cda97a69c536491aa43ebadaaf710b58173f5f76b\",\"license\":\"MIT\"},\"contracts/interfaces/IValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"./Metadata.sol\\\";\\n\\ninterface IValidator is Metadata {\\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\\n external\\n payable\\n returns (uint256 validationData);\\n\\n function validCaller(address caller, bytes calldata data) external view returns (bool);\\n\\n function enable(bytes calldata data) external payable;\\n}\\n\",\"keccak256\":\"0x7c6a9305295ecdee128a434cc87514250605c3a3159ecd2dd3ee56dc9ce6f862\",\"license\":\"MIT\"},\"contracts/interfaces/Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface Metadata is IERC165 {\\n function NAME() external view returns (string memory);\\n function VERSION() external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xcbcd27a057fef9d4c42f0e229575bd8fb28a8baad9440869bb30fcaefccc0729\",\"license\":\"MIT\"},\"contracts/validators/BaseValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../interfaces/IValidator.sol\\\";\\n\\nabstract contract BaseValidator is IValidator {\\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\\n return interfaceId == type(IValidator).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x6bc845d709ba4b8925de3dd209016868ca59f6ede3c52c76d1f12a5783a04579\",\"license\":\"MIT\"},\"contracts/validators/p256/Base64.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nlibrary Base64 {\\n /**\\n * @dev Base64 Encoding/Decoding Table\\n */\\n string internal constant _TABLE = \\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\\\";\\n\\n /**\\n * @dev Converts a `bytes` to its Bytes64 `string` representation.\\n */\\n function encode(bytes memory data) internal pure returns (string memory) {\\n /**\\n * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence\\n * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol\\n */\\n if (data.length == 0) return \\\"\\\";\\n\\n // Loads the table into memory\\n string memory table = _TABLE;\\n\\n // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter\\n // and split into 4 numbers of 6 bits.\\n // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up\\n // - `data.length + 2` -> Round up\\n // - `/ 3` -> Number of 3-bytes chunks\\n // - `4 *` -> 4 characters for each chunk\\n uint256 newlength = data.length * 8 / 6;\\n if (data.length % 6 > 0) {\\n newlength++;\\n }\\n string memory result = new string(newlength);\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Prepare the lookup table (skip the first \\\"length\\\" byte)\\n let tablePtr := add(table, 1)\\n\\n // Prepare result pointer, jump over length\\n let resultPtr := add(result, 32)\\n // let targetLength := add(resultPtr, newlength)\\n\\n // Run over the input, 3 bytes at a time\\n for {\\n let dataPtr := data\\n let endPtr := add(data, mload(data))\\n } lt(dataPtr, endPtr) {} {\\n // Advance 3 bytes\\n dataPtr := add(dataPtr, 3)\\n let input := mload(dataPtr)\\n\\n // To write each character, shift the 3 bytes (18 bits) chunk\\n // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)\\n // and apply logical AND with 0x3F which is the number of\\n // the previous character in the ASCII table prior to the Base64 Table\\n // The result is then added to the table to get the character to write,\\n // and finally write it in the result pointer but with a left shift\\n // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits\\n mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))\\n resultPtr := add(resultPtr, 1)\\n\\n mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))\\n resultPtr := add(resultPtr, 1)\\n\\n mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))\\n resultPtr := add(resultPtr, 1)\\n\\n mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))\\n resultPtr := add(resultPtr, 1)\\n }\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x2aa241e8e13cdb63bc886b6a5ab0d464af440e7019d15abf0dc0a67bd3fe7def\",\"license\":\"MIT\"},\"contracts/validators/p256/ISecp256r1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\ninterface ISecp256r1 {\\n function validateSignature(bytes32 message, bytes calldata signature, bytes calldata publicKey)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0x2c27d09b504eebfad02daf6a774b8df8bf29c51077f288bf6dd5464b4a18d177\",\"license\":\"MIT\"},\"contracts/validators/p256/P256Validator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../../common/Contants.sol\\\";\\nimport \\\"../BaseValidator.sol\\\";\\nimport \\\"./ISecp256r1.sol\\\";\\nimport \\\"./Base64.sol\\\";\\n\\ncontract P256Validator is BaseValidator {\\n string public constant override NAME = \\\"P256 Validator\\\";\\n string public constant override VERSION = \\\"0.0.1\\\";\\n\\n event PkChanged(address indexed account, bytes oldPk, bytes newPk);\\n\\n ISecp256r1 public immutable impl;\\n mapping(address => bytes) public pks;\\n\\n constructor(ISecp256r1 _impl) {\\n impl = _impl;\\n }\\n\\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\\n external\\n payable\\n override\\n returns (uint256 validationData)\\n {\\n if (impl.validateSignature(sha256(abi.encode(userOpHash)), signature, pks[account])) {\\n return 0;\\n }\\n return Contants.SIG_VALIDATION_FAILED;\\n }\\n\\n function enable(bytes calldata data) external payable override {\\n bytes memory old = pks[msg.sender];\\n pks[msg.sender] = data;\\n emit PkChanged(msg.sender, old, data);\\n }\\n\\n function validCaller(address, bytes calldata) external pure override returns (bool) {\\n revert(\\\"not implemented\\\");\\n }\\n}\\n\",\"keccak256\":\"0x803005daa3a60608986a4dbad6abedd7d395b9f4ca02931d531cd19a60371d09\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b50604051610aa1380380610aa183398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610a106100916000396000818160ed01526103c80152610a106000f3fe60806040526004361061007b5760003560e01c8063971604c61161004e578063971604c6146101545780639ea9bd5914610175578063a3f4df7e14610195578063ffa1ad74146101de57600080fd5b806301ffc9a7146100805780630c959556146100c65780638abf6077146100db5780639356375c14610127575b600080fd5b34801561008c57600080fd5b506100b161009b36600461054c565b6001600160e01b03191663052a2cc960e01b1490565b60405190151581526020015b60405180910390f35b6100d96100d43660046105c6565b610227565b005b3480156100e757600080fd5b5061010f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100bd565b34801561013357600080fd5b50610147610142366004610624565b61032a565b6040516100bd919061068f565b6101676101623660046106a2565b6103c4565b6040519081526020016100bd565b34801561018157600080fd5b506100b16101903660046106fc565b6104fd565b3480156101a157600080fd5b506101476040518060400160405280600e81526020017f503235362056616c696461746f7200000000000000000000000000000000000081525081565b3480156101ea57600080fd5b506101476040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b33600090815260208190526040812080546102419061074f565b80601f016020809104026020016040519081016040528092919081815260200182805461026d9061074f565b80156102ba5780601f1061028f576101008083540402835291602001916102ba565b820191906000526020600020905b81548152906001019060200180831161029d57829003601f168201915b50503360009081526020819052604090209394506102df9250859150869050836107ee565b50336001600160a01b03167f49a125229beaa1b288f0f807170a37c7a131925683b0250b113db84181bfb06682858560405161031d939291906108d8565b60405180910390a2505050565b600060208190529081526040902080546103439061074f565b80601f016020809104026020016040519081016040528092919081815260200182805461036f9061074f565b80156103bc5780601f10610391576101008083540402835291602001916103bc565b820191906000526020600020905b81548152906001019060200180831161039f57829003601f168201915b505050505081565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ae7e17f060028660405160200161040a91815260200190565b60408051601f198184030181529082905261042491610908565b602060405180830381855afa158015610441573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906104649190610924565b6001600160a01b0388166000908152602081905260409081902090516001600160e01b031960e085901b1681526104a39291889188919060040161093d565b602060405180830381865afa1580156104c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e491906109e1565b156104f1575060006104f5565b5060015b949350505050565b60405162461bcd60e51b815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640160405180910390fd5b60006020828403121561055e57600080fd5b81356001600160e01b03198116811461057657600080fd5b9392505050565b60008083601f84011261058f57600080fd5b50813567ffffffffffffffff8111156105a757600080fd5b6020830191508360208285010111156105bf57600080fd5b9250929050565b600080602083850312156105d957600080fd5b823567ffffffffffffffff8111156105f057600080fd5b6105fc8582860161057d565b90969095509350505050565b80356001600160a01b038116811461061f57600080fd5b919050565b60006020828403121561063657600080fd5b61057682610608565b60005b8381101561065a578181015183820152602001610642565b50506000910152565b6000815180845261067b81602086016020860161063f565b601f01601f19169290920160200192915050565b6020815260006105766020830184610663565b600080600080606085870312156106b857600080fd5b6106c185610608565b935060208501359250604085013567ffffffffffffffff8111156106e457600080fd5b6106f08782880161057d565b95989497509550505050565b60008060006040848603121561071157600080fd5b61071a84610608565b9250602084013567ffffffffffffffff81111561073657600080fd5b6107428682870161057d565b9497909650939450505050565b600181811c9082168061076357607f821691505b60208210810361078357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f8211156107e957600081815260208120601f850160051c810160208610156107c65750805b601f850160051c820191505b818110156107e5578281556001016107d2565b5050505b505050565b67ffffffffffffffff83111561080657610806610789565b61081a83610814835461074f565b8361079f565b6000601f84116001811461084e57600085156108365750838201355b600019600387901b1c1916600186901b1783556108a8565b600083815260209020601f19861690835b8281101561087f578685013582556020948501946001909201910161085f565b508682101561089c5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006108eb6040830186610663565b82810360208401526108fe8185876108af565b9695505050505050565b6000825161091a81846020870161063f565b9190910192915050565b60006020828403121561093657600080fd5b5051919050565b848152600060206060818401526109586060840186886108af565b83810360408501526000855461096d8161074f565b8084526001828116801561098857600181146109a2576109d0565b60ff1984168688015282151560051b8601870194506109d0565b896000528660002060005b848110156109c85781548882018a01529083019088016109ad565b870188019550505b50929b9a5050505050505050505050565b6000602082840312156109f357600080fd5b8151801515811461057657600080fdfea164736f6c6343000813000a", + "deployedBytecode": "0x60806040526004361061007b5760003560e01c8063971604c61161004e578063971604c6146101545780639ea9bd5914610175578063a3f4df7e14610195578063ffa1ad74146101de57600080fd5b806301ffc9a7146100805780630c959556146100c65780638abf6077146100db5780639356375c14610127575b600080fd5b34801561008c57600080fd5b506100b161009b36600461054c565b6001600160e01b03191663052a2cc960e01b1490565b60405190151581526020015b60405180910390f35b6100d96100d43660046105c6565b610227565b005b3480156100e757600080fd5b5061010f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100bd565b34801561013357600080fd5b50610147610142366004610624565b61032a565b6040516100bd919061068f565b6101676101623660046106a2565b6103c4565b6040519081526020016100bd565b34801561018157600080fd5b506100b16101903660046106fc565b6104fd565b3480156101a157600080fd5b506101476040518060400160405280600e81526020017f503235362056616c696461746f7200000000000000000000000000000000000081525081565b3480156101ea57600080fd5b506101476040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b33600090815260208190526040812080546102419061074f565b80601f016020809104026020016040519081016040528092919081815260200182805461026d9061074f565b80156102ba5780601f1061028f576101008083540402835291602001916102ba565b820191906000526020600020905b81548152906001019060200180831161029d57829003601f168201915b50503360009081526020819052604090209394506102df9250859150869050836107ee565b50336001600160a01b03167f49a125229beaa1b288f0f807170a37c7a131925683b0250b113db84181bfb06682858560405161031d939291906108d8565b60405180910390a2505050565b600060208190529081526040902080546103439061074f565b80601f016020809104026020016040519081016040528092919081815260200182805461036f9061074f565b80156103bc5780601f10610391576101008083540402835291602001916103bc565b820191906000526020600020905b81548152906001019060200180831161039f57829003601f168201915b505050505081565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ae7e17f060028660405160200161040a91815260200190565b60408051601f198184030181529082905261042491610908565b602060405180830381855afa158015610441573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906104649190610924565b6001600160a01b0388166000908152602081905260409081902090516001600160e01b031960e085901b1681526104a39291889188919060040161093d565b602060405180830381865afa1580156104c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e491906109e1565b156104f1575060006104f5565b5060015b949350505050565b60405162461bcd60e51b815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640160405180910390fd5b60006020828403121561055e57600080fd5b81356001600160e01b03198116811461057657600080fd5b9392505050565b60008083601f84011261058f57600080fd5b50813567ffffffffffffffff8111156105a757600080fd5b6020830191508360208285010111156105bf57600080fd5b9250929050565b600080602083850312156105d957600080fd5b823567ffffffffffffffff8111156105f057600080fd5b6105fc8582860161057d565b90969095509350505050565b80356001600160a01b038116811461061f57600080fd5b919050565b60006020828403121561063657600080fd5b61057682610608565b60005b8381101561065a578181015183820152602001610642565b50506000910152565b6000815180845261067b81602086016020860161063f565b601f01601f19169290920160200192915050565b6020815260006105766020830184610663565b600080600080606085870312156106b857600080fd5b6106c185610608565b935060208501359250604085013567ffffffffffffffff8111156106e457600080fd5b6106f08782880161057d565b95989497509550505050565b60008060006040848603121561071157600080fd5b61071a84610608565b9250602084013567ffffffffffffffff81111561073657600080fd5b6107428682870161057d565b9497909650939450505050565b600181811c9082168061076357607f821691505b60208210810361078357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f8211156107e957600081815260208120601f850160051c810160208610156107c65750805b601f850160051c820191505b818110156107e5578281556001016107d2565b5050505b505050565b67ffffffffffffffff83111561080657610806610789565b61081a83610814835461074f565b8361079f565b6000601f84116001811461084e57600085156108365750838201355b600019600387901b1c1916600186901b1783556108a8565b600083815260209020601f19861690835b8281101561087f578685013582556020948501946001909201910161085f565b508682101561089c5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006108eb6040830186610663565b82810360208401526108fe8185876108af565b9695505050505050565b6000825161091a81846020870161063f565b9190910192915050565b60006020828403121561093657600080fd5b5051919050565b848152600060206060818401526109586060840186886108af565b83810360408501526000855461096d8161074f565b8084526001828116801561098857600181146109a2576109d0565b60ff1984168688015282151560051b8601870194506109d0565b896000528660002060005b848110156109c85781548882018a01529083019088016109ad565b870188019550505b50929b9a5050505050505050505050565b6000602082840312156109f357600080fd5b8151801515811461057657600080fdfea164736f6c6343000813000a", + "devdoc": { + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 9732, + "contract": "contracts/validators/p256/P256Validator.sol:P256Validator", + "label": "pks", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bytes_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/Secp256r1.json b/deployments/sepolia/Secp256r1.json new file mode 100644 index 0000000..d227026 --- /dev/null +++ b/deployments/sepolia/Secp256r1.json @@ -0,0 +1,96 @@ +{ + "address": "0x7F805c1078EDF7b23c025Fa0dD024c2Fb1E86417", + "abi": [ + { + "inputs": [], + "name": "nn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pp", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "message", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "publicKey", + "type": "bytes" + } + ], + "name": "validateSignature", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x39fdf337f0fe1dedc8b9aa45e6ad63a36138b4966d795b5a93d3baa0949cf5c3", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x962F35D2249B069B38BbE169B2A449f823b8Bf79", + "contractAddress": null, + "transactionIndex": 30, + "gasUsed": "645154", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x091d020e94b08ccdf12613d4f7917a69024a82e68371f207866b1aa60b718079", + "transactionHash": "0x39fdf337f0fe1dedc8b9aa45e6ad63a36138b4966d795b5a93d3baa0949cf5c3", + "logs": [], + "blockNumber": 4462124, + "cumulativeGasUsed": "6240611", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "23f21117f22f82b6c8f285345928df93", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"nn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"message\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"publicKey\",\"type\":\"bytes\"}],\"name\":\"validateSignature\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/validators/p256/Secp256r1.sol\":\"Secp256r1\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"contracts/validators/p256/ISecp256r1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\ninterface ISecp256r1 {\\n function validateSignature(bytes32 message, bytes calldata signature, bytes calldata publicKey)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0x2c27d09b504eebfad02daf6a774b8df8bf29c51077f288bf6dd5464b4a18d177\",\"license\":\"MIT\"},\"contracts/validators/p256/Secp256r1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"./ISecp256r1.sol\\\";\\n\\ncontract Secp256r1 is ISecp256r1 {\\n struct JPoint {\\n uint256 x;\\n uint256 y;\\n uint256 z;\\n }\\n\\n uint256 constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\\n uint256 constant gy = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\\n uint256 public constant pp = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\\n\\n uint256 public constant nn = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\\n uint256 constant a = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\\n uint256 constant b = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\\n uint256 constant MOST_SIGNIFICANT = 0xc000000000000000000000000000000000000000000000000000000000000000;\\n\\n function verifyWithPrecompute(JPoint[16] memory points, uint256 r, uint256 s, uint256 e)\\n internal\\n view\\n returns (bool)\\n {\\n if (r >= nn || s >= nn) {\\n return false;\\n }\\n\\n uint256 w = _primemod(s, nn);\\n\\n uint256 u1 = mulmod(e, w, nn);\\n uint256 u2 = mulmod(r, w, nn);\\n\\n uint256 x;\\n uint256 y;\\n\\n (x, y) = ShamirMultJacobian(points, u1, u2);\\n return (x == r);\\n }\\n\\n /*\\n * Strauss Shamir trick for EC multiplication\\n * https://stackoverflow.com/questions/50993471/ec-scalar-multiplication-with-strauss-shamir-method\\n * we optimise on this a bit to do with 2 bits at a time rather than a single bit\\n * the individual points for a single pass are precomputed\\n * overall this reduces the number of additions while keeping the same number of doublings\\n */\\n function ShamirMultJacobian(JPoint[16] memory points, uint256 u1, uint256 u2)\\n internal\\n view\\n returns (uint256, uint256)\\n {\\n uint256 x = 0;\\n uint256 y = 0;\\n uint256 z = 0;\\n uint256 bits = 128;\\n uint256 index = 0;\\n\\n while (bits > 0) {\\n if (z > 0) {\\n (x, y, z) = _modifiedJacobianDouble(x, y, z);\\n (x, y, z) = _modifiedJacobianDouble(x, y, z);\\n }\\n index = ((u1 & MOST_SIGNIFICANT) >> 252) | ((u2 & MOST_SIGNIFICANT) >> 254);\\n if (index > 0) {\\n (x, y, z) = _jAdd(x, y, z, points[index].x, points[index].y, points[index].z);\\n }\\n u1 <<= 2;\\n u2 <<= 2;\\n bits--;\\n }\\n (x, y) = _affineFromJacobian(x, y, z);\\n return (x, y);\\n }\\n\\n function _preComputeJacobianPoints(uint256 x, uint256 y) internal pure returns (JPoint[16] memory points) {\\n points[0] = JPoint(0, 0, 0);\\n points[1] = JPoint(x, y, 1); // u2\\n points[2] = _jPointDouble(points[1]);\\n points[3] = _jPointAdd(points[1], points[2]);\\n\\n points[4] = JPoint(gx, gy, 1); // u1Points[1]\\n points[5] = _jPointAdd(points[4], points[1]);\\n points[6] = _jPointAdd(points[4], points[2]);\\n points[7] = _jPointAdd(points[4], points[3]);\\n\\n points[8] = _jPointDouble(points[4]); // u1Points[2]\\n points[9] = _jPointAdd(points[8], points[1]);\\n points[10] = _jPointAdd(points[8], points[2]);\\n points[11] = _jPointAdd(points[8], points[3]);\\n\\n points[12] = _jPointAdd(points[4], points[8]); // u1Points[3]\\n points[13] = _jPointAdd(points[12], points[1]);\\n points[14] = _jPointAdd(points[12], points[2]);\\n points[15] = _jPointAdd(points[12], points[3]);\\n }\\n\\n function _jPointAdd(JPoint memory p1, JPoint memory p2) internal pure returns (JPoint memory) {\\n uint256 x;\\n uint256 y;\\n uint256 z;\\n (x, y, z) = _jAdd(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z);\\n return JPoint(x, y, z);\\n }\\n\\n function _jPointDouble(JPoint memory p) internal pure returns (JPoint memory) {\\n uint256 x;\\n uint256 y;\\n uint256 z;\\n (x, y, z) = _modifiedJacobianDouble(p.x, p.y, p.z);\\n return JPoint(x, y, z);\\n }\\n\\n /* _affineFromJacobian\\n * @desription returns affine coordinates from a jacobian input follows\\n * golang elliptic/crypto library\\n */\\n function _affineFromJacobian(uint256 x, uint256 y, uint256 z) internal view returns (uint256 ax, uint256 ay) {\\n if (z == 0) {\\n return (0, 0);\\n }\\n\\n uint256 zinv = _primemod(z, pp);\\n uint256 zinvsq = mulmod(zinv, zinv, pp);\\n\\n ax = mulmod(x, zinvsq, pp);\\n ay = mulmod(y, mulmod(zinvsq, zinv, pp), pp);\\n }\\n\\n /*\\n * _jAdd\\n * @description performs double Jacobian as defined below:\\n * https://hyperelliptic.org/EFD/g1p/auto-code/shortw/jacobian-3/doubling/mdbl-2007-bl.op3\\n */\\n function _jAdd(uint256 p1, uint256 p2, uint256 p3, uint256 q1, uint256 q2, uint256 q3)\\n internal\\n pure\\n returns (uint256 r1, uint256 r2, uint256 r3)\\n {\\n if (p3 == 0) {\\n r1 = q1;\\n r2 = q2;\\n r3 = q3;\\n\\n return (r1, r2, r3);\\n } else if (q3 == 0) {\\n r1 = p1;\\n r2 = p2;\\n r3 = p3;\\n\\n return (r1, r2, r3);\\n }\\n\\n assembly {\\n let pd := 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF\\n let z1z1 := mulmod(p3, p3, pd) // Z1Z1 = Z1^2\\n let z2z2 := mulmod(q3, q3, pd) // Z2Z2 = Z2^2\\n\\n let u1 := mulmod(p1, z2z2, pd) // U1 = X1*Z2Z2\\n let u2 := mulmod(q1, z1z1, pd) // U2 = X2*Z1Z1\\n\\n let s1 := mulmod(p2, mulmod(z2z2, q3, pd), pd) // S1 = Y1*Z2*Z2Z2\\n let s2 := mulmod(q2, mulmod(z1z1, p3, pd), pd) // S2 = Y2*Z1*Z1Z1\\n\\n let p3q3 := addmod(p3, q3, pd)\\n\\n if lt(u2, u1) { u2 := add(pd, u2) } // u2 = u2+pd\\n\\n let h := sub(u2, u1) // H = U2-U1\\n\\n let i := mulmod(0x02, h, pd)\\n i := mulmod(i, i, pd) // I = (2*H)^2\\n\\n let j := mulmod(h, i, pd) // J = H*I\\n if lt(s2, s1) { s2 := add(pd, s2) } // u2 = u2+pd\\n\\n let rr := mulmod(0x02, sub(s2, s1), pd) // r = 2*(S2-S1)\\n r1 := mulmod(rr, rr, pd) // X3 = R^2\\n\\n let v := mulmod(u1, i, pd) // V = U1*I\\n let j2v := addmod(j, mulmod(0x02, v, pd), pd)\\n if lt(r1, j2v) { r1 := add(pd, r1) } // X3 = X3+pd\\n\\n r1 := sub(r1, j2v)\\n\\n // Y3 = r*(V-X3)-2*S1*J\\n let s12j := mulmod(mulmod(0x02, s1, pd), j, pd)\\n\\n if lt(v, r1) { v := add(pd, v) }\\n r2 := mulmod(rr, sub(v, r1), pd)\\n\\n if lt(r2, s12j) { r2 := add(pd, r2) }\\n r2 := sub(r2, s12j)\\n\\n // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2)*H\\n z1z1 := addmod(z1z1, z2z2, pd)\\n j2v := mulmod(p3q3, p3q3, pd)\\n if lt(j2v, z1z1) { j2v := add(pd, j2v) }\\n r3 := mulmod(sub(j2v, z1z1), h, pd)\\n }\\n return (r1, r2, r3);\\n }\\n\\n // Point doubling on the modified jacobian coordinates\\n // http://point-at-infinity.org/ecc/Prime_Curve_Modified_Jacobian_Coordinates.html\\n function _modifiedJacobianDouble(uint256 x, uint256 y, uint256 z)\\n internal\\n pure\\n returns (uint256 x3, uint256 y3, uint256 z3)\\n {\\n assembly {\\n let pd := 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF\\n let z2 := mulmod(z, z, pd)\\n let az4 :=\\n mulmod(0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC, mulmod(z2, z2, pd), pd)\\n let y2 := mulmod(y, y, pd)\\n let s := mulmod(0x04, mulmod(x, y2, pd), pd)\\n let u := mulmod(0x08, mulmod(y2, y2, pd), pd)\\n let m := addmod(mulmod(0x03, mulmod(x, x, pd), pd), az4, pd)\\n let twos := mulmod(0x02, s, pd)\\n let m2 := mulmod(m, m, pd)\\n if lt(m2, twos) { m2 := add(pd, m2) }\\n x3 := sub(m2, twos)\\n if lt(s, x3) { s := add(pd, s) }\\n y3 := mulmod(m, sub(s, x3), pd)\\n if lt(y3, u) { y3 := add(pd, y3) }\\n y3 := sub(y3, u)\\n z3 := mulmod(0x02, mulmod(y, z, pd), pd)\\n }\\n }\\n\\n // Fermats little theorem https://en.wikipedia.org/wiki/Fermat%27s_little_theorem\\n // a^(p-1) = 1 mod p\\n // a^(-1) \\u2245 a^(p-2) (mod p)\\n // we then use the precompile bigModExp to compute a^(-1)\\n function _primemod(uint256 value, uint256 p) internal view returns (uint256 ret) {\\n ret = modexp(value, p - 2, p);\\n return ret;\\n }\\n\\n // Wrapper for built-in BigNumber_modexp (contract 0x5) as described here. https://github.com/ethereum/EIPs/pull/198\\n function modexp(uint256 _base, uint256 _exp, uint256 _mod) internal view returns (uint256 ret) {\\n // bigModExp(_base, _exp, _mod);\\n assembly {\\n if gt(_base, _mod) { _base := mod(_base, _mod) }\\n // Free memory pointer is always stored at 0x40\\n let freemem := mload(0x40)\\n\\n mstore(freemem, 0x20)\\n mstore(add(freemem, 0x20), 0x20)\\n mstore(add(freemem, 0x40), 0x20)\\n\\n mstore(add(freemem, 0x60), _base)\\n mstore(add(freemem, 0x80), _exp)\\n mstore(add(freemem, 0xa0), _mod)\\n\\n let success := staticcall(1500, 0x5, freemem, 0xc0, freemem, 0x20)\\n switch success\\n case 0 { revert(0x0, 0x0) }\\n default { ret := mload(freemem) }\\n }\\n }\\n\\n function validateSignature(bytes32 message, bytes calldata signature, bytes calldata publicKey)\\n external\\n view\\n override\\n returns (bool)\\n {\\n uint256[2] memory rs;\\n (rs[0], rs[1]) = abi.decode(signature, (uint256, uint256));\\n if (rs[0] >= nn || rs[1] >= nn) {\\n return false;\\n }\\n\\n uint256[2] memory Q;\\n (Q[0], Q[1]) = abi.decode(publicKey, (uint256, uint256));\\n\\n JPoint[16] memory points = _preComputeJacobianPoints(Q[0], Q[1]);\\n return verifyWithPrecompute(points, rs[0], rs[1], uint256(message));\\n }\\n}\\n\",\"keccak256\":\"0x1a2606da8b3f5e186e61aafedab57bcc3053489050abc1e2c45529563fd61ee2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50610ab3806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806372a4c30f1461004657806391327ec61461007d578063ae7e17f014610098575b600080fd5b61006a7bffffffff00000000000000004319055258e8617b0c46353d039cdaae1981565b6040519081526020015b60405180910390f35b61006a6ffffffffeffffffffffffffffffffffff60601b1981565b6100ab6100a63660046109b4565b6100bb565b6040519015158152602001610074565b60006100c5610903565b6100d185870187610a2e565b60208301528082527bffffffff00000000000000004319055258e8617b0c46353d039cdaae19111580610125575060208101517bffffffff00000000000000004319055258e8617b0c46353d039cdaae1911155b1561013457600091505061017b565b61013c610903565b61014884860186610a2e565b6020830181905281835260009161015e91610184565b83516020850151919250610175918391908c610365565b93505050505b95945050505050565b61018c610921565b604051806060016040528060008152602001600081526020016000815250816000601081106101bd576101bd610a50565b602002018190525060405180606001604052808481526020018381526020016001815250816001601081106101f4576101f4610a50565b602002015261020a8160015b6020020151610453565b60408201526102298160015b60200201518260025b60200201516104b5565b6060828101919091526040805191820181527f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c29682527f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5602083015260019082015260808201526102a38160045b602002015182600161021f565b60a08201526102b3816004610216565b60c08201526102cc8160045b602002015182600361021f565b60e08201526102dc816004610200565b6101008201526102ed816008610296565b6101208201526102fe816008610216565b61014082015261030f8160086102bf565b61016082015260808101516103269082600861021f565b61018082015261033781600c610296565b6101a082015261034881600c610216565b6101c082015261035981600c6102bf565b6101e082015292915050565b60007bffffffff00000000000000004319055258e8617b0c46353d039cdaae19841015806103b057507bffffffff00000000000000004319055258e8617b0c46353d039cdaae198310155b156103bd5750600061044b565b60006103e6847bffffffff00000000000000004319055258e8617b0c46353d039cdaae19610529565b905060007bffffffff00000000000000004319055258e8617b0c46353d039cdaae19828509905060007bffffffff00000000000000004319055258e8617b0c46353d039cdaae1983880990506000806104408a8585610547565b508914955050505050505b949350505050565b61047760405180606001604052806000815260200160008152602001600081525090565b6000806000610493856000015186602001518760400151610633565b6040805160608101825293845260208401929092529082015295945050505050565b6104d960405180606001604052806000815260200160008152602001600081525090565b6000806000610504866000015187602001518860400151886000015189602001518a604001516106ee565b6040805160608101825293845260208401929092529082015293505050505b92915050565b60006105408361053a600285610a7c565b8461081a565b9392505050565b6000808080806080815b811561061557821561058257610568858585610633565b9196509450925061057a858585610633565b919650945092505b50600c60fc89901c1660fe88901c1780156105f8576105f08585858d85601081106105af576105af610a50565b6020020151518e86601081106105c7576105c7610a50565b6020020151602001518f87601081106105e2576105e2610a50565b6020020151604001516106ee565b919650945092505b600298891b989790971b968161060d81610a8f565b925050610551565b61062085858561086e565b909750955050505050505b935093915050565b60008060006ffffffffeffffffffffffffffffffffff60601b198085860981828283097fffffffff00000001000000000000000000000000fffffffffffffffffffffffc099050818788098283828b0960040983848384096008099150838385868d8e09600309089250838160020984848509818110156106b15785015b039650868110156106bf5783015b838782038409955050808510156106d557938201935b9093039250808086880960020991505093509350939050565b60008060008660000361070857508491508390508261080e565b8360000361071d57508791508690508561080e565b6ffffffffeffffffffffffffffffffffff60601b19808889098186870982818d0983838b0984858a85098e0985868e87098c09868b8f088484101561076157928701925b84840393508784600209888182099050888186098484101561078257928901925b898585036002099350898485099c50898288099650898a8860020982089150818d10156107ae579b89019b5b818d039c5089818b87600209099450508b8610156107cb57948801945b888c870384099a50838b10156107e057998801995b838b039a50888789089750888283099050878110156107fc5788015b88858983030999505050505050505050505b96509650969350505050565b60008184111561082a5781840693505b60405160208152602080820152602060408201528460608201528360808201528260a082015260208160c08360056105dcfa80801561004157505051949350505050565b600080826000036108845750600090508061062b565b60006108a4846ffffffffeffffffffffffffffffffffff60601b19610529565b905060006ffffffffeffffffffffffffffffffffff60601b1982830990506ffffffffeffffffffffffffffffffffff60601b1981880993506ffffffffeffffffffffffffffffffffff60601b1980838309870992505050935093915050565b60405180604001604052806002906020820280368337509192915050565b6040518061020001604052806010905b61095560405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816109315790505090565b60008083601f84011261097d57600080fd5b50813567ffffffffffffffff81111561099557600080fd5b6020830191508360208285010111156109ad57600080fd5b9250929050565b6000806000806000606086880312156109cc57600080fd5b85359450602086013567ffffffffffffffff808211156109eb57600080fd5b6109f789838a0161096b565b90965094506040880135915080821115610a1057600080fd5b50610a1d8882890161096b565b969995985093965092949392505050565b60008060408385031215610a4157600080fd5b50508035926020909101359150565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8181038181111561052357610523610a66565b600081610a9e57610a9e610a66565b50600019019056fea164736f6c6343000813000a", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806372a4c30f1461004657806391327ec61461007d578063ae7e17f014610098575b600080fd5b61006a7bffffffff00000000000000004319055258e8617b0c46353d039cdaae1981565b6040519081526020015b60405180910390f35b61006a6ffffffffeffffffffffffffffffffffff60601b1981565b6100ab6100a63660046109b4565b6100bb565b6040519015158152602001610074565b60006100c5610903565b6100d185870187610a2e565b60208301528082527bffffffff00000000000000004319055258e8617b0c46353d039cdaae19111580610125575060208101517bffffffff00000000000000004319055258e8617b0c46353d039cdaae1911155b1561013457600091505061017b565b61013c610903565b61014884860186610a2e565b6020830181905281835260009161015e91610184565b83516020850151919250610175918391908c610365565b93505050505b95945050505050565b61018c610921565b604051806060016040528060008152602001600081526020016000815250816000601081106101bd576101bd610a50565b602002018190525060405180606001604052808481526020018381526020016001815250816001601081106101f4576101f4610a50565b602002015261020a8160015b6020020151610453565b60408201526102298160015b60200201518260025b60200201516104b5565b6060828101919091526040805191820181527f6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c29682527f4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5602083015260019082015260808201526102a38160045b602002015182600161021f565b60a08201526102b3816004610216565b60c08201526102cc8160045b602002015182600361021f565b60e08201526102dc816004610200565b6101008201526102ed816008610296565b6101208201526102fe816008610216565b61014082015261030f8160086102bf565b61016082015260808101516103269082600861021f565b61018082015261033781600c610296565b6101a082015261034881600c610216565b6101c082015261035981600c6102bf565b6101e082015292915050565b60007bffffffff00000000000000004319055258e8617b0c46353d039cdaae19841015806103b057507bffffffff00000000000000004319055258e8617b0c46353d039cdaae198310155b156103bd5750600061044b565b60006103e6847bffffffff00000000000000004319055258e8617b0c46353d039cdaae19610529565b905060007bffffffff00000000000000004319055258e8617b0c46353d039cdaae19828509905060007bffffffff00000000000000004319055258e8617b0c46353d039cdaae1983880990506000806104408a8585610547565b508914955050505050505b949350505050565b61047760405180606001604052806000815260200160008152602001600081525090565b6000806000610493856000015186602001518760400151610633565b6040805160608101825293845260208401929092529082015295945050505050565b6104d960405180606001604052806000815260200160008152602001600081525090565b6000806000610504866000015187602001518860400151886000015189602001518a604001516106ee565b6040805160608101825293845260208401929092529082015293505050505b92915050565b60006105408361053a600285610a7c565b8461081a565b9392505050565b6000808080806080815b811561061557821561058257610568858585610633565b9196509450925061057a858585610633565b919650945092505b50600c60fc89901c1660fe88901c1780156105f8576105f08585858d85601081106105af576105af610a50565b6020020151518e86601081106105c7576105c7610a50565b6020020151602001518f87601081106105e2576105e2610a50565b6020020151604001516106ee565b919650945092505b600298891b989790971b968161060d81610a8f565b925050610551565b61062085858561086e565b909750955050505050505b935093915050565b60008060006ffffffffeffffffffffffffffffffffff60601b198085860981828283097fffffffff00000001000000000000000000000000fffffffffffffffffffffffc099050818788098283828b0960040983848384096008099150838385868d8e09600309089250838160020984848509818110156106b15785015b039650868110156106bf5783015b838782038409955050808510156106d557938201935b9093039250808086880960020991505093509350939050565b60008060008660000361070857508491508390508261080e565b8360000361071d57508791508690508561080e565b6ffffffffeffffffffffffffffffffffff60601b19808889098186870982818d0983838b0984858a85098e0985868e87098c09868b8f088484101561076157928701925b84840393508784600209888182099050888186098484101561078257928901925b898585036002099350898485099c50898288099650898a8860020982089150818d10156107ae579b89019b5b818d039c5089818b87600209099450508b8610156107cb57948801945b888c870384099a50838b10156107e057998801995b838b039a50888789089750888283099050878110156107fc5788015b88858983030999505050505050505050505b96509650969350505050565b60008184111561082a5781840693505b60405160208152602080820152602060408201528460608201528360808201528260a082015260208160c08360056105dcfa80801561004157505051949350505050565b600080826000036108845750600090508061062b565b60006108a4846ffffffffeffffffffffffffffffffffff60601b19610529565b905060006ffffffffeffffffffffffffffffffffff60601b1982830990506ffffffffeffffffffffffffffffffffff60601b1981880993506ffffffffeffffffffffffffffffffffff60601b1980838309870992505050935093915050565b60405180604001604052806002906020820280368337509192915050565b6040518061020001604052806010905b61095560405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816109315790505090565b60008083601f84011261097d57600080fd5b50813567ffffffffffffffff81111561099557600080fd5b6020830191508360208285010111156109ad57600080fd5b9250929050565b6000806000806000606086880312156109cc57600080fd5b85359450602086013567ffffffffffffffff808211156109eb57600080fd5b6109f789838a0161096b565b90965094506040880135915080821115610a1057600080fd5b50610a1d8882890161096b565b969995985093965092949392505050565b60008060408385031215610a4157600080fd5b50508035926020909101359150565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8181038181111561052357610523610a66565b600081610a9e57610a9e610a66565b50600019019056fea164736f6c6343000813000a", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/sepolia/SmartAccountFactory.json b/deployments/sepolia/SmartAccountFactory.json new file mode 100644 index 0000000..ed02b68 --- /dev/null +++ b/deployments/sepolia/SmartAccountFactory.json @@ -0,0 +1,157 @@ +{ + "address": "0x6cBd0B9c0e1E0355586699a462Eb873275A9d85c", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "_entryPoint", + "type": "address" + }, + { + "internalType": "address", + "name": "_handler", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "accountImplementation", + "outputs": [ + { + "internalType": "contract SmartAccount", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "validators", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "uint256", + "name": "salt", + "type": "uint256" + } + ], + "name": "createAccount", + "outputs": [ + { + "internalType": "contract SmartAccount", + "name": "ret", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "validators", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + }, + { + "internalType": "uint256", + "name": "salt", + "type": "uint256" + } + ], + "name": "getAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "handler", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xe5b1df550bf7412d6c491e036a28e7efd31e860cfb2dff4cc2077425ea97fe2b", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x962F35D2249B069B38BbE169B2A449f823b8Bf79", + "contractAddress": null, + "transactionIndex": 33, + "gasUsed": "2617504", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000008000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf64ab17223c881675af4a32b75f287d073d0295ebbf8756ee7445aa1eec15dee", + "transactionHash": "0xe5b1df550bf7412d6c491e036a28e7efd31e860cfb2dff4cc2077425ea97fe2b", + "logs": [ + { + "transactionIndex": 33, + "blockNumber": 4462123, + "transactionHash": "0xe5b1df550bf7412d6c491e036a28e7efd31e860cfb2dff4cc2077425ea97fe2b", + "address": "0xc2E8C3AD3eA46B8Dcd84B20C160A20087870CfEe", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 41, + "blockHash": "0xf64ab17223c881675af4a32b75f287d073d0295ebbf8756ee7445aa1eec15dee" + } + ], + "blockNumber": 4462123, + "cumulativeGasUsed": "11595145", + "status": 1, + "byzantium": true + }, + "args": [ + "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + "0xe485aeaD5dDB58CbeB6104648cBDFbef5b9630F5" + ], + "numDeployments": 1, + "solcInputHash": "23f21117f22f82b6c8f285345928df93", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IEntryPoint\",\"name\":\"_entryPoint\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_handler\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"accountImplementation\",\"outputs\":[{\"internalType\":\"contract SmartAccount\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256\",\"name\":\"salt\",\"type\":\"uint256\"}],\"name\":\"createAccount\",\"outputs\":[{\"internalType\":\"contract SmartAccount\",\"name\":\"ret\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256\",\"name\":\"salt\",\"type\":\"uint256\"}],\"name\":\"getAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"handler\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/SmartAccountFactory.sol\":\"SmartAccountFactory\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"@account-abstraction/contracts/core/BaseAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-empty-blocks */\\n\\nimport \\\"../interfaces/IAccount.sol\\\";\\nimport \\\"../interfaces/IEntryPoint.sol\\\";\\nimport \\\"./Helpers.sol\\\";\\n\\n/**\\n * Basic account implementation.\\n * this contract provides the basic logic for implementing the IAccount interface - validateUserOp\\n * specific account implementation should inherit it and provide the account-specific logic\\n */\\nabstract contract BaseAccount is IAccount {\\n using UserOperationLib for UserOperation;\\n\\n //return value in case of signature failure, with no time-range.\\n // equivalent to _packValidationData(true,0,0);\\n uint256 constant internal SIG_VALIDATION_FAILED = 1;\\n\\n /**\\n * Return the account nonce.\\n * This method returns the next sequential nonce.\\n * For a nonce of a specific key, use `entrypoint.getNonce(account, key)`\\n */\\n function getNonce() public view virtual returns (uint256) {\\n return entryPoint().getNonce(address(this), 0);\\n }\\n\\n /**\\n * return the entryPoint used by this account.\\n * subclass should return the current entryPoint used by this account.\\n */\\n function entryPoint() public view virtual returns (IEntryPoint);\\n\\n /**\\n * Validate user's signature and nonce.\\n * subclass doesn't need to override this method. Instead, it should override the specific internal validation methods.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external override virtual returns (uint256 validationData) {\\n _requireFromEntryPoint();\\n validationData = _validateSignature(userOp, userOpHash);\\n _validateNonce(userOp.nonce);\\n _payPrefund(missingAccountFunds);\\n }\\n\\n /**\\n * ensure the request comes from the known entrypoint.\\n */\\n function _requireFromEntryPoint() internal virtual view {\\n require(msg.sender == address(entryPoint()), \\\"account: not from EntryPoint\\\");\\n }\\n\\n /**\\n * validate the signature is valid for this message.\\n * @param userOp validate the userOp.signature field\\n * @param userOpHash convenient field: the hash of the request, to check the signature against\\n * (also hashes the entrypoint and chain id)\\n * @return validationData signature and time-range of this operation\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If the account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)\\n internal virtual returns (uint256 validationData);\\n\\n /**\\n * Validate the nonce of the UserOperation.\\n * This method may validate the nonce requirement of this account.\\n * e.g.\\n * To limit the nonce to use sequenced UserOps only (no \\\"out of order\\\" UserOps):\\n * `require(nonce < type(uint64).max)`\\n * For a hypothetical account that *requires* the nonce to be out-of-order:\\n * `require(nonce & type(uint64).max == 0)`\\n *\\n * The actual nonce uniqueness is managed by the EntryPoint, and thus no other\\n * action is needed by the account itself.\\n *\\n * @param nonce to validate\\n *\\n * solhint-disable-next-line no-empty-blocks\\n */\\n function _validateNonce(uint256 nonce) internal view virtual {\\n }\\n\\n /**\\n * sends to the entrypoint (msg.sender) the missing funds for this transaction.\\n * subclass MAY override this method for better funds management\\n * (e.g. send to the entryPoint more than the minimum required, so that in future transactions\\n * it will not be required to send again)\\n * @param missingAccountFunds the minimum value this method should send the entrypoint.\\n * this value MAY be zero, in case there is enough deposit, or the userOp has a paymaster.\\n */\\n function _payPrefund(uint256 missingAccountFunds) internal virtual {\\n if (missingAccountFunds != 0) {\\n (bool success,) = payable(msg.sender).call{value : missingAccountFunds, gas : type(uint256).max}(\\\"\\\");\\n (success);\\n //ignore failure (its EntryPoint's job to verify, not account.)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5eb3253b32fd8ba8ae7b9d83da8e9924254a4d3d17a8772b41280e8572974b3c\",\"license\":\"GPL-3.0\"},\"@account-abstraction/contracts/core/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\n/**\\n * returned data from validateUserOp.\\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\\n * @param aggregator - address(0) - the account validated the signature by itself.\\n * address(1) - the account failed to validate the signature.\\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\\n * @param validAfter - this UserOp is valid only after this timestamp.\\n * @param validaUntil - this UserOp is valid only up to this timestamp.\\n */\\n struct ValidationData {\\n address aggregator;\\n uint48 validAfter;\\n uint48 validUntil;\\n }\\n\\n//extract sigFailed, validAfter, validUntil.\\n// also convert zero validUntil to type(uint48).max\\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\\n address aggregator = address(uint160(validationData));\\n uint48 validUntil = uint48(validationData >> 160);\\n if (validUntil == 0) {\\n validUntil = type(uint48).max;\\n }\\n uint48 validAfter = uint48(validationData >> (48 + 160));\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n// intersect account and paymaster ranges.\\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\\n ValidationData memory accountValidationData = _parseValidationData(validationData);\\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\\n address aggregator = accountValidationData.aggregator;\\n if (aggregator == address(0)) {\\n aggregator = pmValidationData.aggregator;\\n }\\n uint48 validAfter = accountValidationData.validAfter;\\n uint48 validUntil = accountValidationData.validUntil;\\n uint48 pmValidAfter = pmValidationData.validAfter;\\n uint48 pmValidUntil = pmValidationData.validUntil;\\n\\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\\n return ValidationData(aggregator, validAfter, validUntil);\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp\\n * @param data - the ValidationData to pack\\n */\\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\\n }\\n\\n/**\\n * helper to pack the return value for validateUserOp, when not using an aggregator\\n * @param sigFailed - true for signature failure, false for success\\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\\n * @param validAfter first timestamp this UserOperation is valid\\n */\\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\\n }\\n\\n/**\\n * keccak function over calldata.\\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\\n */\\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\\n assembly {\\n let mem := mload(0x40)\\n let len := data.length\\n calldatacopy(mem, data.offset, len)\\n ret := keccak256(mem, len)\\n }\\n }\\n\\n\",\"keccak256\":\"0x591c87519f7155d1909210276b77925ab2722a99b7b5d5649aecc36ebbdb045a\",\"license\":\"GPL-3.0\"},\"@account-abstraction/contracts/interfaces/IAccount.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\ninterface IAccount {\\n\\n /**\\n * Validate user's signature and nonce\\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\\n * This allows making a \\\"simulation call\\\" without a valid signature\\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\\n *\\n * @dev Must validate caller is the entryPoint.\\n * Must validate the signature and nonce\\n * @param userOp the operation that is about to be executed.\\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\\n * The excess is left as a deposit in the entrypoint, for future calls.\\n * can be withdrawn anytime using \\\"entryPoint.withdrawTo()\\\"\\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\\n * otherwise, an address of an \\\"authorizer\\\" contract.\\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \\\"indefinite\\\"\\n * <6-byte> validAfter - first timestamp this operation is valid\\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\\n */\\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\\n external returns (uint256 validationData);\\n}\\n\",\"keccak256\":\"0x556a0e5980de18e90b115553ed502408155ba35f58642823010d9288047bc418\",\"license\":\"GPL-3.0\"},\"@account-abstraction/contracts/interfaces/IAggregator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\nimport \\\"./UserOperation.sol\\\";\\n\\n/**\\n * Aggregated Signatures validator.\\n */\\ninterface IAggregator {\\n\\n /**\\n * validate aggregated signature.\\n * revert if the aggregated signature does not match the given list of operations.\\n */\\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\\n\\n /**\\n * validate signature of a single userOp\\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\\n * @param userOp the userOperation received from the user.\\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\\n * (usually empty, unless account and aggregator support some kind of \\\"multisig\\\"\\n */\\n function validateUserOpSignature(UserOperation calldata userOp)\\n external view returns (bytes memory sigForUserOp);\\n\\n /**\\n * aggregate multiple signatures into a single value.\\n * This method is called off-chain to calculate the signature to pass with handleOps()\\n * bundler MAY use optimized custom code perform this aggregation\\n * @param userOps array of UserOperations to collect the signatures from.\\n * @return aggregatedSignature the aggregated signature\\n */\\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\\n}\\n\",\"keccak256\":\"0x060e9ddb0152250c269ba0640dc5753834ac44cf182a2837d508c0c529cae26a\",\"license\":\"GPL-3.0\"},\"@account-abstraction/contracts/interfaces/IEntryPoint.sol\":{\"content\":\"/**\\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\\n ** Only one instance required on each chain.\\n **/\\n// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable avoid-low-level-calls */\\n/* solhint-disable no-inline-assembly */\\n/* solhint-disable reason-string */\\n\\nimport \\\"./UserOperation.sol\\\";\\nimport \\\"./IStakeManager.sol\\\";\\nimport \\\"./IAggregator.sol\\\";\\nimport \\\"./INonceManager.sol\\\";\\n\\ninterface IEntryPoint is IStakeManager, INonceManager {\\n\\n /***\\n * An event emitted after each successful request\\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\\n * @param sender - the account that generates this request.\\n * @param paymaster - if non-null, the paymaster that pays for this request.\\n * @param nonce - the nonce value from the request.\\n * @param success - true if the sender transaction succeeded, false if reverted.\\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\\n */\\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\\n\\n /**\\n * account \\\"sender\\\" was deployed.\\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\\n * @param sender the account that is deployed\\n * @param factory the factory used to deploy this account (in the initCode)\\n * @param paymaster the paymaster used by this UserOp\\n */\\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\\n\\n /**\\n * An event emitted if the UserOperation \\\"callData\\\" reverted with non-zero length\\n * @param userOpHash the request unique identifier.\\n * @param sender the sender of this request\\n * @param nonce the nonce used in the request\\n * @param revertReason - the return bytes from the (reverted) call to \\\"callData\\\".\\n */\\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\\n\\n /**\\n * an event emitted by handleOps(), before starting the execution loop.\\n * any event emitted before this event, is part of the validation.\\n */\\n event BeforeExecution();\\n\\n /**\\n * signature aggregator used by the following UserOperationEvents within this bundle.\\n */\\n event SignatureAggregatorChanged(address indexed aggregator);\\n\\n /**\\n * a custom revert error of handleOps, to identify the offending op.\\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\\n * @param reason - revert reason\\n * The string starts with a unique code \\\"AAmn\\\", where \\\"m\\\" is \\\"1\\\" for factory, \\\"2\\\" for account and \\\"3\\\" for paymaster issues,\\n * so a failure can be attributed to the correct entity.\\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\\n */\\n error FailedOp(uint256 opIndex, string reason);\\n\\n /**\\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\\n */\\n error SignatureValidationFailed(address aggregator);\\n\\n /**\\n * Successful result from simulateValidation.\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n */\\n error ValidationResult(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\\n\\n /**\\n * Successful result from simulateValidation, if the account returns a signature aggregator\\n * @param returnInfo gas and time-range returned values\\n * @param senderInfo stake information about the sender\\n * @param factoryInfo stake information about the factory (if any)\\n * @param paymasterInfo stake information about the paymaster (if any)\\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\\n * bundler MUST use it to verify the signature, or reject the UserOperation\\n */\\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\\n AggregatorStakeInfo aggregatorInfo);\\n\\n /**\\n * return value of getSenderAddress\\n */\\n error SenderAddressResult(address sender);\\n\\n /**\\n * return value of simulateHandleOp\\n */\\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\\n\\n //UserOps handled, per aggregator\\n struct UserOpsPerAggregator {\\n UserOperation[] userOps;\\n\\n // aggregator address\\n IAggregator aggregator;\\n // aggregated signature\\n bytes signature;\\n }\\n\\n /**\\n * Execute a batch of UserOperation.\\n * no signature aggregator is used.\\n * if any account requires an aggregator (that is, it returned an aggregator when\\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\\n * @param ops the operations to execute\\n * @param beneficiary the address to receive the fees\\n */\\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\\n\\n /**\\n * Execute a batch of UserOperation with Aggregators\\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\\n * @param beneficiary the address to receive the fees\\n */\\n function handleAggregatedOps(\\n UserOpsPerAggregator[] calldata opsPerAggregator,\\n address payable beneficiary\\n ) external;\\n\\n /**\\n * generate a request Id - unique identifier for this request.\\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\\n */\\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\\n\\n /**\\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\\n * @param userOp the user operation to validate.\\n */\\n function simulateValidation(UserOperation calldata userOp) external;\\n\\n /**\\n * gas and return values during simulation\\n * @param preOpGas the gas used for validation (including preValidationGas)\\n * @param prefund the required prefund for this operation\\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\\n */\\n struct ReturnInfo {\\n uint256 preOpGas;\\n uint256 prefund;\\n bool sigFailed;\\n uint48 validAfter;\\n uint48 validUntil;\\n bytes paymasterContext;\\n }\\n\\n /**\\n * returned aggregated signature info.\\n * the aggregator returned by the account, and its current stake.\\n */\\n struct AggregatorStakeInfo {\\n address aggregator;\\n StakeInfo stakeInfo;\\n }\\n\\n /**\\n * Get counterfactual sender address.\\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\\n * this method always revert, and returns the address in SenderAddressResult error\\n * @param initCode the constructor code to be passed into the UserOperation.\\n */\\n function getSenderAddress(bytes memory initCode) external;\\n\\n\\n /**\\n * simulate full execution of a UserOperation (including both validation and target execution)\\n * this method will always revert with \\\"ExecutionResult\\\".\\n * it performs full validation of the UserOperation, but ignores signature error.\\n * an optional target address is called after the userop succeeds, and its value is returned\\n * (before the entire call is reverted)\\n * Note that in order to collect the the success/failure of the target call, it must be executed\\n * with trace enabled to track the emitted events.\\n * @param op the UserOperation to simulate\\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\\n * are set to the return from that call.\\n * @param targetCallData callData to pass to target address\\n */\\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\\n}\\n\\n\",\"keccak256\":\"0x3a90bf308819ed125fa4202f880999caff8a8686633b8ddb79a30ca240d5b8f8\",\"license\":\"GPL-3.0\"},\"@account-abstraction/contracts/interfaces/INonceManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\ninterface INonceManager {\\n\\n /**\\n * Return the next nonce for this sender.\\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\\n * But UserOp with different keys can come with arbitrary order.\\n *\\n * @param sender the account address\\n * @param key the high 192 bit of the nonce\\n * @return nonce a full nonce to pass for next UserOp with this sender.\\n */\\n function getNonce(address sender, uint192 key)\\n external view returns (uint256 nonce);\\n\\n /**\\n * Manually increment the nonce of the sender.\\n * This method is exposed just for completeness..\\n * Account does NOT need to call it, neither during validation, nor elsewhere,\\n * as the EntryPoint will update the nonce regardless.\\n * Possible use-case is call it with various keys to \\\"initialize\\\" their nonces to one, so that future\\n * UserOperations will not pay extra for the first transaction with a given key.\\n */\\n function incrementNonce(uint192 key) external;\\n}\\n\",\"keccak256\":\"0x509871e6c63663cdcc3eba19920fe84e991f38b289b1377ac3c3a6d9f22d7e12\",\"license\":\"GPL-3.0\"},\"@account-abstraction/contracts/interfaces/IStakeManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\npragma solidity ^0.8.12;\\n\\n/**\\n * manage deposits and stakes.\\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\\n * stake is value locked for at least \\\"unstakeDelay\\\" by the staked entity.\\n */\\ninterface IStakeManager {\\n\\n event Deposited(\\n address indexed account,\\n uint256 totalDeposit\\n );\\n\\n event Withdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /// Emitted when stake or unstake delay are modified\\n event StakeLocked(\\n address indexed account,\\n uint256 totalStaked,\\n uint256 unstakeDelaySec\\n );\\n\\n /// Emitted once a stake is scheduled for withdrawal\\n event StakeUnlocked(\\n address indexed account,\\n uint256 withdrawTime\\n );\\n\\n event StakeWithdrawn(\\n address indexed account,\\n address withdrawAddress,\\n uint256 amount\\n );\\n\\n /**\\n * @param deposit the entity's deposit\\n * @param staked true if this entity is staked.\\n * @param stake actual amount of ether staked for this entity.\\n * @param unstakeDelaySec minimum delay to withdraw the stake.\\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\\n * and the rest fit into a 2nd cell.\\n * 112 bit allows for 10^15 eth\\n * 48 bit for full timestamp\\n * 32 bit allows 150 years for unstake delay\\n */\\n struct DepositInfo {\\n uint112 deposit;\\n bool staked;\\n uint112 stake;\\n uint32 unstakeDelaySec;\\n uint48 withdrawTime;\\n }\\n\\n //API struct used by getStakeInfo and simulateValidation\\n struct StakeInfo {\\n uint256 stake;\\n uint256 unstakeDelaySec;\\n }\\n\\n /// @return info - full deposit information of given account\\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\\n\\n /// @return the deposit (for gas payment) of the account\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * add to the deposit of the given account\\n */\\n function depositTo(address account) external payable;\\n\\n /**\\n * add to the account's stake - amount and delay\\n * any pending unstake is first cancelled.\\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\\n */\\n function addStake(uint32 _unstakeDelaySec) external payable;\\n\\n /**\\n * attempt to unlock the stake.\\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\\n */\\n function unlockStake() external;\\n\\n /**\\n * withdraw from the (unlocked) stake.\\n * must first call unlockStake and wait for the unstakeDelay to pass\\n * @param withdrawAddress the address to send withdrawn value.\\n */\\n function withdrawStake(address payable withdrawAddress) external;\\n\\n /**\\n * withdraw from the deposit.\\n * @param withdrawAddress the address to send withdrawn value.\\n * @param withdrawAmount the amount to withdraw.\\n */\\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\\n}\\n\",\"keccak256\":\"0xd227b02888cd4ac68daebcdfd992ec00f9fff66fa3b3bb16f656cd582fa3480f\",\"license\":\"GPL-3.0-only\"},\"@account-abstraction/contracts/interfaces/UserOperation.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-inline-assembly */\\n\\nimport {calldataKeccak} from \\\"../core/Helpers.sol\\\";\\n\\n/**\\n * User Operation struct\\n * @param sender the sender account of this request.\\n * @param nonce unique value the sender uses to verify it is not a replay.\\n * @param initCode if set, the account contract will be created by this constructor/\\n * @param callData the method call to execute on this account.\\n * @param callGasLimit the gas limit passed to the callData method call.\\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\\n * @param maxFeePerGas same as EIP-1559 gas parameter.\\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\\n */\\n struct UserOperation {\\n\\n address sender;\\n uint256 nonce;\\n bytes initCode;\\n bytes callData;\\n uint256 callGasLimit;\\n uint256 verificationGasLimit;\\n uint256 preVerificationGas;\\n uint256 maxFeePerGas;\\n uint256 maxPriorityFeePerGas;\\n bytes paymasterAndData;\\n bytes signature;\\n }\\n\\n/**\\n * Utility functions helpful when working with UserOperation structs.\\n */\\nlibrary UserOperationLib {\\n\\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\\n address data;\\n //read sender from userOp, which is first userOp member (saves 800 gas...)\\n assembly {data := calldataload(userOp)}\\n return address(uint160(data));\\n }\\n\\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\\n // pay above what he signed for.\\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\\n unchecked {\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n if (maxFeePerGas == maxPriorityFeePerGas) {\\n //legacy mode (for networks that don't support basefee opcode)\\n return maxFeePerGas;\\n }\\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\\n }\\n }\\n\\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\\n address sender = getSender(userOp);\\n uint256 nonce = userOp.nonce;\\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\\n bytes32 hashCallData = calldataKeccak(userOp.callData);\\n uint256 callGasLimit = userOp.callGasLimit;\\n uint256 verificationGasLimit = userOp.verificationGasLimit;\\n uint256 preVerificationGas = userOp.preVerificationGas;\\n uint256 maxFeePerGas = userOp.maxFeePerGas;\\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\\n\\n return abi.encode(\\n sender, nonce,\\n hashInitCode, hashCallData,\\n callGasLimit, verificationGasLimit, preVerificationGas,\\n maxFeePerGas, maxPriorityFeePerGas,\\n hashPaymasterAndData\\n );\\n }\\n\\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\\n return keccak256(pack(userOp));\\n }\\n\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n}\\n\",\"keccak256\":\"0x61374003361059087fdcf17967a7bba052badeaf5c7f0ae689166f8aafd3a45c\",\"license\":\"GPL-3.0\"},\"@account-abstraction/contracts/samples/callback/TokenCallbackHandler.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity ^0.8.12;\\n\\n/* solhint-disable no-empty-blocks */\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\\\";\\n\\n/**\\n * Token callback handler.\\n * Handles supported tokens' callbacks, allowing account receiving these tokens.\\n */\\ncontract TokenCallbackHandler is IERC777Recipient, IERC721Receiver, IERC1155Receiver {\\n function tokensReceived(\\n address,\\n address,\\n address,\\n uint256,\\n bytes calldata,\\n bytes calldata\\n ) external pure override {\\n }\\n\\n function onERC721Received(\\n address,\\n address,\\n uint256,\\n bytes calldata\\n ) external pure override returns (bytes4) {\\n return IERC721Receiver.onERC721Received.selector;\\n }\\n\\n function onERC1155Received(\\n address,\\n address,\\n uint256,\\n uint256,\\n bytes calldata\\n ) external pure override returns (bytes4) {\\n return IERC1155Receiver.onERC1155Received.selector;\\n }\\n\\n function onERC1155BatchReceived(\\n address,\\n address,\\n uint256[] calldata,\\n uint256[] calldata,\\n bytes calldata\\n ) external pure override returns (bytes4) {\\n return IERC1155Receiver.onERC1155BatchReceived.selector;\\n }\\n\\n function supportsInterface(bytes4 interfaceId) external view virtual override returns (bool) {\\n return\\n interfaceId == type(IERC721Receiver).interfaceId ||\\n interfaceId == type(IERC1155Receiver).interfaceId ||\\n interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xfff3df5f5211d71158bb017ff791dc4fa85db53890f7bd72bac3a43d89e83752\",\"license\":\"GPL-3.0\"},\"@openzeppelin/contracts/interfaces/IERC1967.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n *\\n * _Available since v4.8.3._\\n */\\ninterface IERC1967 {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0x3cbef5ebc24b415252e2f8c0c9254555d30d9f085603b4b80d9b5ed20ab87e90\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/IERC1967.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n */\\nabstract contract ERC1967Upgrade is IERC1967 {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3b21ae06bf5957f73fa16754b0669c77b7abd8ba6c072d35c3281d446fdb86c2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized != type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x3d6069be9b4c01fb81840fb9c2c4dc58dd6a6a4aafaa2c6837de8699574d84c6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev _Available since v3.1._\\n */\\ninterface IERC1155Receiver is IERC165 {\\n /**\\n * @dev Handles the receipt of a single ERC1155 token type. This function is\\n * called at the end of a `safeTransferFrom` after the balance has been updated.\\n *\\n * NOTE: To accept the transfer, this must return\\n * `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))`\\n * (i.e. 0xf23a6e61, or its own function selector).\\n *\\n * @param operator The address which initiated the transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param id The ID of the token being transferred\\n * @param value The amount of tokens being transferred\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155Received(address,address,uint256,uint256,bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155Received(\\n address operator,\\n address from,\\n uint256 id,\\n uint256 value,\\n bytes calldata data\\n ) external returns (bytes4);\\n\\n /**\\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\\n * is called at the end of a `safeBatchTransferFrom` after the balances have\\n * been updated.\\n *\\n * NOTE: To accept the transfer(s), this must return\\n * `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))`\\n * (i.e. 0xbc197c81, or its own function selector).\\n *\\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\\n * @param from The address which previously owned the token\\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\\n * @param data Additional data with no specified format\\n * @return `bytes4(keccak256(\\\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\\\"))` if transfer is allowed\\n */\\n function onERC1155BatchReceived(\\n address operator,\\n address from,\\n uint256[] calldata ids,\\n uint256[] calldata values,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xeb373f1fdc7b755c6a750123a9b9e3a8a02c1470042fd6505d875000a80bde0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721Receiver {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xa82b58eca1ee256be466e536706850163d2ec7821945abd6b4778cfb3bee37da\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\\n *\\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\\n * contract implement this interface (contract holders can be their own\\n * implementer) and registering it on the\\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\\n *\\n * See {IERC1820Registry} and {ERC1820Implementer}.\\n */\\ninterface IERC777Recipient {\\n /**\\n * @dev Called by an {IERC777} token contract whenever tokens are being\\n * moved or created into a registered account (`to`). The type of operation\\n * is conveyed by `from` being the zero address or not.\\n *\\n * This call occurs _after_ the token contract's state is updated, so\\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\\n *\\n * This function may revert to prevent the operation from being executed.\\n */\\n function tokensReceived(\\n address operator,\\n address from,\\n address to,\\n uint256 amount,\\n bytes calldata userData,\\n bytes calldata operatorData\\n ) external;\\n}\\n\",\"keccak256\":\"0x1a5d61db2733202ba361e6d6741cd2e662380e22b80e987eacfc91973f2267dc\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n *\\n * Furthermore, `isContract` will also return true if the target contract within\\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n * which only has an effect at the end of a transaction.\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Create2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\\n * `CREATE2` can be used to compute in advance the address where a smart\\n * contract will be deployed, which allows for interesting new mechanisms known\\n * as 'counterfactual interactions'.\\n *\\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\\n * information.\\n */\\nlibrary Create2 {\\n /**\\n * @dev Deploys a contract using `CREATE2`. The address where the contract\\n * will be deployed can be known in advance via {computeAddress}.\\n *\\n * The bytecode for a contract can be obtained from Solidity with\\n * `type(contractName).creationCode`.\\n *\\n * Requirements:\\n *\\n * - `bytecode` must not be empty.\\n * - `salt` must have not been used for `bytecode` already.\\n * - the factory must have a balance of at least `amount`.\\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\\n */\\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\\n require(address(this).balance >= amount, \\\"Create2: insufficient balance\\\");\\n require(bytecode.length != 0, \\\"Create2: bytecode length is zero\\\");\\n /// @solidity memory-safe-assembly\\n assembly {\\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\\n }\\n require(addr != address(0), \\\"Create2: Failed on deploy\\\");\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\\n * `bytecodeHash` or `salt` will result in a new destination address.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\\n return computeAddress(salt, bytecodeHash, address(this));\\n }\\n\\n /**\\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\\n */\\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n let ptr := mload(0x40) // Get free memory pointer\\n\\n // | | \\u2193 ptr ... \\u2193 ptr + 0x0B (start) ... \\u2193 ptr + 0x20 ... \\u2193 ptr + 0x40 ... |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\\n // | salt | BBBBBBBBBBBBB...BB |\\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\\n // | 0xFF | FF |\\n // |-------------------|---------------------------------------------------------------------------|\\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\\n // | keccak(start, 85) | \\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191\\u2191 |\\n\\n mstore(add(ptr, 0x40), bytecodeHash)\\n mstore(add(ptr, 0x20), salt)\\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\\n mstore8(start, 0xff)\\n addr := keccak256(start, 85)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6e00f269073ffc4350e56b7e8153c9092d5f70bfba423299990514183101ef89\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\\n * _Available since v4.9 for `string`, `bytes`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf09e68aa0dc6722a25bc46490e8d48ed864466d17313b8a0b254c36b54e49899\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/SmartAccount.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"@account-abstraction/contracts/core/BaseAccount.sol\\\";\\n\\nimport \\\"./core/EntryPointManager.sol\\\";\\nimport \\\"./core/ExecutionManager.sol\\\";\\nimport \\\"./core/FallbackManager.sol\\\";\\nimport \\\"./core/ValidatorManager.sol\\\";\\nimport \\\"./core/RecoveryManager.sol\\\";\\n\\ncontract SmartAccount is\\n BaseAccount,\\n Initializable,\\n EntryPointManager,\\n ExecutionManager,\\n FallbackManager,\\n ValidatorManager,\\n RecoveryManager\\n{\\n constructor(IEntryPoint _EntryPoint) EntryPointManager(_EntryPoint) {\\n _disableInitializers();\\n }\\n\\n function initialize(address defalutCallbackHandler, address[] calldata validators, bytes[] calldata data)\\n external\\n initializer\\n {\\n if (validators.length != data.length) {\\n revert WrongArrayLength();\\n }\\n _setFallbackHandler(defalutCallbackHandler);\\n _setupValidators();\\n _setupRecoverors();\\n for (uint256 i = 0; i < validators.length;) {\\n _enableValidator(validators[i], data[i]);\\n unchecked {\\n i++;\\n }\\n }\\n }\\n\\n function entryPoint() public view virtual override returns (IEntryPoint) {\\n return _entryPoint();\\n }\\n\\n function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)\\n internal\\n virtual\\n override\\n returns (uint256 validationData)\\n {\\n (address validator, bytes memory signature) = abi.decode(userOp.signature, (address, bytes));\\n\\n if (!isValidatorEnabled(validator)) {\\n return SIG_VALIDATION_FAILED;\\n }\\n return IValidator(validator).validateSignature(userOp.sender, userOpHash, signature);\\n }\\n\\n function recovery(address validator, bytes calldata data) external {\\n if (!isRecoverorEnabled(msg.sender)) {\\n revert ErrorRecoveror(msg.sender);\\n }\\n if (!isValidatorEnabled(validator)) {\\n revert ErrorValidator(validator);\\n }\\n IValidator(validator).enable(data);\\n }\\n\\n function getDeposit() public view returns (uint256) {\\n return entryPoint().balanceOf(address(this));\\n }\\n\\n function addDeposit() public payable {\\n entryPoint().depositTo{value: msg.value}(address(this));\\n }\\n\\n function withdrawDepositTo(address payable withdrawAddress, uint256 amount) public onlySelf {\\n entryPoint().withdrawTo(withdrawAddress, amount);\\n }\\n}\\n\",\"keccak256\":\"0xcc7c8abe182d45fa2e8a4a3f4c835bec93556e55c958d23ddc643192b087b93b\",\"license\":\"MIT\"},\"contracts/SmartAccountFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@openzeppelin/contracts/utils/Create2.sol\\\";\\nimport \\\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\\\";\\n\\nimport \\\"./handler/DefaultCallbackHandler.sol\\\";\\nimport \\\"./SmartAccount.sol\\\";\\n\\ncontract SmartAccountFactory {\\n SmartAccount public immutable accountImplementation;\\n address public immutable handler;\\n\\n constructor(IEntryPoint _entryPoint, address _handler) {\\n handler = _handler;\\n accountImplementation = new SmartAccount(_entryPoint);\\n }\\n\\n function createAccount(address[] calldata validators, bytes[] calldata data, uint256 salt)\\n public\\n returns (SmartAccount ret)\\n {\\n address addr = getAddress(validators, data, salt);\\n uint256 codeSize = addr.code.length;\\n if (codeSize > 0) {\\n return SmartAccount(payable(addr));\\n }\\n ret = SmartAccount(\\n payable(\\n new ERC1967Proxy{salt : bytes32(salt)}(\\n address(accountImplementation),\\n abi.encodeCall(SmartAccount.initialize, (handler, validators, data))\\n )\\n )\\n );\\n }\\n\\n function getAddress(address[] calldata validators, bytes[] calldata data, uint256 salt)\\n public\\n view\\n returns (address)\\n {\\n return Create2.computeAddress(\\n bytes32(salt),\\n keccak256(\\n abi.encodePacked(\\n type(ERC1967Proxy).creationCode,\\n abi.encode(\\n address(accountImplementation),\\n abi.encodeCall(SmartAccount.initialize, (handler, validators, data))\\n )\\n )\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0x318adbf47ddb3d4cdf3583522536161cec0e44c219f41d44b048ea8ce4ec6bfd\",\"license\":\"MIT\"},\"contracts/common/Authority.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"./EntryPointAuth.sol\\\";\\n\\nabstract contract Authority is EntryPointAuth {\\n error CallerNotSelf();\\n\\n modifier onlySelf() {\\n if (msg.sender != address(this)) {\\n revert CallerNotSelf();\\n }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0x599a9aea1b310b373a7af03a93efa45e40e95506442b6be40e115161bbbf4ce0\",\"license\":\"MIT\"},\"contracts/common/Contants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nlibrary Contants {\\n address internal constant SENTINEL = address(0x1);\\n\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n}\\n\",\"keccak256\":\"0x4def4c34ea7d1925f182376cda97a69c536491aa43ebadaaf710b58173f5f76b\",\"license\":\"MIT\"},\"contracts/common/EntryPointAuth.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@account-abstraction/contracts/interfaces/IEntryPoint.sol\\\";\\n\\nabstract contract EntryPointAuth {\\n error CallerNotEntryPoint();\\n\\n function _entryPoint() internal view virtual returns (IEntryPoint);\\n\\n modifier onlyEntryPoint() {\\n if (msg.sender != address(_entryPoint())) {\\n revert CallerNotEntryPoint();\\n }\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xbae7db3e51a081a2c18d31e1019f4944c220325a1e36be14fedc4dd4bf6f20c6\",\"license\":\"MIT\"},\"contracts/core/EntryPointManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@account-abstraction/contracts/interfaces/IEntryPoint.sol\\\";\\nimport \\\"../common/EntryPointAuth.sol\\\";\\n\\nabstract contract EntryPointManager is EntryPointAuth {\\n IEntryPoint private immutable _ep;\\n\\n constructor(IEntryPoint anEntryPoint) {\\n _ep = anEntryPoint;\\n }\\n\\n function _entryPoint() internal view virtual override returns (IEntryPoint) {\\n return _ep;\\n }\\n}\\n\",\"keccak256\":\"0xa747ee772fed95a8be8c9409679d3737daa3a8ac909e1e0812a4d66ff771e1ac\",\"license\":\"MIT\"},\"contracts/core/ExecutionManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../common/Authority.sol\\\";\\nimport \\\"../interfaces/IHook.sol\\\";\\nimport \\\"../libraries/LinkedAddressList.sol\\\";\\n\\nabstract contract ExecutionManager is Authority {\\n using LinkedAddressList for mapping(address => address);\\n\\n error WrongArrayLength();\\n error InvalidHook();\\n\\n event InstalledHook(address indexed hook);\\n event UninstalledHook(address indexed hook);\\n\\n mapping(address => address) internal beforeHooks;\\n mapping(address => address) internal afterHooks;\\n\\n function addHook(address hook, bytes calldata data) external onlySelf {\\n IHook _hook = IHook(hook);\\n if (!IHook(hook).supportsInterface(type(IHook).interfaceId)) {\\n revert InvalidHook();\\n }\\n\\n if (_hook.hookType() == HookType.Pre) {\\n beforeHooks.add(hook);\\n } else if (_hook.hookType() == HookType.Post) {\\n afterHooks.add(hook);\\n } else {\\n beforeHooks.add(hook);\\n afterHooks.add(hook);\\n }\\n _hook.install(data);\\n\\n emit InstalledHook(hook);\\n }\\n\\n function removeRecoveror(address prevBeforeHook, address prevAfterHook, address hook) external onlySelf {\\n IHook _hook = IHook(hook);\\n\\n if (_hook.hookType() == HookType.Pre) {\\n beforeHooks.remove(prevBeforeHook, hook);\\n } else if (_hook.hookType() == HookType.Post) {\\n afterHooks.remove(prevAfterHook, hook);\\n } else {\\n beforeHooks.remove(prevBeforeHook, hook);\\n afterHooks.remove(prevAfterHook, hook);\\n }\\n _hook.uninstall();\\n\\n emit UninstalledHook(hook);\\n }\\n\\n function sudo(address dest, uint256 value, bytes calldata func) external onlyEntryPoint {\\n _call(dest, value, func);\\n }\\n\\n function execute(address dest, uint256 value, bytes calldata func) external onlyEntryPoint {\\n _execute(dest, value, func);\\n }\\n\\n function executeBatch(address[] calldata dest, uint256[] calldata value, bytes[] calldata func)\\n external\\n onlyEntryPoint\\n {\\n if (dest.length != func.length || (value.length != 0 && value.length != func.length)) {\\n revert WrongArrayLength();\\n }\\n if (value.length == 0) {\\n for (uint256 i = 0; i < dest.length;) {\\n _execute(dest[i], 0, func[i]);\\n unchecked {\\n i++;\\n }\\n }\\n } else {\\n for (uint256 i = 0; i < dest.length;) {\\n _execute(dest[i], value[i], func[i]);\\n unchecked {\\n i++;\\n }\\n }\\n }\\n }\\n\\n function _execute(address target, uint256 value, bytes memory data) internal {\\n address addr = beforeHooks[LinkedAddressList.SENTINEL];\\n while (uint160(addr) > LinkedAddressList.SENTINEL_UINT) {\\n IHook(addr).afterTransaction(target, value, data);\\n addr = beforeHooks[addr];\\n }\\n\\n _call(target, value, data);\\n\\n addr = afterHooks[LinkedAddressList.SENTINEL];\\n while (uint160(addr) > LinkedAddressList.SENTINEL_UINT) {\\n IHook(addr).afterTransaction(target, value, data);\\n addr = afterHooks[addr];\\n }\\n }\\n\\n function _call(address target, uint256 value, bytes memory data) internal {\\n (bool success, bytes memory result) = target.call{value: value}(data);\\n if (!success) {\\n assembly {\\n revert(add(result, 32), mload(result))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2dc4df1af1fda94b45ad34e81ff0d3ed3fd35670aa617b947db665719794ef63\",\"license\":\"MIT\"},\"contracts/core/FallbackManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../common/Authority.sol\\\";\\n\\nabstract contract FallbackManager is Authority {\\n error AddressCannotBeZero();\\n\\n // keccak-256 hash of \\\"fallback_manager.handler.address\\\" subtracted by 1\\n bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT =\\n 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d4;\\n\\n event ChangedFallbackHandler(address indexed previousHandler, address indexed handler);\\n\\n fallback() external {\\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\\n assembly {\\n let handler := sload(slot)\\n if iszero(handler) { return(0, 0) }\\n calldatacopy(0, 0, calldatasize())\\n // The msg.sender address is shifted to the left by 12 bytes to remove the padding\\n // Then the address without padding is stored right after the calldata\\n mstore(calldatasize(), shl(96, caller()))\\n // Add 20 bytes for the address appended add the end\\n let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n if iszero(success) { revert(0, returndatasize()) }\\n return(0, returndatasize())\\n }\\n }\\n\\n function getFallbackHandler() external view returns (address _handler) {\\n assembly {\\n _handler := sload(FALLBACK_HANDLER_STORAGE_SLOT)\\n }\\n }\\n\\n function setFallbackHandler(address handler) public onlySelf {\\n address previousHandler;\\n assembly {\\n previousHandler := sload(FALLBACK_HANDLER_STORAGE_SLOT)\\n }\\n _setFallbackHandler(handler);\\n emit ChangedFallbackHandler(previousHandler, handler);\\n }\\n\\n function _setFallbackHandler(address handler) internal {\\n if (handler == address(0)) revert AddressCannotBeZero();\\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\\n assembly {\\n sstore(slot, handler)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa6fd02b436619befd9dc7ef208d795e2285ed63e2091ba458203d8de382ed2e6\",\"license\":\"MIT\"},\"contracts/core/RecoveryManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../common/Authority.sol\\\";\\nimport \\\"../common/Contants.sol\\\";\\nimport \\\"../libraries/LinkedAddressList.sol\\\";\\nimport \\\"../interfaces/IRecoveror.sol\\\";\\n\\nabstract contract RecoveryManager is Authority {\\n error ErrorRecoveror(address);\\n\\n using LinkedAddressList for mapping(address => address);\\n\\n event AddedRecoveror(address recoveror);\\n event RemovedRecoveror(address recoveror);\\n\\n mapping(address => address) internal recoverors;\\n\\n function getRecoverorsPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next)\\n {\\n return recoverors.page(start, pageSize);\\n }\\n\\n function addRecoveror(address recoveror, bytes calldata data) external onlySelf {\\n recoverors.add(recoveror);\\n IRecoveror(recoveror).bind(data);\\n emit AddedRecoveror(recoveror);\\n }\\n\\n function removeRecoveror(address prevRecoveror, address recoveror) external onlySelf {\\n recoverors.remove(prevRecoveror, recoveror);\\n emit RemovedRecoveror(recoveror);\\n }\\n\\n function isRecoverorEnabled(address recoveror) public view returns (bool) {\\n return recoverors.contains(recoveror);\\n }\\n\\n function _setupRecoverors() internal {\\n recoverors.setup();\\n }\\n}\\n\",\"keccak256\":\"0x251aae606d592571ce4c7bfe01bf9c0294fdf9b28fbf657fc4c1927036767a6a\",\"license\":\"MIT\"},\"contracts/core/ValidatorManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../common/Authority.sol\\\";\\nimport \\\"../common/Contants.sol\\\";\\nimport \\\"../libraries/LinkedAddressList.sol\\\";\\nimport \\\"../interfaces/IValidator.sol\\\";\\n\\nabstract contract ValidatorManager is Authority {\\n error ErrorValidator(address);\\n\\n using LinkedAddressList for mapping(address => address);\\n\\n error ValidatorCannotBeZeroOrSentinel(address validator);\\n error ValidatorAlreadyEnabled(address validator);\\n error ValidatorAndPrevValidatorMismatch(address expectedValidator, address returnedValidator, address prevValidator);\\n\\n event EnabledValidator(address validator);\\n event DisabledValidator(address validator);\\n\\n mapping(address => address) internal validators;\\n\\n function getValidatorsPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next)\\n {\\n return validators.page(start, pageSize);\\n }\\n\\n function _enableValidator(address validator, bytes calldata data) internal {\\n validators.add(validator);\\n IValidator(validator).enable(data);\\n emit EnabledValidator(validator);\\n }\\n\\n function enableValidator(address validator, bytes calldata data) external onlySelf {\\n _enableValidator(validator, data);\\n }\\n\\n function disableValidator(address prevValidator, address validator) external onlySelf {\\n validators.remove(prevValidator, validator);\\n emit DisabledValidator(validator);\\n }\\n\\n function isValidatorEnabled(address validator) public view returns (bool) {\\n return validators.contains(validator);\\n }\\n\\n function _setupValidators() internal {\\n validators.setup();\\n }\\n}\\n\",\"keccak256\":\"0xdfb71e2a6b9b534736896a23bc3a65fb04bcdeae9e83f19e11dc079d373ee53c\",\"license\":\"MIT\"},\"contracts/handler/DefaultCallbackHandler.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@account-abstraction/contracts/samples/callback/TokenCallbackHandler.sol\\\";\\n\\ncontract DefaultCallbackHandler is TokenCallbackHandler {}\\n\",\"keccak256\":\"0xad0bb5fa65107b2fce1afc65a930abb014f70f030e9f2687fee546fad3752571\",\"license\":\"MIT\"},\"contracts/interfaces/IHook.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"./Metadata.sol\\\";\\n\\nenum HookType {\\n Pre,\\n Post,\\n Both\\n}\\n\\ninterface IHook is Metadata {\\n function hookType() external view returns (HookType);\\n\\n function install(bytes memory data) external;\\n\\n function uninstall() external;\\n\\n function beforeTransaction(address to, uint256 value, bytes memory data) external;\\n\\n function afterTransaction(address to, uint256 value, bytes memory data) external;\\n}\\n\",\"keccak256\":\"0x6f0292861e99287d58b56eb8fa521245ab59e7930572b1b9a1de973df55c9c21\",\"license\":\"MIT\"},\"contracts/interfaces/IRecoveror.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"./Metadata.sol\\\";\\n\\ninterface IRecoveror is Metadata {\\n function recover(bytes calldata proof, address validator, bytes calldata data) external;\\n\\n function bind(bytes calldata data) external;\\n}\\n\",\"keccak256\":\"0x5bfcb195f7a4d7fbae6395dfdd715ea52fa619ab8e9460de976de8d90532da96\",\"license\":\"MIT\"},\"contracts/interfaces/IValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"./Metadata.sol\\\";\\n\\ninterface IValidator is Metadata {\\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\\n external\\n payable\\n returns (uint256 validationData);\\n\\n function validCaller(address caller, bytes calldata data) external view returns (bool);\\n\\n function enable(bytes calldata data) external payable;\\n}\\n\",\"keccak256\":\"0x7c6a9305295ecdee128a434cc87514250605c3a3159ecd2dd3ee56dc9ce6f862\",\"license\":\"MIT\"},\"contracts/interfaces/Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface Metadata is IERC165 {\\n function NAME() external view returns (string memory);\\n function VERSION() external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xcbcd27a057fef9d4c42f0e229575bd8fb28a8baad9440869bb30fcaefccc0729\",\"license\":\"MIT\"},\"contracts/libraries/LinkedAddressList.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nlibrary LinkedAddressList {\\n address internal constant SENTINEL = address(0x1);\\n uint160 internal constant SENTINEL_UINT = 1;\\n\\n function page(mapping(address => address) storage target, address start, uint256 pageSize)\\n internal\\n view\\n returns (address[] memory array, address next)\\n {\\n array = new address[](pageSize);\\n\\n uint256 count;\\n address current = target[start];\\n while (current != address(0x0) && current != SENTINEL && count < pageSize) {\\n array[count] = current;\\n current = target[current];\\n count++;\\n }\\n next = current;\\n assembly {\\n mstore(array, count)\\n }\\n }\\n\\n function contains(mapping(address => address) storage target, address item) internal view returns (bool) {\\n return SENTINEL != item && target[item] != address(0);\\n }\\n\\n function setup(mapping(address => address) storage target) internal {\\n target[SENTINEL] = SENTINEL;\\n }\\n\\n function add(mapping(address => address) storage target, address item) internal {\\n require(item != address(0) && item != SENTINEL, \\\"item can't be zero or sentinel\\\");\\n require(target[item] == address(0), \\\"item already added\\\");\\n target[item] = target[SENTINEL];\\n target[SENTINEL] = item;\\n }\\n\\n function remove(mapping(address => address) storage target, address prevItem, address item) internal {\\n require(item != address(0) && item != SENTINEL, \\\"item can't be zero or sentinel\\\");\\n require(target[prevItem] == item, \\\"item and preitem mismatch\\\");\\n target[prevItem] = target[item];\\n delete target[item];\\n }\\n}\\n\",\"keccak256\":\"0x2f607268d95122609486eeb04b6475294cceebedca09e89a48f9d1c81362ce30\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051612feb380380612feb83398101604081905261002f916100b0565b6001600160a01b03811660a052604051829061004a9061008b565b6001600160a01b039091168152602001604051809103906000f080158015610076573d6000803e3d6000fd5b506001600160a01b0316608052506100ea9050565b6123e880610c0383390190565b6001600160a01b03811681146100ad57600080fd5b50565b600080604083850312156100c357600080fd5b82516100ce81610098565b60208401519092506100df81610098565b809150509250929050565b60805160a051610ada6101296000396000818160cf01528181610147015261025b015260008181605d01528181610126015261023a0152610ada6000f3fe60806040523480156200001157600080fd5b5060043610620000525760003560e01c806311464fbe146200005757806340d513b8146200009b5780639765771514620000b2578063c80916d414620000c9575b600080fd5b6200007f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6200007f620000ac366004620003c7565b620000f1565b6200007f620000c3366004620003c7565b62000208565b6200007f7f000000000000000000000000000000000000000000000000000000000000000081565b60008062000103878787878762000208565b90506001600160a01b0381163b80156200012057509050620001ff565b8360001b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008a8a8a8a604051602401620001809594939291906200046b565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663d561e48960e01b17905251620001cb906200036a565b620001d892919062000590565b8190604051809103906000f5905080158015620001f9573d6000803e3d6000fd5b50925050505b95945050505050565b6000620003208260001b6040518060200162000224906200036a565b6020820181038252601f19601f820116604052507f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008a8a8a8a604051602401620002949594939291906200046b565b60408051601f19818403018152918152602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663d561e48960e01b1790529051620002e49392910162000590565b60408051601f1981840301815290829052620003049291602001620005d5565b604051602081830303815290604052805190602001206200032a565b9695505050505050565b60006200033983833062000340565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6104c5806200060983390190565b60008083601f8401126200038b57600080fd5b50813567ffffffffffffffff811115620003a457600080fd5b6020830191508360208260051b8501011115620003c057600080fd5b9250929050565b600080600080600060608688031215620003e057600080fd5b853567ffffffffffffffff80821115620003f957600080fd5b6200040789838a0162000378565b909750955060208801359150808211156200042157600080fd5b50620004308882890162000378565b96999598509660400135949350505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03868116825260606020808401829052908301869052600091879160808501845b89811015620004c2578435848116808214620004ae57600080fd5b835250938201939082019060010162000493565b5085810360408701528681528181019350600587901b8101820192508760005b888110156200055957828503601f190186528135368b9003601e190181126200050a57600080fd5b8a01848101903567ffffffffffffffff8111156200052757600080fd5b8036038213156200053757600080fd5b6200054487828462000442565b978601979650505090830190600101620004e2565b50929b9a5050505050505050505050565b60005b83811015620005875781810151838201526020016200056d565b50506000910152565b6001600160a01b03831681526040602082015260008251806040840152620005c08160608501602087016200056a565b601f01601f1916919091016060019392505050565b60008351620005e98184602088016200056a565b835190830190620005ff8183602088016200056a565b0194935050505056fe60806040526040516104c53803806104c5833981016040819052610022916102de565b61002e82826000610035565b50506103fb565b61003e83610061565b60008251118061004b5750805b1561005c5761005a83836100a1565b505b505050565b61006a816100cd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100c6838360405180606001604052806027815260200161049e60279139610180565b9392505050565b6001600160a01b0381163b61013f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080856001600160a01b03168560405161019d91906103ac565b600060405180830381855af49150503d80600081146101d8576040519150601f19603f3d011682016040523d82523d6000602084013e6101dd565b606091505b5090925090506101ef868383876101f9565b9695505050505050565b60608315610268578251600003610261576001600160a01b0385163b6102615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610136565b5081610272565b610272838361027a565b949350505050565b81511561028a5781518083602001fd5b8060405162461bcd60e51b815260040161013691906103c8565b634e487b7160e01b600052604160045260246000fd5b60005b838110156102d55781810151838201526020016102bd565b50506000910152565b600080604083850312156102f157600080fd5b82516001600160a01b038116811461030857600080fd5b60208401519092506001600160401b038082111561032557600080fd5b818501915085601f83011261033957600080fd5b81518181111561034b5761034b6102a4565b604051601f8201601f19908116603f01168101908382118183101715610373576103736102a4565b8160405282815288602084870101111561038c57600080fd5b61039d8360208301602088016102ba565b80955050505050509250929050565b600082516103be8184602087016102ba565b9190910192915050565b60208152600082518060208401526103e78160408501602087016102ba565b601f01601f19169190910160400192915050565b6095806104096000396000f3fe608060405236601057600e6013565b005b600e5b601f601b6021565b6065565b565b600060607f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156083573d6000f35b3d6000fdfea164736f6c6343000813000a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000813000a60a06040523480156200001157600080fd5b50604051620023e8380380620023e8833981016040819052620000349162000113565b6001600160a01b0381166080526200004b62000052565b5062000145565b600054610100900460ff1615620000bf5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161462000111576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6000602082840312156200012657600080fd5b81516001600160a01b03811681146200013e57600080fd5b9392505050565b60805161224f62000199600039600081816103d801528181610567015281816106fc0152818161079c0152818161091001528181610c0c01528181610d6501528181610e0501526113d2015261224f6000f3fe6080604052600436106101805760003560e01c80639229e120116100d6578063cf777df91161007f578063d561e48911610059578063d561e489146104a6578063f08a0323146104c6578063fa849015146104e657610180565b8063cf777df914610451578063d087d28814610471578063d2b0e7791461048657610180565b8063b61d27f6116100b0578063b61d27f6146103fc578063bb6aa2b41461041c578063c399ec881461043c57610180565b80639229e12014610389578063ad05234a146103a9578063b0d691fe146103c957610180565b80635a438970116101385780636e691f2f116101125780636e691f2f146102f157806375f2516714610311578063856dfd991461034157610180565b80635a438970146102835780635faac46b146102a35780636dd3bf74146102d157610180565b806347e1da2a1161016957806347e1da2a1461023b5780634a58db191461025b5780634d44560d1461026357610180565b80633a871cdd146101e65780633d6767f814610219575b34801561018c57600080fd5b507f6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d48054806101b757005b36600080373360601b365260008060143601600080855af190503d6000803e806101e0573d6000fd5b503d6000f35b3480156101f257600080fd5b50610206610201366004611bc7565b610506565b6040519081526020015b60405180910390f35b34801561022557600080fd5b50610239610234366004611c72565b61052c565b005b34801561024757600080fd5b50610239610256366004611d0c565b61055c565b6102396106fa565b34801561026f57600080fd5b5061023961027e366004611da6565b61077a565b34801561028f57600080fd5b5061023961029e366004611c72565b61081b565b3480156102af57600080fd5b506102c36102be366004611da6565b6108e9565b604051610210929190611dd2565b3480156102dd57600080fd5b506102396102ec366004611e2f565b610905565b3480156102fd57600080fd5b5061023961030c366004611e8b565b610995565b34801561031d57600080fd5b5061033161032c366004611ed6565b610b6c565b6040519015158152602001610210565b34801561034d57600080fd5b507f6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d4545b6040516001600160a01b039091168152602001610210565b34801561039557600080fd5b506102396103a4366004611ef3565b610b7f565b3480156103b557600080fd5b506102c36103c4366004611da6565b610bec565b3480156103d557600080fd5b507f0000000000000000000000000000000000000000000000000000000000000000610371565b34801561040857600080fd5b50610239610417366004611e2f565b610c01565b34801561042857600080fd5b50610239610437366004611c72565b610c8b565b34801561044857600080fd5b50610206610d45565b34801561045d57600080fd5b5061033161046c366004611ed6565b610dd1565b34801561047d57600080fd5b50610206610dde565b34801561049257600080fd5b506102396104a1366004611ef3565b610e34565b3480156104b257600080fd5b506102396104c1366004611f2c565b610e99565b3480156104d257600080fd5b506102396104e1366004611ed6565b6110cb565b3480156104f257600080fd5b50610239610501366004611c72565b61115a565b60006105106113c7565b61051a8484611441565b905061052582611507565b9392505050565b33301461054c5760405163d97d09c160e01b815260040160405180910390fd5b610557838383611554565b505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105a55760405163cb10477360e01b815260040160405180910390fd5b84811415806105be575082158015906105be5750828114155b156105dc5760405163150072e360e11b815260040160405180910390fd5b60008390036106885760005b858110156106825761067a87878381811061060557610605611faf565b905060200201602081019061061a9190611ed6565b600085858581811061062e5761062e611faf565b90506020028101906106409190611fc5565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506115f992505050565b6001016105e8565b506106f2565b60005b858110156106f0576106e88787838181106106a8576106a8611faf565b90506020020160208101906106bd9190611ed6565b8686848181106106cf576106cf611faf565b9050602002013585858581811061062e5761062e611faf565b60010161068b565b505b505050505050565b7f000000000000000000000000000000000000000000000000000000000000000060405163b760faf960e01b81523060048201526001600160a01b03919091169063b760faf99034906024016000604051808303818588803b15801561075f57600080fd5b505af1158015610773573d6000803e3d6000fd5b5050505050565b33301461079a5760405163d97d09c160e01b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000060405163040b850f60e31b81526001600160a01b03848116600483015260248201849052919091169063205c287890604401600060405180830381600087803b15801561080757600080fd5b505af11580156106f2573d6000803e3d6000fd5b33301461083b5760405163d97d09c160e01b815260040160405180910390fd5b610846600484611799565b604051633cbcc2b960e21b81526001600160a01b0384169063f2f30ae490610874908590859060040161200c565b600060405180830381600087803b15801561088e57600080fd5b505af11580156108a2573d6000803e3d6000fd5b50506040516001600160a01b03861681527fcc87bd27eafb647c2f20f074fcdd0fe8d9c2171b9876dacd94c4a62149d4fe03925060200190505b60405180910390a1505050565b606060006108f9600385856118b9565b915091505b9250929050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461094e5760405163cb10477360e01b815260040160405180910390fd5b61098f848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506119b392505050565b50505050565b3330146109b55760405163d97d09c160e01b815260040160405180910390fd5b806000816001600160a01b031663e445e7dd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109f6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1a9190612051565b6002811115610a2b57610a2b61203b565b03610a4157610a3c60018584611a23565b610adf565b6001816001600160a01b031663e445e7dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa59190612051565b6002811115610ab657610ab661203b565b03610ac757610a3c60028484611a23565b610ad360018584611a23565b610adf60028484611a23565b806001600160a01b0316630d638f306040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610b1a57600080fd5b505af1158015610b2e573d6000803e3d6000fd5b50506040516001600160a01b03851692507fa20b2dba0769450542a688d94941808255eb735da2fa53df12ff98fc529ffd4e9150600090a250505050565b6000610b79600383611b42565b92915050565b333014610b9f5760405163d97d09c160e01b815260040160405180910390fd5b610bab60038383611a23565b6040516001600160a01b03821681527fae2356b2cb822c142448e45b195255df334895b014113d50bb822c311cddc855906020015b60405180910390a15050565b606060006108f9600485856118b9565b905090565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610c4a5760405163cb10477360e01b815260040160405180910390fd5b61098f848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506115f992505050565b610c9433610dd1565b610cb85760405163a841d6f560e01b81523360048201526024015b60405180910390fd5b610cc183610b6c565b610ce95760405163304106bf60e11b81526001600160a01b0384166004820152602401610caf565b60405163064acaab60e11b81526001600160a01b03841690630c95955690610d17908590859060040161200c565b600060405180830381600087803b158015610d3157600080fd5b505af11580156106f0573d6000803e3d6000fd5b6040516370a0823160e01b81523060048201526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906024015b602060405180830381865afa158015610dad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfc9190612072565b6000610b79600483611b42565b604051631aab3f0d60e11b8152306004820152600060248201819052906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906335567e1a90604401610d90565b333014610e545760405163d97d09c160e01b815260040160405180910390fd5b610e6060048383611a23565b6040516001600160a01b03821681527f779fb1c42fad72db3b3d13498dce770027f44544e8a1a5a9e06e530db8cd689290602001610be0565b600054610100900460ff1615808015610eb95750600054600160ff909116105b80610ed35750303b158015610ed3575060005460ff166001145b610f455760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610caf565b6000805460ff191660011790558015610f68576000805461ff0019166101001790555b838214610f885760405163150072e360e11b815260040160405180910390fd5b610f9186611b7c565b610fd46001600081905260036020527fa15bc60c955c405d20d9149c709e2460f1c2d9a497496a7f46004d1772c3054c80546001600160a01b0319169091179055565b6110176001600081905260046020527fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe0580546001600160a01b0319169091179055565b60005b8481101561107d5761107586868381811061103757611037611faf565b905060200201602081019061104c9190611ed6565b85858481811061105e5761105e611faf565b90506020028101906110709190611fc5565b611554565b60010161101a565b5080156106f2576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b3330146110eb5760405163d97d09c160e01b815260040160405180910390fd5b7f6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d45461111682611b7c565b816001600160a01b0316816001600160a01b03167f06be9a1bea257286cf2afa8205ed494ca9d6a4b41aa58d04238deebada20fb0c60405160405180910390a35050565b33301461117a5760405163d97d09c160e01b815260040160405180910390fd5b6040516301ffc9a760e01b81526329c791d960e01b600482015283906001600160a01b038216906301ffc9a790602401602060405180830381865afa1580156111c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111eb919061208b565b61120857604051639c9d882360e01b815260040160405180910390fd5b6000816001600160a01b031663e445e7dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611248573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126c9190612051565b600281111561127d5761127d61203b565b036112925761128d600185611799565b61132d565b6001816001600160a01b031663e445e7dd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f69190612051565b60028111156113075761130761203b565b036113175761128d600285611799565b611322600185611799565b61132d600285611799565b6040516313861fb560e01b81526001600160a01b038216906313861fb59061135b908690869060040161200c565b600060405180830381600087803b15801561137557600080fd5b505af1158015611389573d6000803e3d6000fd5b50506040516001600160a01b03871692507fe9fdf38cc72369bf1f90f6adc9835796c285cba93070412e0e48413e63c5b9089150600090a250505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461143f5760405162461bcd60e51b815260206004820152601c60248201527f6163636f756e743a206e6f742066726f6d20456e747279506f696e74000000006044820152606401610caf565b565b60008080611453610140860186611fc5565b81019061146091906120c3565b9150915061146d82610b6c565b61147c57600192505050610b79565b6001600160a01b03821663971604c66114986020880188611ed6565b86846040518463ffffffff1660e01b81526004016114b8939291906121d7565b6020604051808303816000875af11580156114d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114fb9190612072565b95945050505050565b50565b801561150457604051600090339060001990849084818181858888f193505050503d8060008114610773576040519150601f19603f3d011682016040523d82523d6000602084013e610773565b61155f600384611799565b60405163064acaab60e11b81526001600160a01b03841690630c9595569061158d908590859060040161200c565b600060405180830381600087803b1580156115a757600080fd5b505af11580156115bb573d6000803e3d6000fd5b50506040516001600160a01b03861681527f702ed4645b59645b8a8b7dd88e069cb684a1170094eca847038827e03c1107a4925060200190506108dc565b600160008190526020527fcc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792f546001600160a01b03165b60016001600160a01b03821611156116c357604051632b668a3760e21b81526001600160a01b0382169063ad9a28dc90611671908790879087906004016121d7565b600060405180830381600087803b15801561168b57600080fd5b505af115801561169f573d6000803e3d6000fd5b505050506001600160a01b039081166000908152600160205260409020541661162f565b6116ce8484846119b3565b50600160005260026020527fe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e0546001600160a01b03165b60016001600160a01b038216111561098f57604051632b668a3760e21b81526001600160a01b0382169063ad9a28dc90611747908790879087906004016121d7565b600060405180830381600087803b15801561176157600080fd5b505af1158015611775573d6000803e3d6000fd5b505050506001600160a01b0390811660009081526002602052604090205416611705565b6001600160a01b038116158015906117bb57506001600160a01b038116600114155b6118075760405162461bcd60e51b815260206004820152601e60248201527f6974656d2063616e2774206265207a65726f206f722073656e74696e656c00006044820152606401610caf565b6001600160a01b03818116600090815260208490526040902054161561186f5760405162461bcd60e51b815260206004820152601260248201527f6974656d20616c726561647920616464656400000000000000000000000000006044820152606401610caf565b60016000818152602093909352604080842080546001600160a01b039485168087529286208054959091166001600160a01b03199586161790559190935280549091169091179055565b606060008267ffffffffffffffff8111156118d6576118d66120ad565b6040519080825280602002602001820160405280156118ff578160200160208202803683370190505b506001600160a01b0380861660009081526020889052604081205492945091165b6001600160a01b0381161580159061194257506001600160a01b038116600114155b801561194d57508482105b156119a4578084838151811061196557611965611faf565b6001600160a01b03928316602091820292909201810191909152918116600090815291889052604090912054168161199c816121ff565b925050611920565b90835291959194509092505050565b600080846001600160a01b031684846040516119cf9190612226565b60006040518083038185875af1925050503d8060008114611a0c576040519150601f19603f3d011682016040523d82523d6000602084013e611a11565b606091505b50915091508161077357805160208201fd5b6001600160a01b03811615801590611a4557506001600160a01b038116600114155b611a915760405162461bcd60e51b815260206004820152601e60248201527f6974656d2063616e2774206265207a65726f206f722073656e74696e656c00006044820152606401610caf565b6001600160a01b03828116600090815260208590526040902054811690821614611afd5760405162461bcd60e51b815260206004820152601960248201527f6974656d20616e64207072656974656d206d69736d61746368000000000000006044820152606401610caf565b6001600160a01b0390811660008181526020949094526040808520805494841686529085208054949093166001600160a01b0319948516179092559092528154169055565b600060016001600160a01b038316148015906105255750506001600160a01b03908116600090815260209290925260409091205416151590565b6001600160a01b038116611ba3576040516303988b8160e61b815260040160405180910390fd5b7f6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d455565b600080600060608486031215611bdc57600080fd5b833567ffffffffffffffff811115611bf357600080fd5b84016101608187031215611c0657600080fd5b95602085013595506040909401359392505050565b6001600160a01b038116811461150457600080fd5b60008083601f840112611c4257600080fd5b50813567ffffffffffffffff811115611c5a57600080fd5b6020830191508360208285010111156108fe57600080fd5b600080600060408486031215611c8757600080fd5b8335611c9281611c1b565b9250602084013567ffffffffffffffff811115611cae57600080fd5b611cba86828701611c30565b9497909650939450505050565b60008083601f840112611cd957600080fd5b50813567ffffffffffffffff811115611cf157600080fd5b6020830191508360208260051b85010111156108fe57600080fd5b60008060008060008060608789031215611d2557600080fd5b863567ffffffffffffffff80821115611d3d57600080fd5b611d498a838b01611cc7565b90985096506020890135915080821115611d6257600080fd5b611d6e8a838b01611cc7565b90965094506040890135915080821115611d8757600080fd5b50611d9489828a01611cc7565b979a9699509497509295939492505050565b60008060408385031215611db957600080fd5b8235611dc481611c1b565b946020939093013593505050565b604080825283519082018190526000906020906060840190828701845b82811015611e145781516001600160a01b031684529284019290840190600101611def565b5050506001600160a01b039490941692019190915250919050565b60008060008060608587031215611e4557600080fd5b8435611e5081611c1b565b935060208501359250604085013567ffffffffffffffff811115611e7357600080fd5b611e7f87828801611c30565b95989497509550505050565b600080600060608486031215611ea057600080fd5b8335611eab81611c1b565b92506020840135611ebb81611c1b565b91506040840135611ecb81611c1b565b809150509250925092565b600060208284031215611ee857600080fd5b813561052581611c1b565b60008060408385031215611f0657600080fd5b8235611f1181611c1b565b91506020830135611f2181611c1b565b809150509250929050565b600080600080600060608688031215611f4457600080fd5b8535611f4f81611c1b565b9450602086013567ffffffffffffffff80821115611f6c57600080fd5b611f7889838a01611cc7565b90965094506040880135915080821115611f9157600080fd5b50611f9e88828901611cc7565b969995985093965092949392505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112611fdc57600080fd5b83018035915067ffffffffffffffff821115611ff757600080fd5b6020019150368190038213156108fe57600080fd5b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b634e487b7160e01b600052602160045260246000fd5b60006020828403121561206357600080fd5b81516003811061052557600080fd5b60006020828403121561208457600080fd5b5051919050565b60006020828403121561209d57600080fd5b8151801515811461052557600080fd5b634e487b7160e01b600052604160045260246000fd5b600080604083850312156120d657600080fd5b82356120e181611c1b565b9150602083013567ffffffffffffffff808211156120fe57600080fd5b818501915085601f83011261211257600080fd5b813581811115612124576121246120ad565b604051601f8201601f19908116603f0116810190838211818310171561214c5761214c6120ad565b8160405282815288602084870101111561216557600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156121a257818101518382015260200161218a565b50506000910152565b600081518084526121c3816020860160208601612187565b601f01601f19169290920160200192915050565b6001600160a01b03841681528260208201526060604082015260006114fb60608301846121ab565b60006001820161221f57634e487b7160e01b600052601160045260246000fd5b5060010190565b60008251612238818460208701612187565b919091019291505056fea164736f6c6343000813000a", + "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620000525760003560e01c806311464fbe146200005757806340d513b8146200009b5780639765771514620000b2578063c80916d414620000c9575b600080fd5b6200007f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6200007f620000ac366004620003c7565b620000f1565b6200007f620000c3366004620003c7565b62000208565b6200007f7f000000000000000000000000000000000000000000000000000000000000000081565b60008062000103878787878762000208565b90506001600160a01b0381163b80156200012057509050620001ff565b8360001b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008a8a8a8a604051602401620001809594939291906200046b565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663d561e48960e01b17905251620001cb906200036a565b620001d892919062000590565b8190604051809103906000f5905080158015620001f9573d6000803e3d6000fd5b50925050505b95945050505050565b6000620003208260001b6040518060200162000224906200036a565b6020820181038252601f19601f820116604052507f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000008a8a8a8a604051602401620002949594939291906200046b565b60408051601f19818403018152918152602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663d561e48960e01b1790529051620002e49392910162000590565b60408051601f1981840301815290829052620003049291602001620005d5565b604051602081830303815290604052805190602001206200032a565b9695505050505050565b60006200033983833062000340565b9392505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b6104c5806200060983390190565b60008083601f8401126200038b57600080fd5b50813567ffffffffffffffff811115620003a457600080fd5b6020830191508360208260051b8501011115620003c057600080fd5b9250929050565b600080600080600060608688031215620003e057600080fd5b853567ffffffffffffffff80821115620003f957600080fd5b6200040789838a0162000378565b909750955060208801359150808211156200042157600080fd5b50620004308882890162000378565b96999598509660400135949350505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03868116825260606020808401829052908301869052600091879160808501845b89811015620004c2578435848116808214620004ae57600080fd5b835250938201939082019060010162000493565b5085810360408701528681528181019350600587901b8101820192508760005b888110156200055957828503601f190186528135368b9003601e190181126200050a57600080fd5b8a01848101903567ffffffffffffffff8111156200052757600080fd5b8036038213156200053757600080fd5b6200054487828462000442565b978601979650505090830190600101620004e2565b50929b9a5050505050505050505050565b60005b83811015620005875781810151838201526020016200056d565b50506000910152565b6001600160a01b03831681526040602082015260008251806040840152620005c08160608501602087016200056a565b601f01601f1916919091016060019392505050565b60008351620005e98184602088016200056a565b835190830190620005ff8183602088016200056a565b0194935050505056fe60806040526040516104c53803806104c5833981016040819052610022916102de565b61002e82826000610035565b50506103fb565b61003e83610061565b60008251118061004b5750805b1561005c5761005a83836100a1565b505b505050565b61006a816100cd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606100c6838360405180606001604052806027815260200161049e60279139610180565b9392505050565b6001600160a01b0381163b61013f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080856001600160a01b03168560405161019d91906103ac565b600060405180830381855af49150503d80600081146101d8576040519150601f19603f3d011682016040523d82523d6000602084013e6101dd565b606091505b5090925090506101ef868383876101f9565b9695505050505050565b60608315610268578251600003610261576001600160a01b0385163b6102615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610136565b5081610272565b610272838361027a565b949350505050565b81511561028a5781518083602001fd5b8060405162461bcd60e51b815260040161013691906103c8565b634e487b7160e01b600052604160045260246000fd5b60005b838110156102d55781810151838201526020016102bd565b50506000910152565b600080604083850312156102f157600080fd5b82516001600160a01b038116811461030857600080fd5b60208401519092506001600160401b038082111561032557600080fd5b818501915085601f83011261033957600080fd5b81518181111561034b5761034b6102a4565b604051601f8201601f19908116603f01168101908382118183101715610373576103736102a4565b8160405282815288602084870101111561038c57600080fd5b61039d8360208301602088016102ba565b80955050505050509250929050565b600082516103be8184602087016102ba565b9190910192915050565b60208152600082518060208401526103e78160408501602087016102ba565b601f01601f19169190910160400192915050565b6095806104096000396000f3fe608060405236601057600e6013565b005b600e5b601f601b6021565b6065565b565b600060607f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5473ffffffffffffffffffffffffffffffffffffffff1690565b905090565b3660008037600080366000845af43d6000803e8080156083573d6000f35b3d6000fdfea164736f6c6343000813000a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000813000a", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/sepolia/WebauthnValidator.json b/deployments/sepolia/WebauthnValidator.json new file mode 100644 index 0000000..13a7491 --- /dev/null +++ b/deployments/sepolia/WebauthnValidator.json @@ -0,0 +1,253 @@ +{ + "address": "0x2E9bB461FD23135E0462656cCC996fA6084af079", + "abi": [ + { + "inputs": [ + { + "internalType": "contract ISecp256r1", + "name": "_impl", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "oldPk", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "newPk", + "type": "bytes" + } + ], + "name": "PkChanged", + "type": "event" + }, + { + "inputs": [], + "name": "NAME", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "enable", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "impl", + "outputs": [ + { + "internalType": "contract ISecp256r1", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "pks", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "validCaller", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "name": "validateSignature", + "outputs": [ + { + "internalType": "uint256", + "name": "validationData", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x37bcaf212f36a3c75e4ba6df02ae8078066f4524ec27a3456d5e0b9b4c84bc7d", + "receipt": { + "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C", + "from": "0x962F35D2249B069B38BbE169B2A449f823b8Bf79", + "contractAddress": null, + "transactionIndex": 63, + "gasUsed": "861240", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcae8eb3fc1f48131c614df12557bce3d3339e664898dae3dd06bda928258f2ef", + "transactionHash": "0x37bcaf212f36a3c75e4ba6df02ae8078066f4524ec27a3456d5e0b9b4c84bc7d", + "logs": [], + "blockNumber": 4462126, + "cumulativeGasUsed": "7156498", + "status": 1, + "byzantium": true + }, + "args": [ + "0x7F805c1078EDF7b23c025Fa0dD024c2Fb1E86417" + ], + "numDeployments": 1, + "solcInputHash": "23f21117f22f82b6c8f285345928df93", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ISecp256r1\",\"name\":\"_impl\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"oldPk\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"newPk\",\"type\":\"bytes\"}],\"name\":\"PkChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"NAME\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VERSION\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"enable\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"impl\",\"outputs\":[{\"internalType\":\"contract ISecp256r1\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"pks\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"validCaller\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"validateSignature\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"validationData\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"supportsInterface(bytes4)\":{\"details\":\"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/validators/p256/WebauthnValidator.sol\":\"WebauthnValidator\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":800},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/common/Contants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nlibrary Contants {\\n address internal constant SENTINEL = address(0x1);\\n\\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\\n}\\n\",\"keccak256\":\"0x4def4c34ea7d1925f182376cda97a69c536491aa43ebadaaf710b58173f5f76b\",\"license\":\"MIT\"},\"contracts/interfaces/IValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"./Metadata.sol\\\";\\n\\ninterface IValidator is Metadata {\\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\\n external\\n payable\\n returns (uint256 validationData);\\n\\n function validCaller(address caller, bytes calldata data) external view returns (bool);\\n\\n function enable(bytes calldata data) external payable;\\n}\\n\",\"keccak256\":\"0x7c6a9305295ecdee128a434cc87514250605c3a3159ecd2dd3ee56dc9ce6f862\",\"license\":\"MIT\"},\"contracts/interfaces/Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"@openzeppelin/contracts/utils/introspection/IERC165.sol\\\";\\n\\ninterface Metadata is IERC165 {\\n function NAME() external view returns (string memory);\\n function VERSION() external view returns (string memory);\\n}\\n\",\"keccak256\":\"0xcbcd27a057fef9d4c42f0e229575bd8fb28a8baad9440869bb30fcaefccc0729\",\"license\":\"MIT\"},\"contracts/validators/BaseValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../interfaces/IValidator.sol\\\";\\n\\nabstract contract BaseValidator is IValidator {\\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\\n return interfaceId == type(IValidator).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0x6bc845d709ba4b8925de3dd209016868ca59f6ede3c52c76d1f12a5783a04579\",\"license\":\"MIT\"},\"contracts/validators/p256/Base64.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nlibrary Base64 {\\n /**\\n * @dev Base64 Encoding/Decoding Table\\n */\\n string internal constant _TABLE = \\\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\\\";\\n\\n /**\\n * @dev Converts a `bytes` to its Bytes64 `string` representation.\\n */\\n function encode(bytes memory data) internal pure returns (string memory) {\\n /**\\n * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence\\n * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol\\n */\\n if (data.length == 0) return \\\"\\\";\\n\\n // Loads the table into memory\\n string memory table = _TABLE;\\n\\n // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter\\n // and split into 4 numbers of 6 bits.\\n // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up\\n // - `data.length + 2` -> Round up\\n // - `/ 3` -> Number of 3-bytes chunks\\n // - `4 *` -> 4 characters for each chunk\\n uint256 newlength = data.length * 8 / 6;\\n if (data.length % 6 > 0) {\\n newlength++;\\n }\\n string memory result = new string(newlength);\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Prepare the lookup table (skip the first \\\"length\\\" byte)\\n let tablePtr := add(table, 1)\\n\\n // Prepare result pointer, jump over length\\n let resultPtr := add(result, 32)\\n // let targetLength := add(resultPtr, newlength)\\n\\n // Run over the input, 3 bytes at a time\\n for {\\n let dataPtr := data\\n let endPtr := add(data, mload(data))\\n } lt(dataPtr, endPtr) {} {\\n // Advance 3 bytes\\n dataPtr := add(dataPtr, 3)\\n let input := mload(dataPtr)\\n\\n // To write each character, shift the 3 bytes (18 bits) chunk\\n // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)\\n // and apply logical AND with 0x3F which is the number of\\n // the previous character in the ASCII table prior to the Base64 Table\\n // The result is then added to the table to get the character to write,\\n // and finally write it in the result pointer but with a left shift\\n // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits\\n mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))\\n resultPtr := add(resultPtr, 1)\\n\\n mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))\\n resultPtr := add(resultPtr, 1)\\n\\n mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))\\n resultPtr := add(resultPtr, 1)\\n\\n mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))\\n resultPtr := add(resultPtr, 1)\\n }\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x2aa241e8e13cdb63bc886b6a5ab0d464af440e7019d15abf0dc0a67bd3fe7def\",\"license\":\"MIT\"},\"contracts/validators/p256/ISecp256r1.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\ninterface ISecp256r1 {\\n function validateSignature(bytes32 message, bytes calldata signature, bytes calldata publicKey)\\n external\\n view\\n returns (bool);\\n}\\n\",\"keccak256\":\"0x2c27d09b504eebfad02daf6a774b8df8bf29c51077f288bf6dd5464b4a18d177\",\"license\":\"MIT\"},\"contracts/validators/p256/WebauthnValidator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.19;\\n\\nimport \\\"../../common/Contants.sol\\\";\\nimport \\\"../BaseValidator.sol\\\";\\nimport \\\"./ISecp256r1.sol\\\";\\nimport \\\"./Base64.sol\\\";\\n\\ncontract WebauthnValidator is BaseValidator {\\n string public constant override NAME = \\\"Webauthn Validator\\\";\\n string public constant override VERSION = \\\"0.0.1\\\";\\n\\n event PkChanged(address indexed account, bytes oldPk, bytes newPk);\\n\\n ISecp256r1 public immutable impl;\\n mapping(address => bytes) public pks;\\n\\n constructor(ISecp256r1 _impl) {\\n impl = _impl;\\n }\\n\\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\\n external\\n payable\\n override\\n returns (uint256 validationData)\\n {\\n bytes memory sig;\\n bytes32 messageHash;\\n {\\n (\\n bytes memory realSig,\\n bytes memory authenticatorData,\\n string memory clientDataJSONPre,\\n string memory clientDataJSONPost\\n ) = abi.decode(signature, (bytes, bytes, string, string));\\n\\n string memory clientDataJSON =\\n string.concat(clientDataJSONPre, Base64.encode(bytes.concat(userOpHash)), clientDataJSONPost);\\n bytes32 clientDataHash = sha256(bytes(clientDataJSON));\\n messageHash = sha256(bytes.concat(authenticatorData, clientDataHash));\\n sig = realSig;\\n }\\n\\n if (impl.validateSignature(messageHash, sig, pks[account])) {\\n return 0;\\n }\\n return Contants.SIG_VALIDATION_FAILED;\\n }\\n\\n function enable(bytes calldata data) external payable override {\\n bytes memory old = pks[msg.sender];\\n pks[msg.sender] = data;\\n emit PkChanged(msg.sender, old, data);\\n }\\n\\n function validCaller(address, bytes calldata) external pure override returns (bool) {\\n revert(\\\"not implemented\\\");\\n }\\n}\\n\",\"keccak256\":\"0x1cdc3912fa26ad708d1878990068fb69ec95f2ec7955b501e6d6935bbd4e127c\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60a060405234801561001057600080fd5b50604051610f27380380610f2783398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610e9561009260003960008181610105015261053c0152610e956000f3fe60806040526004361061007b5760003560e01c8063971604c61161004e578063971604c61461016c5780639ea9bd591461018d578063a3f4df7e146101ad578063ffa1ad74146101f657600080fd5b806301ffc9a7146100805780630c959556146100de5780638abf6077146100f35780639356375c1461013f575b600080fd5b34801561008c57600080fd5b506100c961009b366004610765565b7fffffffff000000000000000000000000000000000000000000000000000000001663052a2cc960e01b1490565b60405190151581526020015b60405180910390f35b6100f16100ec3660046107f7565b61023f565b005b3480156100ff57600080fd5b506101277f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100d5565b34801561014b57600080fd5b5061015f61015a366004610855565b610342565b6040516100d591906108c0565b61017f61017a3660046108d3565b6103dc565b6040519081526020016100d5565b34801561019957600080fd5b506100c96101a836600461092d565b6105da565b3480156101b957600080fd5b5061015f6040518060400160405280601281526020017f576562617574686e2056616c696461746f72000000000000000000000000000081525081565b34801561020257600080fd5b5061015f6040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b336000908152602081905260408120805461025990610980565b80601f016020809104026020016040519081016040528092919081815260200182805461028590610980565b80156102d25780601f106102a7576101008083540402835291602001916102d2565b820191906000526020600020905b8154815290600101906020018083116102b557829003601f168201915b50503360009081526020819052604090209394506102f7925085915086905083610a1f565b50336001600160a01b03167f49a125229beaa1b288f0f807170a37c7a131925683b0250b113db84181bfb06682858560405161033593929190610ae0565b60405180910390a2505050565b6000602081905290815260409020805461035b90610980565b80601f016020809104026020016040519081016040528092919081815260200182805461038790610980565b80156103d45780601f106103a9576101008083540402835291602001916103d4565b820191906000526020600020905b8154815290600101906020018083116103b757829003601f168201915b505050505081565b6000606081808080806103f1888a018a610bb3565b93509350935093506000826104268c60405160200161041291815260200190565b604051602081830303815290604052610629565b8360405160200161043993929190610c60565b6040516020818303038152906040529050600060028260405161045c9190610ca3565b602060405180830381855afa158015610479573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061049c9190610cbf565b9050600285826040516020016104b3929190610cd8565b60408051601f19818403018152908290526104cd91610ca3565b602060405180830381855afa1580156104ea573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061050d9190610cbf565b6001600160a01b038e8116600090815260208190526040908190209051630ae7e17f60e41b8152989a509198507f0000000000000000000000000000000000000000000000000000000000000000169663ae7e17f0965061057a9550889450899350909150600401610cfa565b602060405180830381865afa158015610597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bb9190610d9c565b156105cb576000925050506105d2565b6001925050505b949350505050565b60405162461bcd60e51b815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640160405180910390fd5b6060815160000361064857505060408051602081019091526000815290565b6000604051806060016040528060408152602001610e4960409139905060006006845160086106779190610dd4565b6106819190610e07565b90506000600685516106939190610e1b565b11156106a757806106a381610e2f565b9150505b60008167ffffffffffffffff8111156106c2576106c26109ba565b6040519080825280601f01601f1916602001820160405280156106ec576020820181803683370190505b509050600183016020820186875188015b80821015610758576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506106fd565b5092979650505050505050565b60006020828403121561077757600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107a757600080fd5b9392505050565b60008083601f8401126107c057600080fd5b50813567ffffffffffffffff8111156107d857600080fd5b6020830191508360208285010111156107f057600080fd5b9250929050565b6000806020838503121561080a57600080fd5b823567ffffffffffffffff81111561082157600080fd5b61082d858286016107ae565b90969095509350505050565b80356001600160a01b038116811461085057600080fd5b919050565b60006020828403121561086757600080fd5b6107a782610839565b60005b8381101561088b578181015183820152602001610873565b50506000910152565b600081518084526108ac816020860160208601610870565b601f01601f19169290920160200192915050565b6020815260006107a76020830184610894565b600080600080606085870312156108e957600080fd5b6108f285610839565b935060208501359250604085013567ffffffffffffffff81111561091557600080fd5b610921878288016107ae565b95989497509550505050565b60008060006040848603121561094257600080fd5b61094b84610839565b9250602084013567ffffffffffffffff81111561096757600080fd5b610973868287016107ae565b9497909650939450505050565b600181811c9082168061099457607f821691505b6020821081036109b457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f821115610a1a57600081815260208120601f850160051c810160208610156109f75750805b601f850160051c820191505b81811015610a1657828155600101610a03565b5050505b505050565b67ffffffffffffffff831115610a3757610a376109ba565b610a4b83610a458354610980565b836109d0565b6000601f841160018114610a7f5760008515610a675750838201355b600019600387901b1c1916600186901b178355610ad9565b600083815260209020601f19861690835b82811015610ab05786850135825560209485019460019092019101610a90565b5086821015610acd5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b604081526000610af36040830186610894565b8281036020840152838152838560208301376000602085830101526020601f19601f860116820101915050949350505050565b600082601f830112610b3757600080fd5b813567ffffffffffffffff80821115610b5257610b526109ba565b604051601f8301601f19908116603f01168101908282118183101715610b7a57610b7a6109ba565b81604052838152866020858801011115610b9357600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610bc957600080fd5b843567ffffffffffffffff80821115610be157600080fd5b610bed88838901610b26565b95506020870135915080821115610c0357600080fd5b610c0f88838901610b26565b94506040870135915080821115610c2557600080fd5b610c3188838901610b26565b93506060870135915080821115610c4757600080fd5b50610c5487828801610b26565b91505092959194509250565b60008451610c72818460208901610870565b845190830190610c86818360208901610870565b8451910190610c99818360208801610870565b0195945050505050565b60008251610cb5818460208701610870565b9190910192915050565b600060208284031215610cd157600080fd5b5051919050565b60008351610cea818460208801610870565b9190910191825250602001919050565b83815260006020606081840152610d146060840186610894565b838103604085015260008554610d2981610980565b80845260018281168015610d445760018114610d5e57610d8c565b60ff1984168688015282151560051b860187019450610d8c565b896000528660002060005b84811015610d845781548882018a0152908301908801610d69565b870188019550505b50929a9950505050505050505050565b600060208284031215610dae57600080fd5b815180151581146107a757600080fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610deb57610deb610dbe565b92915050565b634e487b7160e01b600052601260045260246000fd5b600082610e1657610e16610df1565b500490565b600082610e2a57610e2a610df1565b500690565b600060018201610e4157610e41610dbe565b506001019056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5fa164736f6c6343000813000a", + "deployedBytecode": "0x60806040526004361061007b5760003560e01c8063971604c61161004e578063971604c61461016c5780639ea9bd591461018d578063a3f4df7e146101ad578063ffa1ad74146101f657600080fd5b806301ffc9a7146100805780630c959556146100de5780638abf6077146100f35780639356375c1461013f575b600080fd5b34801561008c57600080fd5b506100c961009b366004610765565b7fffffffff000000000000000000000000000000000000000000000000000000001663052a2cc960e01b1490565b60405190151581526020015b60405180910390f35b6100f16100ec3660046107f7565b61023f565b005b3480156100ff57600080fd5b506101277f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100d5565b34801561014b57600080fd5b5061015f61015a366004610855565b610342565b6040516100d591906108c0565b61017f61017a3660046108d3565b6103dc565b6040519081526020016100d5565b34801561019957600080fd5b506100c96101a836600461092d565b6105da565b3480156101b957600080fd5b5061015f6040518060400160405280601281526020017f576562617574686e2056616c696461746f72000000000000000000000000000081525081565b34801561020257600080fd5b5061015f6040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b336000908152602081905260408120805461025990610980565b80601f016020809104026020016040519081016040528092919081815260200182805461028590610980565b80156102d25780601f106102a7576101008083540402835291602001916102d2565b820191906000526020600020905b8154815290600101906020018083116102b557829003601f168201915b50503360009081526020819052604090209394506102f7925085915086905083610a1f565b50336001600160a01b03167f49a125229beaa1b288f0f807170a37c7a131925683b0250b113db84181bfb06682858560405161033593929190610ae0565b60405180910390a2505050565b6000602081905290815260409020805461035b90610980565b80601f016020809104026020016040519081016040528092919081815260200182805461038790610980565b80156103d45780601f106103a9576101008083540402835291602001916103d4565b820191906000526020600020905b8154815290600101906020018083116103b757829003601f168201915b505050505081565b6000606081808080806103f1888a018a610bb3565b93509350935093506000826104268c60405160200161041291815260200190565b604051602081830303815290604052610629565b8360405160200161043993929190610c60565b6040516020818303038152906040529050600060028260405161045c9190610ca3565b602060405180830381855afa158015610479573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061049c9190610cbf565b9050600285826040516020016104b3929190610cd8565b60408051601f19818403018152908290526104cd91610ca3565b602060405180830381855afa1580156104ea573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061050d9190610cbf565b6001600160a01b038e8116600090815260208190526040908190209051630ae7e17f60e41b8152989a509198507f0000000000000000000000000000000000000000000000000000000000000000169663ae7e17f0965061057a9550889450899350909150600401610cfa565b602060405180830381865afa158015610597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105bb9190610d9c565b156105cb576000925050506105d2565b6001925050505b949350505050565b60405162461bcd60e51b815260206004820152600f60248201527f6e6f7420696d706c656d656e7465640000000000000000000000000000000000604482015260009060640160405180910390fd5b6060815160000361064857505060408051602081019091526000815290565b6000604051806060016040528060408152602001610e4960409139905060006006845160086106779190610dd4565b6106819190610e07565b90506000600685516106939190610e1b565b11156106a757806106a381610e2f565b9150505b60008167ffffffffffffffff8111156106c2576106c26109ba565b6040519080825280601f01601f1916602001820160405280156106ec576020820181803683370190505b509050600183016020820186875188015b80821015610758576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506106fd565b5092979650505050505050565b60006020828403121561077757600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146107a757600080fd5b9392505050565b60008083601f8401126107c057600080fd5b50813567ffffffffffffffff8111156107d857600080fd5b6020830191508360208285010111156107f057600080fd5b9250929050565b6000806020838503121561080a57600080fd5b823567ffffffffffffffff81111561082157600080fd5b61082d858286016107ae565b90969095509350505050565b80356001600160a01b038116811461085057600080fd5b919050565b60006020828403121561086757600080fd5b6107a782610839565b60005b8381101561088b578181015183820152602001610873565b50506000910152565b600081518084526108ac816020860160208601610870565b601f01601f19169290920160200192915050565b6020815260006107a76020830184610894565b600080600080606085870312156108e957600080fd5b6108f285610839565b935060208501359250604085013567ffffffffffffffff81111561091557600080fd5b610921878288016107ae565b95989497509550505050565b60008060006040848603121561094257600080fd5b61094b84610839565b9250602084013567ffffffffffffffff81111561096757600080fd5b610973868287016107ae565b9497909650939450505050565b600181811c9082168061099457607f821691505b6020821081036109b457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f821115610a1a57600081815260208120601f850160051c810160208610156109f75750805b601f850160051c820191505b81811015610a1657828155600101610a03565b5050505b505050565b67ffffffffffffffff831115610a3757610a376109ba565b610a4b83610a458354610980565b836109d0565b6000601f841160018114610a7f5760008515610a675750838201355b600019600387901b1c1916600186901b178355610ad9565b600083815260209020601f19861690835b82811015610ab05786850135825560209485019460019092019101610a90565b5086821015610acd5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b604081526000610af36040830186610894565b8281036020840152838152838560208301376000602085830101526020601f19601f860116820101915050949350505050565b600082601f830112610b3757600080fd5b813567ffffffffffffffff80821115610b5257610b526109ba565b604051601f8301601f19908116603f01168101908282118183101715610b7a57610b7a6109ba565b81604052838152866020858801011115610b9357600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610bc957600080fd5b843567ffffffffffffffff80821115610be157600080fd5b610bed88838901610b26565b95506020870135915080821115610c0357600080fd5b610c0f88838901610b26565b94506040870135915080821115610c2557600080fd5b610c3188838901610b26565b93506060870135915080821115610c4757600080fd5b50610c5487828801610b26565b91505092959194509250565b60008451610c72818460208901610870565b845190830190610c86818360208901610870565b8451910190610c99818360208801610870565b0195945050505050565b60008251610cb5818460208701610870565b9190910192915050565b600060208284031215610cd157600080fd5b5051919050565b60008351610cea818460208801610870565b9190910191825250602001919050565b83815260006020606081840152610d146060840186610894565b838103604085015260008554610d2981610980565b80845260018281168015610d445760018114610d5e57610d8c565b60ff1984168688015282151560051b860187019450610d8c565b896000528660002060005b84811015610d845781548882018a0152908301908801610d69565b870188019550505b50929a9950505050505050505050565b600060208284031215610dae57600080fd5b815180151581146107a757600080fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610deb57610deb610dbe565b92915050565b634e487b7160e01b600052601260045260246000fd5b600082610e1657610e16610df1565b500490565b600082610e2a57610e2a610df1565b500690565b600060018201610e4157610e41610dbe565b506001019056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5fa164736f6c6343000813000a", + "devdoc": { + "kind": "dev", + "methods": { + "supportsInterface(bytes4)": { + "details": "Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 10742, + "contract": "contracts/validators/p256/WebauthnValidator.sol:WebauthnValidator", + "label": "pks", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bytes_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_bytes_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bytes)", + "numberOfBytes": "32", + "value": "t_bytes_storage" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/solcInputs/23f21117f22f82b6c8f285345928df93.json b/deployments/sepolia/solcInputs/23f21117f22f82b6c8f285345928df93.json new file mode 100644 index 0000000..fc2c7c1 --- /dev/null +++ b/deployments/sepolia/solcInputs/23f21117f22f82b6c8f285345928df93.json @@ -0,0 +1,232 @@ +{ + "language": "Solidity", + "sources": { + "@account-abstraction/contracts/core/BaseAccount.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-empty-blocks */\n\nimport \"../interfaces/IAccount.sol\";\nimport \"../interfaces/IEntryPoint.sol\";\nimport \"./Helpers.sol\";\n\n/**\n * Basic account implementation.\n * this contract provides the basic logic for implementing the IAccount interface - validateUserOp\n * specific account implementation should inherit it and provide the account-specific logic\n */\nabstract contract BaseAccount is IAccount {\n using UserOperationLib for UserOperation;\n\n //return value in case of signature failure, with no time-range.\n // equivalent to _packValidationData(true,0,0);\n uint256 constant internal SIG_VALIDATION_FAILED = 1;\n\n /**\n * Return the account nonce.\n * This method returns the next sequential nonce.\n * For a nonce of a specific key, use `entrypoint.getNonce(account, key)`\n */\n function getNonce() public view virtual returns (uint256) {\n return entryPoint().getNonce(address(this), 0);\n }\n\n /**\n * return the entryPoint used by this account.\n * subclass should return the current entryPoint used by this account.\n */\n function entryPoint() public view virtual returns (IEntryPoint);\n\n /**\n * Validate user's signature and nonce.\n * subclass doesn't need to override this method. Instead, it should override the specific internal validation methods.\n */\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external override virtual returns (uint256 validationData) {\n _requireFromEntryPoint();\n validationData = _validateSignature(userOp, userOpHash);\n _validateNonce(userOp.nonce);\n _payPrefund(missingAccountFunds);\n }\n\n /**\n * ensure the request comes from the known entrypoint.\n */\n function _requireFromEntryPoint() internal virtual view {\n require(msg.sender == address(entryPoint()), \"account: not from EntryPoint\");\n }\n\n /**\n * validate the signature is valid for this message.\n * @param userOp validate the userOp.signature field\n * @param userOpHash convenient field: the hash of the request, to check the signature against\n * (also hashes the entrypoint and chain id)\n * @return validationData signature and time-range of this operation\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * If the account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)\n internal virtual returns (uint256 validationData);\n\n /**\n * Validate the nonce of the UserOperation.\n * This method may validate the nonce requirement of this account.\n * e.g.\n * To limit the nonce to use sequenced UserOps only (no \"out of order\" UserOps):\n * `require(nonce < type(uint64).max)`\n * For a hypothetical account that *requires* the nonce to be out-of-order:\n * `require(nonce & type(uint64).max == 0)`\n *\n * The actual nonce uniqueness is managed by the EntryPoint, and thus no other\n * action is needed by the account itself.\n *\n * @param nonce to validate\n *\n * solhint-disable-next-line no-empty-blocks\n */\n function _validateNonce(uint256 nonce) internal view virtual {\n }\n\n /**\n * sends to the entrypoint (msg.sender) the missing funds for this transaction.\n * subclass MAY override this method for better funds management\n * (e.g. send to the entryPoint more than the minimum required, so that in future transactions\n * it will not be required to send again)\n * @param missingAccountFunds the minimum value this method should send the entrypoint.\n * this value MAY be zero, in case there is enough deposit, or the userOp has a paymaster.\n */\n function _payPrefund(uint256 missingAccountFunds) internal virtual {\n if (missingAccountFunds != 0) {\n (bool success,) = payable(msg.sender).call{value : missingAccountFunds, gas : type(uint256).max}(\"\");\n (success);\n //ignore failure (its EntryPoint's job to verify, not account.)\n }\n }\n}\n" + }, + "@account-abstraction/contracts/core/BasePaymaster.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n\n/* solhint-disable reason-string */\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"../interfaces/IPaymaster.sol\";\nimport \"../interfaces/IEntryPoint.sol\";\nimport \"./Helpers.sol\";\n\n/**\n * Helper class for creating a paymaster.\n * provides helper methods for staking.\n * validates that the postOp is called only by the entryPoint\n */\nabstract contract BasePaymaster is IPaymaster, Ownable {\n\n IEntryPoint immutable public entryPoint;\n\n constructor(IEntryPoint _entryPoint) {\n entryPoint = _entryPoint;\n }\n\n /// @inheritdoc IPaymaster\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n external override returns (bytes memory context, uint256 validationData) {\n _requireFromEntryPoint();\n return _validatePaymasterUserOp(userOp, userOpHash, maxCost);\n }\n\n function _validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n internal virtual returns (bytes memory context, uint256 validationData);\n\n /// @inheritdoc IPaymaster\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external override {\n _requireFromEntryPoint();\n _postOp(mode, context, actualGasCost);\n }\n\n /**\n * post-operation handler.\n * (verified to be called only through the entryPoint)\n * @dev if subclass returns a non-empty context from validatePaymasterUserOp, it must also implement this method.\n * @param mode enum with the following options:\n * opSucceeded - user operation succeeded.\n * opReverted - user op reverted. still has to pay for gas.\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\n * Now this is the 2nd call, after user's op was deliberately reverted.\n * @param context - the context value returned by validatePaymasterUserOp\n * @param actualGasCost - actual gas used so far (without this postOp call).\n */\n function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) internal virtual {\n\n (mode,context,actualGasCost); // unused params\n // subclass must override this method if validatePaymasterUserOp returns a context\n revert(\"must override\");\n }\n\n /**\n * add a deposit for this paymaster, used for paying for transaction fees\n */\n function deposit() public payable {\n entryPoint.depositTo{value : msg.value}(address(this));\n }\n\n /**\n * withdraw value from the deposit\n * @param withdrawAddress target to send to\n * @param amount to withdraw\n */\n function withdrawTo(address payable withdrawAddress, uint256 amount) public onlyOwner {\n entryPoint.withdrawTo(withdrawAddress, amount);\n }\n /**\n * add stake for this paymaster.\n * This method can also carry eth value to add to the current stake.\n * @param unstakeDelaySec - the unstake delay for this paymaster. Can only be increased.\n */\n function addStake(uint32 unstakeDelaySec) external payable onlyOwner {\n entryPoint.addStake{value : msg.value}(unstakeDelaySec);\n }\n\n /**\n * return current paymaster's deposit on the entryPoint.\n */\n function getDeposit() public view returns (uint256) {\n return entryPoint.balanceOf(address(this));\n }\n\n /**\n * unlock the stake, in order to withdraw it.\n * The paymaster can't serve requests once unlocked, until it calls addStake again\n */\n function unlockStake() external onlyOwner {\n entryPoint.unlockStake();\n }\n\n /**\n * withdraw the entire paymaster's stake.\n * stake must be unlocked first (and then wait for the unstakeDelay to be over)\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external onlyOwner {\n entryPoint.withdrawStake(withdrawAddress);\n }\n\n /// validate the call is made from a valid entrypoint\n function _requireFromEntryPoint() internal virtual {\n require(msg.sender == address(entryPoint), \"Sender not EntryPoint\");\n }\n}\n" + }, + "@account-abstraction/contracts/core/EntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n\nimport \"../interfaces/IAccount.sol\";\nimport \"../interfaces/IPaymaster.sol\";\nimport \"../interfaces/IEntryPoint.sol\";\n\nimport \"../utils/Exec.sol\";\nimport \"./StakeManager.sol\";\nimport \"./SenderCreator.sol\";\nimport \"./Helpers.sol\";\nimport \"./NonceManager.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\ncontract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {\n\n using UserOperationLib for UserOperation;\n\n SenderCreator private immutable senderCreator = new SenderCreator();\n\n // internal value used during simulation: need to query aggregator.\n address private constant SIMULATE_FIND_AGGREGATOR = address(1);\n\n // marker for inner call revert on out of gas\n bytes32 private constant INNER_OUT_OF_GAS = hex'deaddead';\n\n uint256 private constant REVERT_REASON_MAX_LEN = 2048;\n\n /**\n * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value\n * in case of signature failure, instead of revert.\n */\n uint256 public constant SIG_VALIDATION_FAILED = 1;\n\n /**\n * compensate the caller's beneficiary address with the collected fees of all UserOperations.\n * @param beneficiary the address to receive the fees\n * @param amount amount to transfer.\n */\n function _compensate(address payable beneficiary, uint256 amount) internal {\n require(beneficiary != address(0), \"AA90 invalid beneficiary\");\n (bool success,) = beneficiary.call{value : amount}(\"\");\n require(success, \"AA91 failed send to beneficiary\");\n }\n\n /**\n * execute a user op\n * @param opIndex index into the opInfo array\n * @param userOp the userOp to execute\n * @param opInfo the opInfo filled by validatePrepayment for this userOp.\n * @return collected the total amount this userOp paid.\n */\n function _executeUserOp(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory opInfo) private returns (uint256 collected) {\n uint256 preGas = gasleft();\n bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset);\n\n try this.innerHandleOp(userOp.callData, opInfo, context) returns (uint256 _actualGasCost) {\n collected = _actualGasCost;\n } catch {\n bytes32 innerRevertCode;\n assembly {\n returndatacopy(0, 0, 32)\n innerRevertCode := mload(0)\n }\n // handleOps was called with gas limit too low. abort entire bundle.\n if (innerRevertCode == INNER_OUT_OF_GAS) {\n //report paymaster, since if it is not deliberately caused by the bundler,\n // it must be a revert caused by paymaster.\n revert FailedOp(opIndex, \"AA95 out of gas\");\n }\n\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n collected = _handlePostOp(opIndex, IPaymaster.PostOpMode.postOpReverted, opInfo, context, actualGas);\n }\n }\n\n /**\n * Execute a batch of UserOperations.\n * no signature aggregator is used.\n * if any account requires an aggregator (that is, it returned an aggregator when\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\n * @param ops the operations to execute\n * @param beneficiary the address to receive the fees\n */\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) public nonReentrant {\n\n uint256 opslen = ops.length;\n UserOpInfo[] memory opInfos = new UserOpInfo[](opslen);\n\n unchecked {\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[i];\n (uint256 validationData, uint256 pmValidationData) = _validatePrepayment(i, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, pmValidationData, address(0));\n }\n\n uint256 collected = 0;\n emit BeforeExecution();\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(i, ops[i], opInfos[i]);\n }\n\n _compensate(beneficiary, collected);\n } //unchecked\n }\n\n /**\n * Execute a batch of UserOperation with Aggregators\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\n * @param beneficiary the address to receive the fees\n */\n function handleAggregatedOps(\n UserOpsPerAggregator[] calldata opsPerAggregator,\n address payable beneficiary\n ) public nonReentrant {\n\n uint256 opasLen = opsPerAggregator.length;\n uint256 totalOps = 0;\n for (uint256 i = 0; i < opasLen; i++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[i];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n //address(1) is special marker of \"signature error\"\n require(address(aggregator) != address(1), \"AA96 invalid aggregator\");\n\n if (address(aggregator) != address(0)) {\n // solhint-disable-next-line no-empty-blocks\n try aggregator.validateSignatures(ops, opa.signature) {}\n catch {\n revert SignatureValidationFailed(address(aggregator));\n }\n }\n\n totalOps += ops.length;\n }\n\n UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps);\n\n emit BeforeExecution();\n\n uint256 opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n UserOperation[] calldata ops = opa.userOps;\n IAggregator aggregator = opa.aggregator;\n\n uint256 opslen = ops.length;\n for (uint256 i = 0; i < opslen; i++) {\n UserOpInfo memory opInfo = opInfos[opIndex];\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(opIndex, ops[i], opInfo);\n _validateAccountAndPaymasterValidationData(i, validationData, paymasterValidationData, address(aggregator));\n opIndex++;\n }\n }\n\n uint256 collected = 0;\n opIndex = 0;\n for (uint256 a = 0; a < opasLen; a++) {\n UserOpsPerAggregator calldata opa = opsPerAggregator[a];\n emit SignatureAggregatorChanged(address(opa.aggregator));\n UserOperation[] calldata ops = opa.userOps;\n uint256 opslen = ops.length;\n\n for (uint256 i = 0; i < opslen; i++) {\n collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]);\n opIndex++;\n }\n }\n emit SignatureAggregatorChanged(address(0));\n\n _compensate(beneficiary, collected);\n }\n\n /// @inheritdoc IEntryPoint\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external override {\n\n UserOpInfo memory opInfo;\n _simulationOnlyValidations(op);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, op, opInfo);\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n\n numberMarker();\n uint256 paid = _executeUserOp(0, op, opInfo);\n numberMarker();\n bool targetSuccess;\n bytes memory targetResult;\n if (target != address(0)) {\n (targetSuccess, targetResult) = target.call(targetCallData);\n }\n revert ExecutionResult(opInfo.preOpGas, paid, data.validAfter, data.validUntil, targetSuccess, targetResult);\n }\n\n\n // A memory copy of UserOp static fields only.\n // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.\n struct MemoryUserOp {\n address sender;\n uint256 nonce;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n address paymaster;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n }\n\n struct UserOpInfo {\n MemoryUserOp mUserOp;\n bytes32 userOpHash;\n uint256 prefund;\n uint256 contextOffset;\n uint256 preOpGas;\n }\n\n /**\n * inner function to handle a UserOperation.\n * Must be declared \"external\" to open a call context, but it can only be called by handleOps.\n */\n function innerHandleOp(bytes memory callData, UserOpInfo memory opInfo, bytes calldata context) external returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n require(msg.sender == address(this), \"AA92 internal call only\");\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n\n uint callGasLimit = mUserOp.callGasLimit;\n unchecked {\n // handleOps was called with gas limit too low. abort entire bundle.\n if (gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000) {\n assembly {\n mstore(0, INNER_OUT_OF_GAS)\n revert(0, 32)\n }\n }\n }\n\n IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded;\n if (callData.length > 0) {\n bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);\n if (!success) {\n bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);\n if (result.length > 0) {\n emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);\n }\n mode = IPaymaster.PostOpMode.opReverted;\n }\n }\n\n unchecked {\n uint256 actualGas = preGas - gasleft() + opInfo.preOpGas;\n //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp)\n return _handlePostOp(0, mode, opInfo, context, actualGas);\n }\n }\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) public view returns (bytes32) {\n return keccak256(abi.encode(userOp.hash(), address(this), block.chainid));\n }\n\n /**\n * copy general fields from userOp into the memory opInfo structure.\n */\n function _copyUserOpToMemory(UserOperation calldata userOp, MemoryUserOp memory mUserOp) internal pure {\n mUserOp.sender = userOp.sender;\n mUserOp.nonce = userOp.nonce;\n mUserOp.callGasLimit = userOp.callGasLimit;\n mUserOp.verificationGasLimit = userOp.verificationGasLimit;\n mUserOp.preVerificationGas = userOp.preVerificationGas;\n mUserOp.maxFeePerGas = userOp.maxFeePerGas;\n mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes calldata paymasterAndData = userOp.paymasterAndData;\n if (paymasterAndData.length > 0) {\n require(paymasterAndData.length >= 20, \"AA93 invalid paymasterAndData\");\n mUserOp.paymaster = address(bytes20(paymasterAndData[: 20]));\n } else {\n mUserOp.paymaster = address(0);\n }\n }\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external {\n UserOpInfo memory outOpInfo;\n\n _simulationOnlyValidations(userOp);\n (uint256 validationData, uint256 paymasterValidationData) = _validatePrepayment(0, userOp, outOpInfo);\n StakeInfo memory paymasterInfo = _getStakeInfo(outOpInfo.mUserOp.paymaster);\n StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender);\n StakeInfo memory factoryInfo;\n {\n bytes calldata initCode = userOp.initCode;\n address factory = initCode.length >= 20 ? address(bytes20(initCode[0 : 20])) : address(0);\n factoryInfo = _getStakeInfo(factory);\n }\n\n ValidationData memory data = _intersectTimeRange(validationData, paymasterValidationData);\n address aggregator = data.aggregator;\n bool sigFailed = aggregator == address(1);\n ReturnInfo memory returnInfo = ReturnInfo(outOpInfo.preOpGas, outOpInfo.prefund,\n sigFailed, data.validAfter, data.validUntil, getMemoryBytesFromOffset(outOpInfo.contextOffset));\n\n if (aggregator != address(0) && aggregator != address(1)) {\n AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo(aggregator, _getStakeInfo(aggregator));\n revert ValidationResultWithAggregation(returnInfo, senderInfo, factoryInfo, paymasterInfo, aggregatorInfo);\n }\n revert ValidationResult(returnInfo, senderInfo, factoryInfo, paymasterInfo);\n\n }\n\n function _getRequiredPrefund(MemoryUserOp memory mUserOp) internal pure returns (uint256 requiredPrefund) {\n unchecked {\n //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call.\n // our security model might call postOp eventually twice\n uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1;\n uint256 requiredGas = mUserOp.callGasLimit + mUserOp.verificationGasLimit * mul + mUserOp.preVerificationGas;\n\n requiredPrefund = requiredGas * mUserOp.maxFeePerGas;\n }\n }\n\n // create the sender's contract if needed.\n function _createSenderIfNeeded(uint256 opIndex, UserOpInfo memory opInfo, bytes calldata initCode) internal {\n if (initCode.length != 0) {\n address sender = opInfo.mUserOp.sender;\n if (sender.code.length != 0) revert FailedOp(opIndex, \"AA10 sender already constructed\");\n address sender1 = senderCreator.createSender{gas : opInfo.mUserOp.verificationGasLimit}(initCode);\n if (sender1 == address(0)) revert FailedOp(opIndex, \"AA13 initCode failed or OOG\");\n if (sender1 != sender) revert FailedOp(opIndex, \"AA14 initCode must return sender\");\n if (sender1.code.length == 0) revert FailedOp(opIndex, \"AA15 initCode must create sender\");\n address factory = address(bytes20(initCode[0 : 20]));\n emit AccountDeployed(opInfo.userOpHash, sender, factory, opInfo.mUserOp.paymaster);\n }\n }\n\n /**\n * Get counterfactual sender address.\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\n * this method always revert, and returns the address in SenderAddressResult error\n * @param initCode the constructor code to be passed into the UserOperation.\n */\n function getSenderAddress(bytes calldata initCode) public {\n address sender = senderCreator.createSender(initCode);\n revert SenderAddressResult(sender);\n }\n\n function _simulationOnlyValidations(UserOperation calldata userOp) internal view {\n // solhint-disable-next-line no-empty-blocks\n try this._validateSenderAndPaymaster(userOp.initCode, userOp.sender, userOp.paymasterAndData) {}\n catch Error(string memory revertReason) {\n if (bytes(revertReason).length != 0) {\n revert FailedOp(0, revertReason);\n }\n }\n }\n\n /**\n * Called only during simulation.\n * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution.\n */\n function _validateSenderAndPaymaster(bytes calldata initCode, address sender, bytes calldata paymasterAndData) external view {\n if (initCode.length == 0 && sender.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA20 account not deployed\");\n }\n if (paymasterAndData.length >= 20) {\n address paymaster = address(bytes20(paymasterAndData[0 : 20]));\n if (paymaster.code.length == 0) {\n // it would revert anyway. but give a meaningful message\n revert(\"AA30 paymaster not deployed\");\n }\n }\n // always revert\n revert(\"\");\n }\n\n /**\n * call account.validateUserOp.\n * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund.\n * decrement account's deposit if needed\n */\n function _validateAccountPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPrefund)\n internal returns (uint256 gasUsedByValidateAccountPrepayment, uint256 validationData) {\n unchecked {\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n address sender = mUserOp.sender;\n _createSenderIfNeeded(opIndex, opInfo, op.initCode);\n address paymaster = mUserOp.paymaster;\n numberMarker();\n uint256 missingAccountFunds = 0;\n if (paymaster == address(0)) {\n uint256 bal = balanceOf(sender);\n missingAccountFunds = bal > requiredPrefund ? 0 : requiredPrefund - bal;\n }\n try IAccount(sender).validateUserOp{gas : mUserOp.verificationGasLimit}(op, opInfo.userOpHash, missingAccountFunds)\n returns (uint256 _validationData) {\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA23 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA23 reverted (or OOG)\");\n }\n if (paymaster == address(0)) {\n DepositInfo storage senderInfo = deposits[sender];\n uint256 deposit = senderInfo.deposit;\n if (requiredPrefund > deposit) {\n revert FailedOp(opIndex, \"AA21 didn't pay prefund\");\n }\n senderInfo.deposit = uint112(deposit - requiredPrefund);\n }\n gasUsedByValidateAccountPrepayment = preGas - gasleft();\n }\n }\n\n /**\n * In case the request has a paymaster:\n * Validate paymaster has enough deposit.\n * Call paymaster.validatePaymasterUserOp.\n * Revert with proper FailedOp in case paymaster reverts.\n * Decrement paymaster's deposit\n */\n function _validatePaymasterPrepayment(uint256 opIndex, UserOperation calldata op, UserOpInfo memory opInfo, uint256 requiredPreFund, uint256 gasUsedByValidateAccountPrepayment)\n internal returns (bytes memory context, uint256 validationData) {\n unchecked {\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 verificationGasLimit = mUserOp.verificationGasLimit;\n require(verificationGasLimit > gasUsedByValidateAccountPrepayment, \"AA41 too little verificationGas\");\n uint256 gas = verificationGasLimit - gasUsedByValidateAccountPrepayment;\n\n address paymaster = mUserOp.paymaster;\n DepositInfo storage paymasterInfo = deposits[paymaster];\n uint256 deposit = paymasterInfo.deposit;\n if (deposit < requiredPreFund) {\n revert FailedOp(opIndex, \"AA31 paymaster deposit too low\");\n }\n paymasterInfo.deposit = uint112(deposit - requiredPreFund);\n try IPaymaster(paymaster).validatePaymasterUserOp{gas : gas}(op, opInfo.userOpHash, requiredPreFund) returns (bytes memory _context, uint256 _validationData){\n context = _context;\n validationData = _validationData;\n } catch Error(string memory revertReason) {\n revert FailedOp(opIndex, string.concat(\"AA33 reverted: \", revertReason));\n } catch {\n revert FailedOp(opIndex, \"AA33 reverted (or OOG)\");\n }\n }\n }\n\n /**\n * revert if either account validationData or paymaster validationData is expired\n */\n function _validateAccountAndPaymasterValidationData(uint256 opIndex, uint256 validationData, uint256 paymasterValidationData, address expectedAggregator) internal view {\n (address aggregator, bool outOfTimeRange) = _getValidationData(validationData);\n if (expectedAggregator != aggregator) {\n revert FailedOp(opIndex, \"AA24 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA22 expired or not due\");\n }\n //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address.\n // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation)\n address pmAggregator;\n (pmAggregator, outOfTimeRange) = _getValidationData(paymasterValidationData);\n if (pmAggregator != address(0)) {\n revert FailedOp(opIndex, \"AA34 signature error\");\n }\n if (outOfTimeRange) {\n revert FailedOp(opIndex, \"AA32 paymaster expired or not due\");\n }\n }\n\n function _getValidationData(uint256 validationData) internal view returns (address aggregator, bool outOfTimeRange) {\n if (validationData == 0) {\n return (address(0), false);\n }\n ValidationData memory data = _parseValidationData(validationData);\n // solhint-disable-next-line not-rely-on-time\n outOfTimeRange = block.timestamp > data.validUntil || block.timestamp < data.validAfter;\n aggregator = data.aggregator;\n }\n\n /**\n * validate account and paymaster (if defined).\n * also make sure total validation doesn't exceed verificationGasLimit\n * this method is called off-chain (simulateValidation()) and on-chain (from handleOps)\n * @param opIndex the index of this userOp into the \"opInfos\" array\n * @param userOp the userOp to validate\n */\n function _validatePrepayment(uint256 opIndex, UserOperation calldata userOp, UserOpInfo memory outOpInfo)\n private returns (uint256 validationData, uint256 paymasterValidationData) {\n\n uint256 preGas = gasleft();\n MemoryUserOp memory mUserOp = outOpInfo.mUserOp;\n _copyUserOpToMemory(userOp, mUserOp);\n outOpInfo.userOpHash = getUserOpHash(userOp);\n\n // validate all numeric values in userOp are well below 128 bit, so they can safely be added\n // and multiplied without causing overflow\n uint256 maxGasValues = mUserOp.preVerificationGas | mUserOp.verificationGasLimit | mUserOp.callGasLimit |\n userOp.maxFeePerGas | userOp.maxPriorityFeePerGas;\n require(maxGasValues <= type(uint120).max, \"AA94 gas values overflow\");\n\n uint256 gasUsedByValidateAccountPrepayment;\n (uint256 requiredPreFund) = _getRequiredPrefund(mUserOp);\n (gasUsedByValidateAccountPrepayment, validationData) = _validateAccountPrepayment(opIndex, userOp, outOpInfo, requiredPreFund);\n\n if (!_validateAndUpdateNonce(mUserOp.sender, mUserOp.nonce)) {\n revert FailedOp(opIndex, \"AA25 invalid account nonce\");\n }\n\n //a \"marker\" where account opcode validation is done and paymaster opcode validation is about to start\n // (used only by off-chain simulateValidation)\n numberMarker();\n\n bytes memory context;\n if (mUserOp.paymaster != address(0)) {\n (context, paymasterValidationData) = _validatePaymasterPrepayment(opIndex, userOp, outOpInfo, requiredPreFund, gasUsedByValidateAccountPrepayment);\n }\n unchecked {\n uint256 gasUsed = preGas - gasleft();\n\n if (userOp.verificationGasLimit < gasUsed) {\n revert FailedOp(opIndex, \"AA40 over verificationGasLimit\");\n }\n outOpInfo.prefund = requiredPreFund;\n outOpInfo.contextOffset = getOffsetOfMemoryBytes(context);\n outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;\n }\n }\n\n /**\n * process post-operation.\n * called just after the callData is executed.\n * if a paymaster is defined and its validation returned a non-empty context, its postOp is called.\n * the excess amount is refunded to the account (or paymaster - if it was used in the request)\n * @param opIndex index in the batch\n * @param mode - whether is called from innerHandleOp, or outside (postOpReverted)\n * @param opInfo userOp fields and info collected during validation\n * @param context the context returned in validatePaymasterUserOp\n * @param actualGas the gas used so far by this user operation\n */\n function _handlePostOp(uint256 opIndex, IPaymaster.PostOpMode mode, UserOpInfo memory opInfo, bytes memory context, uint256 actualGas) private returns (uint256 actualGasCost) {\n uint256 preGas = gasleft();\n unchecked {\n address refundAddress;\n MemoryUserOp memory mUserOp = opInfo.mUserOp;\n uint256 gasPrice = getUserOpGasPrice(mUserOp);\n\n address paymaster = mUserOp.paymaster;\n if (paymaster == address(0)) {\n refundAddress = mUserOp.sender;\n } else {\n refundAddress = paymaster;\n if (context.length > 0) {\n actualGasCost = actualGas * gasPrice;\n if (mode != IPaymaster.PostOpMode.postOpReverted) {\n IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost);\n } else {\n // solhint-disable-next-line no-empty-blocks\n try IPaymaster(paymaster).postOp{gas : mUserOp.verificationGasLimit}(mode, context, actualGasCost) {}\n catch Error(string memory reason) {\n revert FailedOp(opIndex, string.concat(\"AA50 postOp reverted: \", reason));\n }\n catch {\n revert FailedOp(opIndex, \"AA50 postOp revert\");\n }\n }\n }\n }\n actualGas += preGas - gasleft();\n actualGasCost = actualGas * gasPrice;\n if (opInfo.prefund < actualGasCost) {\n revert FailedOp(opIndex, \"AA51 prefund below actualGasCost\");\n }\n uint256 refund = opInfo.prefund - actualGasCost;\n _incrementDeposit(refundAddress, refund);\n bool success = mode == IPaymaster.PostOpMode.opSucceeded;\n emit UserOperationEvent(opInfo.userOpHash, mUserOp.sender, mUserOp.paymaster, mUserOp.nonce, success, actualGasCost, actualGas);\n } // unchecked\n }\n\n /**\n * the gas price this UserOp agrees to pay.\n * relayer/block builder might submit the TX with higher priorityFee, but the user should not\n */\n function getUserOpGasPrice(MemoryUserOp memory mUserOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = mUserOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n function getOffsetOfMemoryBytes(bytes memory data) internal pure returns (uint256 offset) {\n assembly {offset := data}\n }\n\n function getMemoryBytesFromOffset(uint256 offset) internal pure returns (bytes memory data) {\n assembly {data := offset}\n }\n\n //place the NUMBER opcode in the code.\n // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the\n // account and paymaster.\n function numberMarker() internal view {\n assembly {mstore(0, number())}\n }\n}\n\n" + }, + "@account-abstraction/contracts/core/Helpers.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\n/**\n * returned data from validateUserOp.\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\n * @param aggregator - address(0) - the account validated the signature by itself.\n * address(1) - the account failed to validate the signature.\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\n * @param validAfter - this UserOp is valid only after this timestamp.\n * @param validaUntil - this UserOp is valid only up to this timestamp.\n */\n struct ValidationData {\n address aggregator;\n uint48 validAfter;\n uint48 validUntil;\n }\n\n//extract sigFailed, validAfter, validUntil.\n// also convert zero validUntil to type(uint48).max\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\n address aggregator = address(uint160(validationData));\n uint48 validUntil = uint48(validationData >> 160);\n if (validUntil == 0) {\n validUntil = type(uint48).max;\n }\n uint48 validAfter = uint48(validationData >> (48 + 160));\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n// intersect account and paymaster ranges.\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\n ValidationData memory accountValidationData = _parseValidationData(validationData);\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\n address aggregator = accountValidationData.aggregator;\n if (aggregator == address(0)) {\n aggregator = pmValidationData.aggregator;\n }\n uint48 validAfter = accountValidationData.validAfter;\n uint48 validUntil = accountValidationData.validUntil;\n uint48 pmValidAfter = pmValidationData.validAfter;\n uint48 pmValidUntil = pmValidationData.validUntil;\n\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n/**\n * helper to pack the return value for validateUserOp\n * @param data - the ValidationData to pack\n */\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\n }\n\n/**\n * helper to pack the return value for validateUserOp, when not using an aggregator\n * @param sigFailed - true for signature failure, false for success\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\n * @param validAfter first timestamp this UserOperation is valid\n */\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\n }\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n assembly {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n }\n\n" + }, + "@account-abstraction/contracts/core/NonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IEntryPoint.sol\";\n\n/**\n * nonce management functionality\n */\ncontract NonceManager is INonceManager {\n\n /**\n * The next valid sequence number for a given nonce key.\n */\n mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber;\n\n function getNonce(address sender, uint192 key)\n public view override returns (uint256 nonce) {\n return nonceSequenceNumber[sender][key] | (uint256(key) << 64);\n }\n\n // allow an account to manually increment its own nonce.\n // (mainly so that during construction nonce can be made non-zero,\n // to \"absorb\" the gas cost of first nonce increment to 1st transaction (construction),\n // not to 2nd transaction)\n function incrementNonce(uint192 key) public override {\n nonceSequenceNumber[msg.sender][key]++;\n }\n\n /**\n * validate nonce uniqueness for this account.\n * called just after validateUserOp()\n */\n function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) {\n\n uint192 key = uint192(nonce >> 64);\n uint64 seq = uint64(nonce);\n return nonceSequenceNumber[sender][key]++ == seq;\n }\n\n}\n" + }, + "@account-abstraction/contracts/core/SenderCreator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/**\n * helper contract for EntryPoint, to call userOp.initCode from a \"neutral\" address,\n * which is explicitly not the entryPoint itself.\n */\ncontract SenderCreator {\n\n /**\n * call the \"initCode\" factory to create and return the sender account address\n * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata\n * @return sender the returned address of the created account, or zero address on failure.\n */\n function createSender(bytes calldata initCode) external returns (address sender) {\n address factory = address(bytes20(initCode[0 : 20]));\n bytes memory initCallData = initCode[20 :];\n bool success;\n /* solhint-disable no-inline-assembly */\n assembly {\n success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32)\n sender := mload(0)\n }\n if (!success) {\n sender = address(0);\n }\n }\n}\n" + }, + "@account-abstraction/contracts/core/StakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\nimport \"../interfaces/IStakeManager.sol\";\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable not-rely-on-time */\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by a paymaster.\n */\nabstract contract StakeManager is IStakeManager {\n\n /// maps paymaster to their deposits and stakes\n mapping(address => DepositInfo) public deposits;\n\n /// @inheritdoc IStakeManager\n function getDepositInfo(address account) public view returns (DepositInfo memory info) {\n return deposits[account];\n }\n\n // internal method to return just the stake info\n function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) {\n DepositInfo storage depositInfo = deposits[addr];\n info.stake = depositInfo.stake;\n info.unstakeDelaySec = depositInfo.unstakeDelaySec;\n }\n\n /// return the deposit (for gas payment) of the account\n function balanceOf(address account) public view returns (uint256) {\n return deposits[account].deposit;\n }\n\n receive() external payable {\n depositTo(msg.sender);\n }\n\n function _incrementDeposit(address account, uint256 amount) internal {\n DepositInfo storage info = deposits[account];\n uint256 newAmount = info.deposit + amount;\n require(newAmount <= type(uint112).max, \"deposit overflow\");\n info.deposit = uint112(newAmount);\n }\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) public payable {\n _incrementDeposit(account, msg.value);\n DepositInfo storage info = deposits[account];\n emit Deposited(account, info.deposit);\n }\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 unstakeDelaySec) public payable {\n DepositInfo storage info = deposits[msg.sender];\n require(unstakeDelaySec > 0, \"must specify unstake delay\");\n require(unstakeDelaySec >= info.unstakeDelaySec, \"cannot decrease unstake time\");\n uint256 stake = info.stake + msg.value;\n require(stake > 0, \"no stake specified\");\n require(stake <= type(uint112).max, \"stake overflow\");\n deposits[msg.sender] = DepositInfo(\n info.deposit,\n true,\n uint112(stake),\n unstakeDelaySec,\n 0\n );\n emit StakeLocked(msg.sender, stake, unstakeDelaySec);\n }\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external {\n DepositInfo storage info = deposits[msg.sender];\n require(info.unstakeDelaySec != 0, \"not staked\");\n require(info.staked, \"already unstaking\");\n uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec;\n info.withdrawTime = withdrawTime;\n info.staked = false;\n emit StakeUnlocked(msg.sender, withdrawTime);\n }\n\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external {\n DepositInfo storage info = deposits[msg.sender];\n uint256 stake = info.stake;\n require(stake > 0, \"No stake to withdraw\");\n require(info.withdrawTime > 0, \"must call unlockStake() first\");\n require(info.withdrawTime <= block.timestamp, \"Stake withdrawal is not due\");\n info.unstakeDelaySec = 0;\n info.withdrawTime = 0;\n info.stake = 0;\n emit StakeWithdrawn(msg.sender, withdrawAddress, stake);\n (bool success,) = withdrawAddress.call{value : stake}(\"\");\n require(success, \"failed to withdraw stake\");\n }\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external {\n DepositInfo storage info = deposits[msg.sender];\n require(withdrawAmount <= info.deposit, \"Withdraw amount too large\");\n info.deposit = uint112(info.deposit - withdrawAmount);\n emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount);\n (bool success,) = withdrawAddress.call{value : withdrawAmount}(\"\");\n require(success, \"failed to withdraw\");\n }\n}\n" + }, + "@account-abstraction/contracts/interfaces/IAccount.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\ninterface IAccount {\n\n /**\n * Validate user's signature and nonce\n * the entryPoint will make the call to the recipient only if this validation call returns successfully.\n * signature failure should be reported by returning SIG_VALIDATION_FAILED (1).\n * This allows making a \"simulation call\" without a valid signature\n * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure.\n *\n * @dev Must validate caller is the entryPoint.\n * Must validate the signature and nonce\n * @param userOp the operation that is about to be executed.\n * @param userOpHash hash of the user's request data. can be used as the basis for signature.\n * @param missingAccountFunds missing funds on the account's deposit in the entrypoint.\n * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call.\n * The excess is left as a deposit in the entrypoint, for future calls.\n * can be withdrawn anytime using \"entryPoint.withdrawTo()\"\n * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero.\n * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure.\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)\n external returns (uint256 validationData);\n}\n" + }, + "@account-abstraction/contracts/interfaces/IAggregator.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * Aggregated Signatures validator.\n */\ninterface IAggregator {\n\n /**\n * validate aggregated signature.\n * revert if the aggregated signature does not match the given list of operations.\n */\n function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view;\n\n /**\n * validate signature of a single userOp\n * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation\n * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps.\n * @param userOp the userOperation received from the user.\n * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps.\n * (usually empty, unless account and aggregator support some kind of \"multisig\"\n */\n function validateUserOpSignature(UserOperation calldata userOp)\n external view returns (bytes memory sigForUserOp);\n\n /**\n * aggregate multiple signatures into a single value.\n * This method is called off-chain to calculate the signature to pass with handleOps()\n * bundler MAY use optimized custom code perform this aggregation\n * @param userOps array of UserOperations to collect the signatures from.\n * @return aggregatedSignature the aggregated signature\n */\n function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature);\n}\n" + }, + "@account-abstraction/contracts/interfaces/IEntryPoint.sol": { + "content": "/**\n ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.\n ** Only one instance required on each chain.\n **/\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable avoid-low-level-calls */\n/* solhint-disable no-inline-assembly */\n/* solhint-disable reason-string */\n\nimport \"./UserOperation.sol\";\nimport \"./IStakeManager.sol\";\nimport \"./IAggregator.sol\";\nimport \"./INonceManager.sol\";\n\ninterface IEntryPoint is IStakeManager, INonceManager {\n\n /***\n * An event emitted after each successful request\n * @param userOpHash - unique identifier for the request (hash its entire content, except signature).\n * @param sender - the account that generates this request.\n * @param paymaster - if non-null, the paymaster that pays for this request.\n * @param nonce - the nonce value from the request.\n * @param success - true if the sender transaction succeeded, false if reverted.\n * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation.\n * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution).\n */\n event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);\n\n /**\n * account \"sender\" was deployed.\n * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow.\n * @param sender the account that is deployed\n * @param factory the factory used to deploy this account (in the initCode)\n * @param paymaster the paymaster used by this UserOp\n */\n event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster);\n\n /**\n * An event emitted if the UserOperation \"callData\" reverted with non-zero length\n * @param userOpHash the request unique identifier.\n * @param sender the sender of this request\n * @param nonce the nonce used in the request\n * @param revertReason - the return bytes from the (reverted) call to \"callData\".\n */\n event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason);\n\n /**\n * an event emitted by handleOps(), before starting the execution loop.\n * any event emitted before this event, is part of the validation.\n */\n event BeforeExecution();\n\n /**\n * signature aggregator used by the following UserOperationEvents within this bundle.\n */\n event SignatureAggregatorChanged(address indexed aggregator);\n\n /**\n * a custom revert error of handleOps, to identify the offending op.\n * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it.\n * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero)\n * @param reason - revert reason\n * The string starts with a unique code \"AAmn\", where \"m\" is \"1\" for factory, \"2\" for account and \"3\" for paymaster issues,\n * so a failure can be attributed to the correct entity.\n * Should be caught in off-chain handleOps simulation and not happen on-chain.\n * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts.\n */\n error FailedOp(uint256 opIndex, string reason);\n\n /**\n * error case when a signature aggregator fails to verify the aggregated signature it had created.\n */\n error SignatureValidationFailed(address aggregator);\n\n /**\n * Successful result from simulateValidation.\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n */\n error ValidationResult(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo);\n\n /**\n * Successful result from simulateValidation, if the account returns a signature aggregator\n * @param returnInfo gas and time-range returned values\n * @param senderInfo stake information about the sender\n * @param factoryInfo stake information about the factory (if any)\n * @param paymasterInfo stake information about the paymaster (if any)\n * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator)\n * bundler MUST use it to verify the signature, or reject the UserOperation\n */\n error ValidationResultWithAggregation(ReturnInfo returnInfo,\n StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo,\n AggregatorStakeInfo aggregatorInfo);\n\n /**\n * return value of getSenderAddress\n */\n error SenderAddressResult(address sender);\n\n /**\n * return value of simulateHandleOp\n */\n error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult);\n\n //UserOps handled, per aggregator\n struct UserOpsPerAggregator {\n UserOperation[] userOps;\n\n // aggregator address\n IAggregator aggregator;\n // aggregated signature\n bytes signature;\n }\n\n /**\n * Execute a batch of UserOperation.\n * no signature aggregator is used.\n * if any account requires an aggregator (that is, it returned an aggregator when\n * performing simulateValidation), then handleAggregatedOps() must be used instead.\n * @param ops the operations to execute\n * @param beneficiary the address to receive the fees\n */\n function handleOps(UserOperation[] calldata ops, address payable beneficiary) external;\n\n /**\n * Execute a batch of UserOperation with Aggregators\n * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts)\n * @param beneficiary the address to receive the fees\n */\n function handleAggregatedOps(\n UserOpsPerAggregator[] calldata opsPerAggregator,\n address payable beneficiary\n ) external;\n\n /**\n * generate a request Id - unique identifier for this request.\n * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid.\n */\n function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32);\n\n /**\n * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp.\n * @dev this method always revert. Successful result is ValidationResult error. other errors are failures.\n * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data.\n * @param userOp the user operation to validate.\n */\n function simulateValidation(UserOperation calldata userOp) external;\n\n /**\n * gas and return values during simulation\n * @param preOpGas the gas used for validation (including preValidationGas)\n * @param prefund the required prefund for this operation\n * @param sigFailed validateUserOp's (or paymaster's) signature check failed\n * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range)\n * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp)\n */\n struct ReturnInfo {\n uint256 preOpGas;\n uint256 prefund;\n bool sigFailed;\n uint48 validAfter;\n uint48 validUntil;\n bytes paymasterContext;\n }\n\n /**\n * returned aggregated signature info.\n * the aggregator returned by the account, and its current stake.\n */\n struct AggregatorStakeInfo {\n address aggregator;\n StakeInfo stakeInfo;\n }\n\n /**\n * Get counterfactual sender address.\n * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation.\n * this method always revert, and returns the address in SenderAddressResult error\n * @param initCode the constructor code to be passed into the UserOperation.\n */\n function getSenderAddress(bytes memory initCode) external;\n\n\n /**\n * simulate full execution of a UserOperation (including both validation and target execution)\n * this method will always revert with \"ExecutionResult\".\n * it performs full validation of the UserOperation, but ignores signature error.\n * an optional target address is called after the userop succeeds, and its value is returned\n * (before the entire call is reverted)\n * Note that in order to collect the the success/failure of the target call, it must be executed\n * with trace enabled to track the emitted events.\n * @param op the UserOperation to simulate\n * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult\n * are set to the return from that call.\n * @param targetCallData callData to pass to target address\n */\n function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external;\n}\n\n" + }, + "@account-abstraction/contracts/interfaces/INonceManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\ninterface INonceManager {\n\n /**\n * Return the next nonce for this sender.\n * Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop)\n * But UserOp with different keys can come with arbitrary order.\n *\n * @param sender the account address\n * @param key the high 192 bit of the nonce\n * @return nonce a full nonce to pass for next UserOp with this sender.\n */\n function getNonce(address sender, uint192 key)\n external view returns (uint256 nonce);\n\n /**\n * Manually increment the nonce of the sender.\n * This method is exposed just for completeness..\n * Account does NOT need to call it, neither during validation, nor elsewhere,\n * as the EntryPoint will update the nonce regardless.\n * Possible use-case is call it with various keys to \"initialize\" their nonces to one, so that future\n * UserOperations will not pay extra for the first transaction with a given key.\n */\n function incrementNonce(uint192 key) external;\n}\n" + }, + "@account-abstraction/contracts/interfaces/IPaymaster.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\nimport \"./UserOperation.sol\";\n\n/**\n * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations.\n * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction.\n */\ninterface IPaymaster {\n\n enum PostOpMode {\n opSucceeded, // user op succeeded\n opReverted, // user op reverted. still has to pay for gas.\n postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted.\n }\n\n /**\n * payment validation: check if paymaster agrees to pay.\n * Must verify sender is the entryPoint.\n * Revert to reject this request.\n * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted)\n * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns.\n * @param userOp the user operation\n * @param userOpHash hash of the user's request data.\n * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp)\n * @return context value to send to a postOp\n * zero length to signify postOp is not required.\n * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation\n * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure,\n * otherwise, an address of an \"authorizer\" contract.\n * <6-byte> validUntil - last timestamp this operation is valid. 0 for \"indefinite\"\n * <6-byte> validAfter - first timestamp this operation is valid\n * Note that the validation code cannot use block.timestamp (or block.number) directly.\n */\n function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost)\n external returns (bytes memory context, uint256 validationData);\n\n /**\n * post-operation handler.\n * Must verify sender is the entryPoint\n * @param mode enum with the following options:\n * opSucceeded - user operation succeeded.\n * opReverted - user op reverted. still has to pay for gas.\n * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert.\n * Now this is the 2nd call, after user's op was deliberately reverted.\n * @param context - the context value returned by validatePaymasterUserOp\n * @param actualGasCost - actual gas used so far (without this postOp call).\n */\n function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external;\n}\n" + }, + "@account-abstraction/contracts/interfaces/IStakeManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-only\npragma solidity ^0.8.12;\n\n/**\n * manage deposits and stakes.\n * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account)\n * stake is value locked for at least \"unstakeDelay\" by the staked entity.\n */\ninterface IStakeManager {\n\n event Deposited(\n address indexed account,\n uint256 totalDeposit\n );\n\n event Withdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /// Emitted when stake or unstake delay are modified\n event StakeLocked(\n address indexed account,\n uint256 totalStaked,\n uint256 unstakeDelaySec\n );\n\n /// Emitted once a stake is scheduled for withdrawal\n event StakeUnlocked(\n address indexed account,\n uint256 withdrawTime\n );\n\n event StakeWithdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /**\n * @param deposit the entity's deposit\n * @param staked true if this entity is staked.\n * @param stake actual amount of ether staked for this entity.\n * @param unstakeDelaySec minimum delay to withdraw the stake.\n * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked\n * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps)\n * and the rest fit into a 2nd cell.\n * 112 bit allows for 10^15 eth\n * 48 bit for full timestamp\n * 32 bit allows 150 years for unstake delay\n */\n struct DepositInfo {\n uint112 deposit;\n bool staked;\n uint112 stake;\n uint32 unstakeDelaySec;\n uint48 withdrawTime;\n }\n\n //API struct used by getStakeInfo and simulateValidation\n struct StakeInfo {\n uint256 stake;\n uint256 unstakeDelaySec;\n }\n\n /// @return info - full deposit information of given account\n function getDepositInfo(address account) external view returns (DepositInfo memory info);\n\n /// @return the deposit (for gas payment) of the account\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * add to the deposit of the given account\n */\n function depositTo(address account) external payable;\n\n /**\n * add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 _unstakeDelaySec) external payable;\n\n /**\n * attempt to unlock the stake.\n * the value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external;\n\n /**\n * withdraw from the (unlocked) stake.\n * must first call unlockStake and wait for the unstakeDelay to pass\n * @param withdrawAddress the address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external;\n\n /**\n * withdraw from the deposit.\n * @param withdrawAddress the address to send withdrawn value.\n * @param withdrawAmount the amount to withdraw.\n */\n function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external;\n}\n" + }, + "@account-abstraction/contracts/interfaces/UserOperation.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\nimport {calldataKeccak} from \"../core/Helpers.sol\";\n\n/**\n * User Operation struct\n * @param sender the sender account of this request.\n * @param nonce unique value the sender uses to verify it is not a replay.\n * @param initCode if set, the account contract will be created by this constructor/\n * @param callData the method call to execute on this account.\n * @param callGasLimit the gas limit passed to the callData method call.\n * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp.\n * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead.\n * @param maxFeePerGas same as EIP-1559 gas parameter.\n * @param maxPriorityFeePerGas same as EIP-1559 gas parameter.\n * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender.\n * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID.\n */\n struct UserOperation {\n\n address sender;\n uint256 nonce;\n bytes initCode;\n bytes callData;\n uint256 callGasLimit;\n uint256 verificationGasLimit;\n uint256 preVerificationGas;\n uint256 maxFeePerGas;\n uint256 maxPriorityFeePerGas;\n bytes paymasterAndData;\n bytes signature;\n }\n\n/**\n * Utility functions helpful when working with UserOperation structs.\n */\nlibrary UserOperationLib {\n\n function getSender(UserOperation calldata userOp) internal pure returns (address) {\n address data;\n //read sender from userOp, which is first userOp member (saves 800 gas...)\n assembly {data := calldataload(userOp)}\n return address(uint160(data));\n }\n\n //relayer/block builder might submit the TX with higher priorityFee, but the user should not\n // pay above what he signed for.\n function gasPrice(UserOperation calldata userOp) internal view returns (uint256) {\n unchecked {\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n if (maxFeePerGas == maxPriorityFeePerGas) {\n //legacy mode (for networks that don't support basefee opcode)\n return maxFeePerGas;\n }\n return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee);\n }\n }\n\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\n address sender = getSender(userOp);\n uint256 nonce = userOp.nonce;\n bytes32 hashInitCode = calldataKeccak(userOp.initCode);\n bytes32 hashCallData = calldataKeccak(userOp.callData);\n uint256 callGasLimit = userOp.callGasLimit;\n uint256 verificationGasLimit = userOp.verificationGasLimit;\n uint256 preVerificationGas = userOp.preVerificationGas;\n uint256 maxFeePerGas = userOp.maxFeePerGas;\n uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas;\n bytes32 hashPaymasterAndData = calldataKeccak(userOp.paymasterAndData);\n\n return abi.encode(\n sender, nonce,\n hashInitCode, hashCallData,\n callGasLimit, verificationGasLimit, preVerificationGas,\n maxFeePerGas, maxPriorityFeePerGas,\n hashPaymasterAndData\n );\n }\n\n function hash(UserOperation calldata userOp) internal pure returns (bytes32) {\n return keccak256(pack(userOp));\n }\n\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n}\n" + }, + "@account-abstraction/contracts/samples/callback/TokenCallbackHandler.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-empty-blocks */\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol\";\n\n/**\n * Token callback handler.\n * Handles supported tokens' callbacks, allowing account receiving these tokens.\n */\ncontract TokenCallbackHandler is IERC777Recipient, IERC721Receiver, IERC1155Receiver {\n function tokensReceived(\n address,\n address,\n address,\n uint256,\n bytes calldata,\n bytes calldata\n ) external pure override {\n }\n\n function onERC721Received(\n address,\n address,\n uint256,\n bytes calldata\n ) external pure override returns (bytes4) {\n return IERC721Receiver.onERC721Received.selector;\n }\n\n function onERC1155Received(\n address,\n address,\n uint256,\n uint256,\n bytes calldata\n ) external pure override returns (bytes4) {\n return IERC1155Receiver.onERC1155Received.selector;\n }\n\n function onERC1155BatchReceived(\n address,\n address,\n uint256[] calldata,\n uint256[] calldata,\n bytes calldata\n ) external pure override returns (bytes4) {\n return IERC1155Receiver.onERC1155BatchReceived.selector;\n }\n\n function supportsInterface(bytes4 interfaceId) external view virtual override returns (bool) {\n return\n interfaceId == type(IERC721Receiver).interfaceId ||\n interfaceId == type(IERC1155Receiver).interfaceId ||\n interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@account-abstraction/contracts/utils/Exec.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.5 <0.9.0;\n\n// solhint-disable no-inline-assembly\n\n/**\n * Utility functions helpful when making different kinds of contract calls in Solidity.\n */\nlibrary Exec {\n\n function call(\n address to,\n uint256 value,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function staticcall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal view returns (bool success) {\n assembly {\n success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n function delegateCall(\n address to,\n bytes memory data,\n uint256 txGas\n ) internal returns (bool success) {\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n }\n\n // get returned data from last call or calldelegate\n function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) {\n assembly {\n let len := returndatasize()\n if gt(len, maxLen) {\n len := maxLen\n }\n let ptr := mload(0x40)\n mstore(0x40, add(ptr, add(len, 0x20)))\n mstore(ptr, len)\n returndatacopy(add(ptr, 0x20), 0, len)\n returnData := ptr\n }\n }\n\n // revert with explicit byte array (probably reverted info from call)\n function revertWithData(bytes memory returnData) internal pure {\n assembly {\n revert(add(returnData, 32), mload(returnData))\n }\n }\n\n function callAndRevert(address to, bytes memory data, uint256 maxLen) internal {\n bool success = call(to,0,data,gasleft());\n if (!success) {\n revertWithData(getReturnData(maxLen));\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1967.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/IERC1967.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967Upgrade is IERC1967 {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized != type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n // On the first call to nonReentrant, _status will be _NOT_ENTERED\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n }\n\n function _nonReentrantAfter() private {\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.\n *\n * Accounts can be notified of {IERC777} tokens being sent to them by having a\n * contract implement this interface (contract holders can be their own\n * implementer) and registering it on the\n * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].\n *\n * See {IERC1820Registry} and {ERC1820Implementer}.\n */\ninterface IERC777Recipient {\n /**\n * @dev Called by an {IERC777} token contract whenever tokens are being\n * moved or created into a registered account (`to`). The type of operation\n * is conveyed by `from` being the zero address or not.\n *\n * This call occurs _after_ the token contract's state is updated, so\n * {IERC777-balanceOf}, etc., can be used to query the post-operation state.\n *\n * This function may revert to prevent the operation from being executed.\n */\n function tokensReceived(\n address operator,\n address from,\n address to,\n uint256 amount,\n bytes calldata userData,\n bytes calldata operatorData\n ) external;\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n *\n * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Create2.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.\n * `CREATE2` can be used to compute in advance the address where a smart\n * contract will be deployed, which allows for interesting new mechanisms known\n * as 'counterfactual interactions'.\n *\n * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more\n * information.\n */\nlibrary Create2 {\n /**\n * @dev Deploys a contract using `CREATE2`. The address where the contract\n * will be deployed can be known in advance via {computeAddress}.\n *\n * The bytecode for a contract can be obtained from Solidity with\n * `type(contractName).creationCode`.\n *\n * Requirements:\n *\n * - `bytecode` must not be empty.\n * - `salt` must have not been used for `bytecode` already.\n * - the factory must have a balance of at least `amount`.\n * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.\n */\n function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {\n require(address(this).balance >= amount, \"Create2: insufficient balance\");\n require(bytecode.length != 0, \"Create2: bytecode length is zero\");\n /// @solidity memory-safe-assembly\n assembly {\n addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)\n }\n require(addr != address(0), \"Create2: Failed on deploy\");\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the\n * `bytecodeHash` or `salt` will result in a new destination address.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {\n return computeAddress(salt, bytecodeHash, address(this));\n }\n\n /**\n * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at\n * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.\n */\n function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40) // Get free memory pointer\n\n // | | ↓ ptr ... ↓ ptr + 0x0B (start) ... ↓ ptr + 0x20 ... ↓ ptr + 0x40 ... |\n // |-------------------|---------------------------------------------------------------------------|\n // | bytecodeHash | CCCCCCCCCCCCC...CC |\n // | salt | BBBBBBBBBBBBB...BB |\n // | deployer | 000000...0000AAAAAAAAAAAAAAAAAAA...AA |\n // | 0xFF | FF |\n // |-------------------|---------------------------------------------------------------------------|\n // | memory | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |\n // | keccak(start, 85) | ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |\n\n mstore(add(ptr, 0x40), bytecodeHash)\n mstore(add(ptr, 0x20), salt)\n mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes\n let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff\n mstore8(start, 0xff)\n addr := keccak256(start, 85)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/common/Authority.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"./EntryPointAuth.sol\";\n\nabstract contract Authority is EntryPointAuth {\n error CallerNotSelf();\n\n modifier onlySelf() {\n if (msg.sender != address(this)) {\n revert CallerNotSelf();\n }\n _;\n }\n}\n" + }, + "contracts/common/Contants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nlibrary Contants {\n address internal constant SENTINEL = address(0x1);\n\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n}\n" + }, + "contracts/common/EntryPointAuth.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@account-abstraction/contracts/interfaces/IEntryPoint.sol\";\n\nabstract contract EntryPointAuth {\n error CallerNotEntryPoint();\n\n function _entryPoint() internal view virtual returns (IEntryPoint);\n\n modifier onlyEntryPoint() {\n if (msg.sender != address(_entryPoint())) {\n revert CallerNotEntryPoint();\n }\n _;\n }\n}\n" + }, + "contracts/common/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.12;\n\n/**\n * returned data from validateUserOp.\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\n * @param aggregator - address(0) - the account validated the signature by itself.\n * address(1) - the account failed to validate the signature.\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\n * @param validAfter - this UserOp is valid only after this timestamp.\n * @param validaUntil - this UserOp is valid only up to this timestamp.\n */\nstruct ValidationData {\n address aggregator;\n uint48 validAfter;\n uint48 validUntil;\n}\n\n//extract sigFailed, validAfter, validUntil.\n// also convert zero validUntil to type(uint48).max\nfunction _parseValidationData(uint256 validationData) pure returns (ValidationData memory data) {\n address aggregator = address(uint160(validationData));\n uint48 validUntil = uint48(validationData >> 160);\n if (validUntil == 0) {\n validUntil = type(uint48).max;\n }\n uint48 validAfter = uint48(validationData >> (48 + 160));\n return ValidationData(aggregator, validAfter, validUntil);\n}\n\n// intersect account and paymaster ranges.\nfunction _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData)\n pure\n returns (ValidationData memory)\n{\n ValidationData memory accountValidationData = _parseValidationData(validationData);\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\n address aggregator = accountValidationData.aggregator;\n if (aggregator == address(0)) {\n aggregator = pmValidationData.aggregator;\n }\n uint48 validAfter = accountValidationData.validAfter;\n uint48 validUntil = accountValidationData.validUntil;\n uint48 pmValidAfter = pmValidationData.validAfter;\n uint48 pmValidUntil = pmValidationData.validUntil;\n\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\n return ValidationData(aggregator, validAfter, validUntil);\n}\n\n/**\n * helper to pack the return value for validateUserOp\n * @param data - the ValidationData to pack\n */\nfunction _packValidationData(ValidationData memory data) pure returns (uint256) {\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\n}\n\n/**\n * helper to pack the return value for validateUserOp, when not using an aggregator\n * @param sigFailed - true for signature failure, false for success\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\n * @param validAfter first timestamp this UserOperation is valid\n */\nfunction _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\n}\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\nfunction calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n assembly {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n}\n" + }, + "contracts/core/EntryPointManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@account-abstraction/contracts/interfaces/IEntryPoint.sol\";\nimport \"../common/EntryPointAuth.sol\";\n\nabstract contract EntryPointManager is EntryPointAuth {\n IEntryPoint private immutable _ep;\n\n constructor(IEntryPoint anEntryPoint) {\n _ep = anEntryPoint;\n }\n\n function _entryPoint() internal view virtual override returns (IEntryPoint) {\n return _ep;\n }\n}\n" + }, + "contracts/core/ExecutionManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../common/Authority.sol\";\nimport \"../interfaces/IHook.sol\";\nimport \"../libraries/LinkedAddressList.sol\";\n\nabstract contract ExecutionManager is Authority {\n using LinkedAddressList for mapping(address => address);\n\n error WrongArrayLength();\n error InvalidHook();\n\n event InstalledHook(address indexed hook);\n event UninstalledHook(address indexed hook);\n\n mapping(address => address) internal beforeHooks;\n mapping(address => address) internal afterHooks;\n\n function addHook(address hook, bytes calldata data) external onlySelf {\n IHook _hook = IHook(hook);\n if (!IHook(hook).supportsInterface(type(IHook).interfaceId)) {\n revert InvalidHook();\n }\n\n if (_hook.hookType() == HookType.Pre) {\n beforeHooks.add(hook);\n } else if (_hook.hookType() == HookType.Post) {\n afterHooks.add(hook);\n } else {\n beforeHooks.add(hook);\n afterHooks.add(hook);\n }\n _hook.install(data);\n\n emit InstalledHook(hook);\n }\n\n function removeRecoveror(address prevBeforeHook, address prevAfterHook, address hook) external onlySelf {\n IHook _hook = IHook(hook);\n\n if (_hook.hookType() == HookType.Pre) {\n beforeHooks.remove(prevBeforeHook, hook);\n } else if (_hook.hookType() == HookType.Post) {\n afterHooks.remove(prevAfterHook, hook);\n } else {\n beforeHooks.remove(prevBeforeHook, hook);\n afterHooks.remove(prevAfterHook, hook);\n }\n _hook.uninstall();\n\n emit UninstalledHook(hook);\n }\n\n function sudo(address dest, uint256 value, bytes calldata func) external onlyEntryPoint {\n _call(dest, value, func);\n }\n\n function execute(address dest, uint256 value, bytes calldata func) external onlyEntryPoint {\n _execute(dest, value, func);\n }\n\n function executeBatch(address[] calldata dest, uint256[] calldata value, bytes[] calldata func)\n external\n onlyEntryPoint\n {\n if (dest.length != func.length || (value.length != 0 && value.length != func.length)) {\n revert WrongArrayLength();\n }\n if (value.length == 0) {\n for (uint256 i = 0; i < dest.length;) {\n _execute(dest[i], 0, func[i]);\n unchecked {\n i++;\n }\n }\n } else {\n for (uint256 i = 0; i < dest.length;) {\n _execute(dest[i], value[i], func[i]);\n unchecked {\n i++;\n }\n }\n }\n }\n\n function _execute(address target, uint256 value, bytes memory data) internal {\n address addr = beforeHooks[LinkedAddressList.SENTINEL];\n while (uint160(addr) > LinkedAddressList.SENTINEL_UINT) {\n IHook(addr).afterTransaction(target, value, data);\n addr = beforeHooks[addr];\n }\n\n _call(target, value, data);\n\n addr = afterHooks[LinkedAddressList.SENTINEL];\n while (uint160(addr) > LinkedAddressList.SENTINEL_UINT) {\n IHook(addr).afterTransaction(target, value, data);\n addr = afterHooks[addr];\n }\n }\n\n function _call(address target, uint256 value, bytes memory data) internal {\n (bool success, bytes memory result) = target.call{value: value}(data);\n if (!success) {\n assembly {\n revert(add(result, 32), mload(result))\n }\n }\n }\n}\n" + }, + "contracts/core/FallbackManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../common/Authority.sol\";\n\nabstract contract FallbackManager is Authority {\n error AddressCannotBeZero();\n\n // keccak-256 hash of \"fallback_manager.handler.address\" subtracted by 1\n bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT =\n 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d4;\n\n event ChangedFallbackHandler(address indexed previousHandler, address indexed handler);\n\n fallback() external {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n assembly {\n let handler := sload(slot)\n if iszero(handler) { return(0, 0) }\n calldatacopy(0, 0, calldatasize())\n // The msg.sender address is shifted to the left by 12 bytes to remove the padding\n // Then the address without padding is stored right after the calldata\n mstore(calldatasize(), shl(96, caller()))\n // Add 20 bytes for the address appended add the end\n let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if iszero(success) { revert(0, returndatasize()) }\n return(0, returndatasize())\n }\n }\n\n function getFallbackHandler() external view returns (address _handler) {\n assembly {\n _handler := sload(FALLBACK_HANDLER_STORAGE_SLOT)\n }\n }\n\n function setFallbackHandler(address handler) public onlySelf {\n address previousHandler;\n assembly {\n previousHandler := sload(FALLBACK_HANDLER_STORAGE_SLOT)\n }\n _setFallbackHandler(handler);\n emit ChangedFallbackHandler(previousHandler, handler);\n }\n\n function _setFallbackHandler(address handler) internal {\n if (handler == address(0)) revert AddressCannotBeZero();\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n assembly {\n sstore(slot, handler)\n }\n }\n}\n" + }, + "contracts/core/RecoveryManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../common/Authority.sol\";\nimport \"../common/Contants.sol\";\nimport \"../libraries/LinkedAddressList.sol\";\nimport \"../interfaces/IRecoveror.sol\";\n\nabstract contract RecoveryManager is Authority {\n error ErrorRecoveror(address);\n\n using LinkedAddressList for mapping(address => address);\n\n event AddedRecoveror(address recoveror);\n event RemovedRecoveror(address recoveror);\n\n mapping(address => address) internal recoverors;\n\n function getRecoverorsPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next)\n {\n return recoverors.page(start, pageSize);\n }\n\n function addRecoveror(address recoveror, bytes calldata data) external onlySelf {\n recoverors.add(recoveror);\n IRecoveror(recoveror).bind(data);\n emit AddedRecoveror(recoveror);\n }\n\n function removeRecoveror(address prevRecoveror, address recoveror) external onlySelf {\n recoverors.remove(prevRecoveror, recoveror);\n emit RemovedRecoveror(recoveror);\n }\n\n function isRecoverorEnabled(address recoveror) public view returns (bool) {\n return recoverors.contains(recoveror);\n }\n\n function _setupRecoverors() internal {\n recoverors.setup();\n }\n}\n" + }, + "contracts/core/ValidatorManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../common/Authority.sol\";\nimport \"../common/Contants.sol\";\nimport \"../libraries/LinkedAddressList.sol\";\nimport \"../interfaces/IValidator.sol\";\n\nabstract contract ValidatorManager is Authority {\n error ErrorValidator(address);\n\n using LinkedAddressList for mapping(address => address);\n\n error ValidatorCannotBeZeroOrSentinel(address validator);\n error ValidatorAlreadyEnabled(address validator);\n error ValidatorAndPrevValidatorMismatch(address expectedValidator, address returnedValidator, address prevValidator);\n\n event EnabledValidator(address validator);\n event DisabledValidator(address validator);\n\n mapping(address => address) internal validators;\n\n function getValidatorsPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next)\n {\n return validators.page(start, pageSize);\n }\n\n function _enableValidator(address validator, bytes calldata data) internal {\n validators.add(validator);\n IValidator(validator).enable(data);\n emit EnabledValidator(validator);\n }\n\n function enableValidator(address validator, bytes calldata data) external onlySelf {\n _enableValidator(validator, data);\n }\n\n function disableValidator(address prevValidator, address validator) external onlySelf {\n validators.remove(prevValidator, validator);\n emit DisabledValidator(validator);\n }\n\n function isValidatorEnabled(address validator) public view returns (bool) {\n return validators.contains(validator);\n }\n\n function _setupValidators() internal {\n validators.setup();\n }\n}\n" + }, + "contracts/handler/DefaultCallbackHandler.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@account-abstraction/contracts/samples/callback/TokenCallbackHandler.sol\";\n\ncontract DefaultCallbackHandler is TokenCallbackHandler {}\n" + }, + "contracts/hooks/BaseHook.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../interfaces/IHook.sol\";\n\nabstract contract BaseHook is IHook {\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == type(IHook).interfaceId;\n }\n}\n" + }, + "contracts/interfaces/IHook.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"./Metadata.sol\";\n\nenum HookType {\n Pre,\n Post,\n Both\n}\n\ninterface IHook is Metadata {\n function hookType() external view returns (HookType);\n\n function install(bytes memory data) external;\n\n function uninstall() external;\n\n function beforeTransaction(address to, uint256 value, bytes memory data) external;\n\n function afterTransaction(address to, uint256 value, bytes memory data) external;\n}\n" + }, + "contracts/interfaces/IRecoveror.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"./Metadata.sol\";\n\ninterface IRecoveror is Metadata {\n function recover(bytes calldata proof, address validator, bytes calldata data) external;\n\n function bind(bytes calldata data) external;\n}\n" + }, + "contracts/interfaces/IValidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"./Metadata.sol\";\n\ninterface IValidator is Metadata {\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\n external\n payable\n returns (uint256 validationData);\n\n function validCaller(address caller, bytes calldata data) external view returns (bool);\n\n function enable(bytes calldata data) external payable;\n}\n" + }, + "contracts/interfaces/Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface Metadata is IERC165 {\n function NAME() external view returns (string memory);\n function VERSION() external view returns (string memory);\n}\n" + }, + "contracts/libraries/LinkedAddressList.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nlibrary LinkedAddressList {\n address internal constant SENTINEL = address(0x1);\n uint160 internal constant SENTINEL_UINT = 1;\n\n function page(mapping(address => address) storage target, address start, uint256 pageSize)\n internal\n view\n returns (address[] memory array, address next)\n {\n array = new address[](pageSize);\n\n uint256 count;\n address current = target[start];\n while (current != address(0x0) && current != SENTINEL && count < pageSize) {\n array[count] = current;\n current = target[current];\n count++;\n }\n next = current;\n assembly {\n mstore(array, count)\n }\n }\n\n function contains(mapping(address => address) storage target, address item) internal view returns (bool) {\n return SENTINEL != item && target[item] != address(0);\n }\n\n function setup(mapping(address => address) storage target) internal {\n target[SENTINEL] = SENTINEL;\n }\n\n function add(mapping(address => address) storage target, address item) internal {\n require(item != address(0) && item != SENTINEL, \"item can't be zero or sentinel\");\n require(target[item] == address(0), \"item already added\");\n target[item] = target[SENTINEL];\n target[SENTINEL] = item;\n }\n\n function remove(mapping(address => address) storage target, address prevItem, address item) internal {\n require(item != address(0) && item != SENTINEL, \"item can't be zero or sentinel\");\n require(target[prevItem] == item, \"item and preitem mismatch\");\n target[prevItem] = target[item];\n delete target[item];\n }\n}\n" + }, + "contracts/paymaster/VerifyingPaymaster.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@account-abstraction/contracts/core/BasePaymaster.sol\";\n\ncontract VerifyingPaymaster is BasePaymaster {\n using ECDSA for bytes32;\n using UserOperationLib for UserOperation;\n\n event SignerChanged(address indexed signer);\n\n address public signer;\n\n uint256 private constant VALID_TIMESTAMP_OFFSET = 20;\n\n uint256 private constant SIGNATURE_OFFSET = 84;\n\n constructor(IEntryPoint _entryPoint, address _signer) BasePaymaster(_entryPoint) {\n signer = _signer;\n emit SignerChanged(_signer);\n }\n\n mapping(address => uint256) public senderNonce;\n\n function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) {\n bytes calldata pnd = userOp.paymasterAndData;\n assembly {\n let ofs := userOp\n let len := sub(sub(pnd.offset, ofs), 32)\n ret := mload(0x40)\n mstore(0x40, add(ret, add(len, 32)))\n mstore(ret, len)\n calldatacopy(add(ret, 32), ofs, len)\n }\n }\n\n function getHash(UserOperation calldata userOp, uint48 validUntil, uint48 validAfter)\n public\n view\n returns (bytes32)\n {\n return keccak256(\n abi.encode(\n pack(userOp), block.chainid, address(this), senderNonce[userOp.getSender()], validUntil, validAfter\n )\n );\n }\n\n function _validatePaymasterUserOp(UserOperation calldata userOp, bytes32, /*userOpHash*/ uint256 requiredPreFund)\n internal\n override\n returns (bytes memory context, uint256 validationData)\n {\n (requiredPreFund);\n\n (uint48 validUntil, uint48 validAfter, bytes calldata signature) =\n parsePaymasterAndData(userOp.paymasterAndData);\n require(\n signature.length == 64 || signature.length == 65,\n \"VerifyingPaymaster: invalid signature length in paymasterAndData\"\n );\n bytes32 hash = ECDSA.toEthSignedMessageHash(getHash(userOp, validUntil, validAfter));\n senderNonce[userOp.getSender()]++;\n\n if (signer != ECDSA.recover(hash, signature)) {\n return (\"\", _packValidationData(true, validUntil, validAfter));\n }\n\n return (\"\", _packValidationData(false, validUntil, validAfter));\n }\n\n function parsePaymasterAndData(bytes calldata paymasterAndData)\n public\n pure\n returns (uint48 validUntil, uint48 validAfter, bytes calldata signature)\n {\n (validUntil, validAfter) =\n abi.decode(paymasterAndData[VALID_TIMESTAMP_OFFSET:SIGNATURE_OFFSET], (uint48, uint48));\n signature = paymasterAndData[SIGNATURE_OFFSET:];\n }\n\n function changeSigner(address _signer) external onlyOwner {\n signer = _signer;\n emit SignerChanged(_signer);\n }\n}\n" + }, + "contracts/SmartAccount.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"@account-abstraction/contracts/core/BaseAccount.sol\";\n\nimport \"./core/EntryPointManager.sol\";\nimport \"./core/ExecutionManager.sol\";\nimport \"./core/FallbackManager.sol\";\nimport \"./core/ValidatorManager.sol\";\nimport \"./core/RecoveryManager.sol\";\n\ncontract SmartAccount is\n BaseAccount,\n Initializable,\n EntryPointManager,\n ExecutionManager,\n FallbackManager,\n ValidatorManager,\n RecoveryManager\n{\n constructor(IEntryPoint _EntryPoint) EntryPointManager(_EntryPoint) {\n _disableInitializers();\n }\n\n function initialize(address defalutCallbackHandler, address[] calldata validators, bytes[] calldata data)\n external\n initializer\n {\n if (validators.length != data.length) {\n revert WrongArrayLength();\n }\n _setFallbackHandler(defalutCallbackHandler);\n _setupValidators();\n _setupRecoverors();\n for (uint256 i = 0; i < validators.length;) {\n _enableValidator(validators[i], data[i]);\n unchecked {\n i++;\n }\n }\n }\n\n function entryPoint() public view virtual override returns (IEntryPoint) {\n return _entryPoint();\n }\n\n function _validateSignature(UserOperation calldata userOp, bytes32 userOpHash)\n internal\n virtual\n override\n returns (uint256 validationData)\n {\n (address validator, bytes memory signature) = abi.decode(userOp.signature, (address, bytes));\n\n if (!isValidatorEnabled(validator)) {\n return SIG_VALIDATION_FAILED;\n }\n return IValidator(validator).validateSignature(userOp.sender, userOpHash, signature);\n }\n\n function recovery(address validator, bytes calldata data) external {\n if (!isRecoverorEnabled(msg.sender)) {\n revert ErrorRecoveror(msg.sender);\n }\n if (!isValidatorEnabled(validator)) {\n revert ErrorValidator(validator);\n }\n IValidator(validator).enable(data);\n }\n\n function getDeposit() public view returns (uint256) {\n return entryPoint().balanceOf(address(this));\n }\n\n function addDeposit() public payable {\n entryPoint().depositTo{value: msg.value}(address(this));\n }\n\n function withdrawDepositTo(address payable withdrawAddress, uint256 amount) public onlySelf {\n entryPoint().withdrawTo(withdrawAddress, amount);\n }\n}\n" + }, + "contracts/SmartAccountFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/utils/Create2.sol\";\nimport \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\n\nimport \"./handler/DefaultCallbackHandler.sol\";\nimport \"./SmartAccount.sol\";\n\ncontract SmartAccountFactory {\n SmartAccount public immutable accountImplementation;\n address public immutable handler;\n\n constructor(IEntryPoint _entryPoint, address _handler) {\n handler = _handler;\n accountImplementation = new SmartAccount(_entryPoint);\n }\n\n function createAccount(address[] calldata validators, bytes[] calldata data, uint256 salt)\n public\n returns (SmartAccount ret)\n {\n address addr = getAddress(validators, data, salt);\n uint256 codeSize = addr.code.length;\n if (codeSize > 0) {\n return SmartAccount(payable(addr));\n }\n ret = SmartAccount(\n payable(\n new ERC1967Proxy{salt : bytes32(salt)}(\n address(accountImplementation),\n abi.encodeCall(SmartAccount.initialize, (handler, validators, data))\n )\n )\n );\n }\n\n function getAddress(address[] calldata validators, bytes[] calldata data, uint256 salt)\n public\n view\n returns (address)\n {\n return Create2.computeAddress(\n bytes32(salt),\n keccak256(\n abi.encodePacked(\n type(ERC1967Proxy).creationCode,\n abi.encode(\n address(accountImplementation),\n abi.encodeCall(SmartAccount.initialize, (handler, validators, data))\n )\n )\n )\n );\n }\n}\n" + }, + "contracts/test/stub.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@account-abstraction/contracts/core/EntryPoint.sol\";\n" + }, + "contracts/validators/BaseValidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../interfaces/IValidator.sol\";\n\nabstract contract BaseValidator is IValidator {\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == type(IValidator).interfaceId;\n }\n}\n" + }, + "contracts/validators/ECDSAValidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport \"../common/Contants.sol\";\nimport \"./BaseValidator.sol\";\n\ncontract ECDSAValidator is BaseValidator {\n string public constant override NAME = \"ECDSA Validator\";\n string public constant override VERSION = \"0.0.1\";\n\n event OwnerChanged(address indexed account, address indexed oldOwner, address indexed newOwner);\n\n mapping(address => address) public owner;\n\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\n external\n payable\n override\n returns (uint256 validationData)\n {\n address _owner = owner[account];\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\n if (_owner != ECDSA.recover(hash, signature)) {\n return Contants.SIG_VALIDATION_FAILED;\n }\n return 0;\n }\n\n function enable(bytes calldata data) external payable override {\n address _owner = address(bytes20(data[0:20]));\n address oldOwner = owner[msg.sender];\n owner[msg.sender] = _owner;\n emit OwnerChanged(msg.sender, oldOwner, _owner);\n }\n\n function validCaller(address caller, bytes calldata) external view override returns (bool) {\n return owner[msg.sender] == caller;\n }\n}\n" + }, + "contracts/validators/OwnerSessionKeyValidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nimport \"../interfaces/IValidator.sol\";\nimport \"../common/Contants.sol\";\nimport \"../common/Helpers.sol\";\nimport \"./BaseValidator.sol\";\n\nstruct SessionKeyStorage {\n uint48 validUntil;\n uint48 validAfter;\n}\n\ncontract OwnerSessionKeyValidator is BaseValidator {\n string public constant override NAME = \"Owner Session Key Validator\";\n string public constant override VERSION = \"0.0.1\";\n\n event NewSessionKey(address indexed account, address indexed sessionKey, uint48 validUntil, uint48 validAfter);\n\n mapping(address sessionKey => mapping(address account => SessionKeyStorage)) public sessionKeyStorage;\n\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\n external\n payable\n override\n returns (uint256 validationData)\n {\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\n address recovered = ECDSA.recover(hash, signature);\n\n SessionKeyStorage storage sessionKey = sessionKeyStorage[recovered][account];\n if (sessionKey.validUntil == 0) {\n // we do not allow validUntil == 0 here\n return Contants.SIG_VALIDATION_FAILED;\n }\n validationData = _packValidationData(false, sessionKey.validUntil, sessionKey.validAfter);\n }\n\n function enable(bytes calldata data) external payable override {\n address sessionKey = address(bytes20(data[0:20]));\n uint48 validUntil = uint48(bytes6(data[20:26]));\n uint48 validAfter = uint48(bytes6(data[26:32]));\n require(validUntil > validAfter, \"OwnerSessionKeyValidator: invalid validUntil/validAfter\"); // we do not allow validUntil == 0 here use validUntil == 2**48-1 instead\n sessionKeyStorage[sessionKey][msg.sender] = SessionKeyStorage(validUntil, validAfter);\n\n emit NewSessionKey(msg.sender, sessionKey, validUntil, validAfter);\n }\n\n function validCaller(address caller, bytes calldata) external view override returns (bool) {\n SessionKeyStorage storage sessionKey = sessionKeyStorage[caller][msg.sender];\n if (block.timestamp <= sessionKey.validAfter) {\n return false;\n }\n if (block.timestamp > sessionKey.validUntil) {\n return false;\n }\n return true;\n }\n}\n" + }, + "contracts/validators/p256/Base64.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nlibrary Base64 {\n /**\n * @dev Base64 Encoding/Decoding Table\n */\n string internal constant _TABLE = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_\";\n\n /**\n * @dev Converts a `bytes` to its Bytes64 `string` representation.\n */\n function encode(bytes memory data) internal pure returns (string memory) {\n /**\n * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence\n * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol\n */\n if (data.length == 0) return \"\";\n\n // Loads the table into memory\n string memory table = _TABLE;\n\n // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter\n // and split into 4 numbers of 6 bits.\n // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up\n // - `data.length + 2` -> Round up\n // - `/ 3` -> Number of 3-bytes chunks\n // - `4 *` -> 4 characters for each chunk\n uint256 newlength = data.length * 8 / 6;\n if (data.length % 6 > 0) {\n newlength++;\n }\n string memory result = new string(newlength);\n\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the lookup table (skip the first \"length\" byte)\n let tablePtr := add(table, 1)\n\n // Prepare result pointer, jump over length\n let resultPtr := add(result, 32)\n // let targetLength := add(resultPtr, newlength)\n\n // Run over the input, 3 bytes at a time\n for {\n let dataPtr := data\n let endPtr := add(data, mload(data))\n } lt(dataPtr, endPtr) {} {\n // Advance 3 bytes\n dataPtr := add(dataPtr, 3)\n let input := mload(dataPtr)\n\n // To write each character, shift the 3 bytes (18 bits) chunk\n // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)\n // and apply logical AND with 0x3F which is the number of\n // the previous character in the ASCII table prior to the Base64 Table\n // The result is then added to the table to get the character to write,\n // and finally write it in the result pointer but with a left shift\n // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits\n mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))\n resultPtr := add(resultPtr, 1)\n\n mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))\n resultPtr := add(resultPtr, 1)\n\n mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))\n resultPtr := add(resultPtr, 1)\n\n mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))\n resultPtr := add(resultPtr, 1)\n }\n }\n\n return result;\n }\n}\n" + }, + "contracts/validators/p256/ISecp256r1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\ninterface ISecp256r1 {\n function validateSignature(bytes32 message, bytes calldata signature, bytes calldata publicKey)\n external\n view\n returns (bool);\n}\n" + }, + "contracts/validators/p256/P256Validator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../../common/Contants.sol\";\nimport \"../BaseValidator.sol\";\nimport \"./ISecp256r1.sol\";\nimport \"./Base64.sol\";\n\ncontract P256Validator is BaseValidator {\n string public constant override NAME = \"P256 Validator\";\n string public constant override VERSION = \"0.0.1\";\n\n event PkChanged(address indexed account, bytes oldPk, bytes newPk);\n\n ISecp256r1 public immutable impl;\n mapping(address => bytes) public pks;\n\n constructor(ISecp256r1 _impl) {\n impl = _impl;\n }\n\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\n external\n payable\n override\n returns (uint256 validationData)\n {\n if (impl.validateSignature(sha256(abi.encode(userOpHash)), signature, pks[account])) {\n return 0;\n }\n return Contants.SIG_VALIDATION_FAILED;\n }\n\n function enable(bytes calldata data) external payable override {\n bytes memory old = pks[msg.sender];\n pks[msg.sender] = data;\n emit PkChanged(msg.sender, old, data);\n }\n\n function validCaller(address, bytes calldata) external pure override returns (bool) {\n revert(\"not implemented\");\n }\n}\n" + }, + "contracts/validators/p256/Secp256r1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"./ISecp256r1.sol\";\n\ncontract Secp256r1 is ISecp256r1 {\n struct JPoint {\n uint256 x;\n uint256 y;\n uint256 z;\n }\n\n uint256 constant gx = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296;\n uint256 constant gy = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5;\n uint256 public constant pp = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF;\n\n uint256 public constant nn = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;\n uint256 constant a = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC;\n uint256 constant b = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B;\n uint256 constant MOST_SIGNIFICANT = 0xc000000000000000000000000000000000000000000000000000000000000000;\n\n function verifyWithPrecompute(JPoint[16] memory points, uint256 r, uint256 s, uint256 e)\n internal\n view\n returns (bool)\n {\n if (r >= nn || s >= nn) {\n return false;\n }\n\n uint256 w = _primemod(s, nn);\n\n uint256 u1 = mulmod(e, w, nn);\n uint256 u2 = mulmod(r, w, nn);\n\n uint256 x;\n uint256 y;\n\n (x, y) = ShamirMultJacobian(points, u1, u2);\n return (x == r);\n }\n\n /*\n * Strauss Shamir trick for EC multiplication\n * https://stackoverflow.com/questions/50993471/ec-scalar-multiplication-with-strauss-shamir-method\n * we optimise on this a bit to do with 2 bits at a time rather than a single bit\n * the individual points for a single pass are precomputed\n * overall this reduces the number of additions while keeping the same number of doublings\n */\n function ShamirMultJacobian(JPoint[16] memory points, uint256 u1, uint256 u2)\n internal\n view\n returns (uint256, uint256)\n {\n uint256 x = 0;\n uint256 y = 0;\n uint256 z = 0;\n uint256 bits = 128;\n uint256 index = 0;\n\n while (bits > 0) {\n if (z > 0) {\n (x, y, z) = _modifiedJacobianDouble(x, y, z);\n (x, y, z) = _modifiedJacobianDouble(x, y, z);\n }\n index = ((u1 & MOST_SIGNIFICANT) >> 252) | ((u2 & MOST_SIGNIFICANT) >> 254);\n if (index > 0) {\n (x, y, z) = _jAdd(x, y, z, points[index].x, points[index].y, points[index].z);\n }\n u1 <<= 2;\n u2 <<= 2;\n bits--;\n }\n (x, y) = _affineFromJacobian(x, y, z);\n return (x, y);\n }\n\n function _preComputeJacobianPoints(uint256 x, uint256 y) internal pure returns (JPoint[16] memory points) {\n points[0] = JPoint(0, 0, 0);\n points[1] = JPoint(x, y, 1); // u2\n points[2] = _jPointDouble(points[1]);\n points[3] = _jPointAdd(points[1], points[2]);\n\n points[4] = JPoint(gx, gy, 1); // u1Points[1]\n points[5] = _jPointAdd(points[4], points[1]);\n points[6] = _jPointAdd(points[4], points[2]);\n points[7] = _jPointAdd(points[4], points[3]);\n\n points[8] = _jPointDouble(points[4]); // u1Points[2]\n points[9] = _jPointAdd(points[8], points[1]);\n points[10] = _jPointAdd(points[8], points[2]);\n points[11] = _jPointAdd(points[8], points[3]);\n\n points[12] = _jPointAdd(points[4], points[8]); // u1Points[3]\n points[13] = _jPointAdd(points[12], points[1]);\n points[14] = _jPointAdd(points[12], points[2]);\n points[15] = _jPointAdd(points[12], points[3]);\n }\n\n function _jPointAdd(JPoint memory p1, JPoint memory p2) internal pure returns (JPoint memory) {\n uint256 x;\n uint256 y;\n uint256 z;\n (x, y, z) = _jAdd(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z);\n return JPoint(x, y, z);\n }\n\n function _jPointDouble(JPoint memory p) internal pure returns (JPoint memory) {\n uint256 x;\n uint256 y;\n uint256 z;\n (x, y, z) = _modifiedJacobianDouble(p.x, p.y, p.z);\n return JPoint(x, y, z);\n }\n\n /* _affineFromJacobian\n * @desription returns affine coordinates from a jacobian input follows\n * golang elliptic/crypto library\n */\n function _affineFromJacobian(uint256 x, uint256 y, uint256 z) internal view returns (uint256 ax, uint256 ay) {\n if (z == 0) {\n return (0, 0);\n }\n\n uint256 zinv = _primemod(z, pp);\n uint256 zinvsq = mulmod(zinv, zinv, pp);\n\n ax = mulmod(x, zinvsq, pp);\n ay = mulmod(y, mulmod(zinvsq, zinv, pp), pp);\n }\n\n /*\n * _jAdd\n * @description performs double Jacobian as defined below:\n * https://hyperelliptic.org/EFD/g1p/auto-code/shortw/jacobian-3/doubling/mdbl-2007-bl.op3\n */\n function _jAdd(uint256 p1, uint256 p2, uint256 p3, uint256 q1, uint256 q2, uint256 q3)\n internal\n pure\n returns (uint256 r1, uint256 r2, uint256 r3)\n {\n if (p3 == 0) {\n r1 = q1;\n r2 = q2;\n r3 = q3;\n\n return (r1, r2, r3);\n } else if (q3 == 0) {\n r1 = p1;\n r2 = p2;\n r3 = p3;\n\n return (r1, r2, r3);\n }\n\n assembly {\n let pd := 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF\n let z1z1 := mulmod(p3, p3, pd) // Z1Z1 = Z1^2\n let z2z2 := mulmod(q3, q3, pd) // Z2Z2 = Z2^2\n\n let u1 := mulmod(p1, z2z2, pd) // U1 = X1*Z2Z2\n let u2 := mulmod(q1, z1z1, pd) // U2 = X2*Z1Z1\n\n let s1 := mulmod(p2, mulmod(z2z2, q3, pd), pd) // S1 = Y1*Z2*Z2Z2\n let s2 := mulmod(q2, mulmod(z1z1, p3, pd), pd) // S2 = Y2*Z1*Z1Z1\n\n let p3q3 := addmod(p3, q3, pd)\n\n if lt(u2, u1) { u2 := add(pd, u2) } // u2 = u2+pd\n\n let h := sub(u2, u1) // H = U2-U1\n\n let i := mulmod(0x02, h, pd)\n i := mulmod(i, i, pd) // I = (2*H)^2\n\n let j := mulmod(h, i, pd) // J = H*I\n if lt(s2, s1) { s2 := add(pd, s2) } // u2 = u2+pd\n\n let rr := mulmod(0x02, sub(s2, s1), pd) // r = 2*(S2-S1)\n r1 := mulmod(rr, rr, pd) // X3 = R^2\n\n let v := mulmod(u1, i, pd) // V = U1*I\n let j2v := addmod(j, mulmod(0x02, v, pd), pd)\n if lt(r1, j2v) { r1 := add(pd, r1) } // X3 = X3+pd\n\n r1 := sub(r1, j2v)\n\n // Y3 = r*(V-X3)-2*S1*J\n let s12j := mulmod(mulmod(0x02, s1, pd), j, pd)\n\n if lt(v, r1) { v := add(pd, v) }\n r2 := mulmod(rr, sub(v, r1), pd)\n\n if lt(r2, s12j) { r2 := add(pd, r2) }\n r2 := sub(r2, s12j)\n\n // Z3 = ((Z1+Z2)^2-Z1Z1-Z2Z2)*H\n z1z1 := addmod(z1z1, z2z2, pd)\n j2v := mulmod(p3q3, p3q3, pd)\n if lt(j2v, z1z1) { j2v := add(pd, j2v) }\n r3 := mulmod(sub(j2v, z1z1), h, pd)\n }\n return (r1, r2, r3);\n }\n\n // Point doubling on the modified jacobian coordinates\n // http://point-at-infinity.org/ecc/Prime_Curve_Modified_Jacobian_Coordinates.html\n function _modifiedJacobianDouble(uint256 x, uint256 y, uint256 z)\n internal\n pure\n returns (uint256 x3, uint256 y3, uint256 z3)\n {\n assembly {\n let pd := 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF\n let z2 := mulmod(z, z, pd)\n let az4 :=\n mulmod(0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC, mulmod(z2, z2, pd), pd)\n let y2 := mulmod(y, y, pd)\n let s := mulmod(0x04, mulmod(x, y2, pd), pd)\n let u := mulmod(0x08, mulmod(y2, y2, pd), pd)\n let m := addmod(mulmod(0x03, mulmod(x, x, pd), pd), az4, pd)\n let twos := mulmod(0x02, s, pd)\n let m2 := mulmod(m, m, pd)\n if lt(m2, twos) { m2 := add(pd, m2) }\n x3 := sub(m2, twos)\n if lt(s, x3) { s := add(pd, s) }\n y3 := mulmod(m, sub(s, x3), pd)\n if lt(y3, u) { y3 := add(pd, y3) }\n y3 := sub(y3, u)\n z3 := mulmod(0x02, mulmod(y, z, pd), pd)\n }\n }\n\n // Fermats little theorem https://en.wikipedia.org/wiki/Fermat%27s_little_theorem\n // a^(p-1) = 1 mod p\n // a^(-1) ≅ a^(p-2) (mod p)\n // we then use the precompile bigModExp to compute a^(-1)\n function _primemod(uint256 value, uint256 p) internal view returns (uint256 ret) {\n ret = modexp(value, p - 2, p);\n return ret;\n }\n\n // Wrapper for built-in BigNumber_modexp (contract 0x5) as described here. https://github.com/ethereum/EIPs/pull/198\n function modexp(uint256 _base, uint256 _exp, uint256 _mod) internal view returns (uint256 ret) {\n // bigModExp(_base, _exp, _mod);\n assembly {\n if gt(_base, _mod) { _base := mod(_base, _mod) }\n // Free memory pointer is always stored at 0x40\n let freemem := mload(0x40)\n\n mstore(freemem, 0x20)\n mstore(add(freemem, 0x20), 0x20)\n mstore(add(freemem, 0x40), 0x20)\n\n mstore(add(freemem, 0x60), _base)\n mstore(add(freemem, 0x80), _exp)\n mstore(add(freemem, 0xa0), _mod)\n\n let success := staticcall(1500, 0x5, freemem, 0xc0, freemem, 0x20)\n switch success\n case 0 { revert(0x0, 0x0) }\n default { ret := mload(freemem) }\n }\n }\n\n function validateSignature(bytes32 message, bytes calldata signature, bytes calldata publicKey)\n external\n view\n override\n returns (bool)\n {\n uint256[2] memory rs;\n (rs[0], rs[1]) = abi.decode(signature, (uint256, uint256));\n if (rs[0] >= nn || rs[1] >= nn) {\n return false;\n }\n\n uint256[2] memory Q;\n (Q[0], Q[1]) = abi.decode(publicKey, (uint256, uint256));\n\n JPoint[16] memory points = _preComputeJacobianPoints(Q[0], Q[1]);\n return verifyWithPrecompute(points, rs[0], rs[1], uint256(message));\n }\n}\n" + }, + "contracts/validators/p256/Secp256r1IoTeX.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport \"./ISecp256r1.sol\";\n\ncontract Secp256r1IoTeX is ISecp256r1 {\n function validateSignature(bytes32 message, bytes calldata signature, bytes calldata publicKey)\n external\n view\n override\n returns (bool result)\n {\n bytes32 rs0;\n bytes32 rs1;\n bytes32 Q0;\n bytes32 Q1;\n\n (rs0, rs1) = abi.decode(signature, (bytes32, bytes32));\n (Q0, Q1) = abi.decode(publicKey, (bytes32, bytes32));\n\n bytes1 out;\n assembly {\n // free memory pointer\n let input := mload(0x40)\n\n mstore(input, message)\n mstore(add(input, 0x20), rs0)\n mstore(add(input, 0x40), rs1)\n mstore(add(input, 0x60), \"\\x04\")\n mstore(add(input, 0x61), Q0)\n mstore(add(input, 0x81), Q1)\n let success := staticcall(gas(), 0x8001, input, 0xa1, out, 0x1)\n switch success\n case 0 { revert(0x0, 0x0) }\n default { result := mload(out) }\n }\n }\n}\n" + }, + "contracts/validators/p256/WebauthnValidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../../common/Contants.sol\";\nimport \"../BaseValidator.sol\";\nimport \"./ISecp256r1.sol\";\nimport \"./Base64.sol\";\n\ncontract WebauthnValidator is BaseValidator {\n string public constant override NAME = \"Webauthn Validator\";\n string public constant override VERSION = \"0.0.1\";\n\n event PkChanged(address indexed account, bytes oldPk, bytes newPk);\n\n ISecp256r1 public immutable impl;\n mapping(address => bytes) public pks;\n\n constructor(ISecp256r1 _impl) {\n impl = _impl;\n }\n\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\n external\n payable\n override\n returns (uint256 validationData)\n {\n bytes memory sig;\n bytes32 messageHash;\n {\n (\n bytes memory realSig,\n bytes memory authenticatorData,\n string memory clientDataJSONPre,\n string memory clientDataJSONPost\n ) = abi.decode(signature, (bytes, bytes, string, string));\n\n string memory clientDataJSON =\n string.concat(clientDataJSONPre, Base64.encode(bytes.concat(userOpHash)), clientDataJSONPost);\n bytes32 clientDataHash = sha256(bytes(clientDataJSON));\n messageHash = sha256(bytes.concat(authenticatorData, clientDataHash));\n sig = realSig;\n }\n\n if (impl.validateSignature(messageHash, sig, pks[account])) {\n return 0;\n }\n return Contants.SIG_VALIDATION_FAILED;\n }\n\n function enable(bytes calldata data) external payable override {\n bytes memory old = pks[msg.sender];\n pks[msg.sender] = data;\n emit PkChanged(msg.sender, old, data);\n }\n\n function validCaller(address, bytes calldata) external pure override returns (bool) {\n revert(\"not implemented\");\n }\n}\n" + } + }, + "settings": { + "viaIR": false, + "optimizer": { + "enabled": true, + "runs": 800 + }, + "metadata": { + "bytecodeHash": "none", + "useLiteralContent": true + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/solcInputs/a280f1a2e68de4d8bf0f5b30b89ec7ed.json b/deployments/sepolia/solcInputs/a280f1a2e68de4d8bf0f5b30b89ec7ed.json new file mode 100644 index 0000000..081f938 --- /dev/null +++ b/deployments/sepolia/solcInputs/a280f1a2e68de4d8bf0f5b30b89ec7ed.json @@ -0,0 +1,67 @@ +{ + "language": "Solidity", + "sources": { + "@account-abstraction/contracts/core/Helpers.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.12;\n\n/* solhint-disable no-inline-assembly */\n\n/**\n * returned data from validateUserOp.\n * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData`\n * @param aggregator - address(0) - the account validated the signature by itself.\n * address(1) - the account failed to validate the signature.\n * otherwise - this is an address of a signature aggregator that must be used to validate the signature.\n * @param validAfter - this UserOp is valid only after this timestamp.\n * @param validaUntil - this UserOp is valid only up to this timestamp.\n */\n struct ValidationData {\n address aggregator;\n uint48 validAfter;\n uint48 validUntil;\n }\n\n//extract sigFailed, validAfter, validUntil.\n// also convert zero validUntil to type(uint48).max\n function _parseValidationData(uint validationData) pure returns (ValidationData memory data) {\n address aggregator = address(uint160(validationData));\n uint48 validUntil = uint48(validationData >> 160);\n if (validUntil == 0) {\n validUntil = type(uint48).max;\n }\n uint48 validAfter = uint48(validationData >> (48 + 160));\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n// intersect account and paymaster ranges.\n function _intersectTimeRange(uint256 validationData, uint256 paymasterValidationData) pure returns (ValidationData memory) {\n ValidationData memory accountValidationData = _parseValidationData(validationData);\n ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData);\n address aggregator = accountValidationData.aggregator;\n if (aggregator == address(0)) {\n aggregator = pmValidationData.aggregator;\n }\n uint48 validAfter = accountValidationData.validAfter;\n uint48 validUntil = accountValidationData.validUntil;\n uint48 pmValidAfter = pmValidationData.validAfter;\n uint48 pmValidUntil = pmValidationData.validUntil;\n\n if (validAfter < pmValidAfter) validAfter = pmValidAfter;\n if (validUntil > pmValidUntil) validUntil = pmValidUntil;\n return ValidationData(aggregator, validAfter, validUntil);\n }\n\n/**\n * helper to pack the return value for validateUserOp\n * @param data - the ValidationData to pack\n */\n function _packValidationData(ValidationData memory data) pure returns (uint256) {\n return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48));\n }\n\n/**\n * helper to pack the return value for validateUserOp, when not using an aggregator\n * @param sigFailed - true for signature failure, false for success\n * @param validUntil last timestamp this UserOperation is valid (or zero for infinite)\n * @param validAfter first timestamp this UserOperation is valid\n */\n function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) {\n return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48));\n }\n\n/**\n * keccak function over calldata.\n * @dev copy calldata into memory, do keccak and drop allocated memory. Strangely, this is more efficient than letting solidity do it.\n */\n function calldataKeccak(bytes calldata data) pure returns (bytes32 ret) {\n assembly {\n let mem := mload(0x40)\n let len := data.length\n calldatacopy(mem, data.offset, len)\n ret := keccak256(mem, len)\n }\n }\n\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "contracts/common/Contants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nlibrary Contants {\n address internal constant SENTINEL = address(0x1);\n\n uint256 internal constant SIG_VALIDATION_FAILED = 1;\n}\n" + }, + "contracts/interfaces/IValidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"./Metadata.sol\";\n\ninterface IValidator is Metadata {\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\n external\n payable\n returns (uint256 validationData);\n\n function validCaller(address caller, bytes calldata data) external view returns (bool);\n\n function enable(bytes calldata data) external payable;\n}\n" + }, + "contracts/interfaces/Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface Metadata is IERC165 {\n function NAME() external view returns (string memory);\n function VERSION() external view returns (string memory);\n}\n" + }, + "contracts/validators/BaseValidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"../interfaces/IValidator.sol\";\n\nabstract contract BaseValidator is IValidator {\n function supportsInterface(bytes4 interfaceId) external pure returns (bool) {\n return interfaceId == type(IValidator).interfaceId;\n }\n}\n" + }, + "contracts/validators/sessionkey/OwnerSessionKeyValidator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {_packValidationData} from \"@account-abstraction/contracts/core/Helpers.sol\";\n\nimport \"../../interfaces/IValidator.sol\";\nimport \"../../common/Contants.sol\";\nimport \"../BaseValidator.sol\";\n\nstruct SessionKeyStorage {\n uint48 validUntil;\n uint48 validAfter;\n}\n\ncontract OwnerSessionKeyValidator is BaseValidator {\n string public constant override NAME = \"Owner Session Key Validator\";\n string public constant override VERSION = \"0.0.1\";\n\n event NewSessionKey(address indexed account, address indexed sessionKey, uint48 validUntil, uint48 validAfter);\n\n mapping(address sessionKey => mapping(address account => SessionKeyStorage)) public sessionKeyStorage;\n\n function validateSignature(address account, bytes32 userOpHash, bytes calldata signature)\n external\n payable\n override\n returns (uint256 validationData)\n {\n bytes32 hash = ECDSA.toEthSignedMessageHash(userOpHash);\n address recovered = ECDSA.recover(hash, signature);\n\n SessionKeyStorage storage sessionKey = sessionKeyStorage[recovered][account];\n if (sessionKey.validUntil == 0) {\n return Contants.SIG_VALIDATION_FAILED;\n }\n validationData = _packValidationData(false, sessionKey.validUntil, sessionKey.validAfter);\n }\n\n function enable(bytes calldata data) external payable override {\n address sessionKey = address(bytes20(data[0:20]));\n uint48 validUntil = uint48(bytes6(data[20:26]));\n uint48 validAfter = uint48(bytes6(data[26:32]));\n require(validUntil > validAfter, \"OwnerSessionKeyValidator: invalid validUntil/validAfter\");\n sessionKeyStorage[sessionKey][msg.sender] = SessionKeyStorage(validUntil, validAfter);\n\n emit NewSessionKey(msg.sender, sessionKey, validUntil, validAfter);\n }\n\n function validCaller(address caller, bytes calldata) external view override returns (bool) {\n SessionKeyStorage storage sessionKey = sessionKeyStorage[caller][msg.sender];\n if (block.timestamp <= sessionKey.validAfter) {\n return false;\n }\n if (block.timestamp > sessionKey.validUntil) {\n return false;\n }\n return true;\n }\n}\n" + } + }, + "settings": { + "viaIR": false, + "optimizer": { + "enabled": true, + "runs": 800 + }, + "metadata": { + "bytecodeHash": "none", + "useLiteralContent": true + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + } + } +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 387a133..3cfbf8c 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -24,15 +24,15 @@ export default { }, mainnet: { url: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`, + accounts: accounts, }, - ropsten: { - url: `https://ropsten.infura.io/v3/${process.env.INFURA_API_KEY}`, - }, - rinkeby: { - url: `https://rinkeby.infura.io/v3/${process.env.INFURA_API_KEY}`, + sepolia: { + url: `https://sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`, + accounts: accounts, }, goerli: { url: `https://goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, + accounts: accounts, } }, namedAccounts: { diff --git a/src/config.ts b/src/config.ts index e28692e..bb65e7f 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,4 +2,7 @@ export const addresses = { iotex_testnet: { entrypoint: '0xc3527348De07d591c9d567ce1998eFA2031B8675', }, + sepolia: { + entrypoint: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789', + }, }