UNPKG

@owlprotocol/contracts-account-abstraction

Version:

ERC4337 Account Abstraction support for deploying relevant smart contracts and interacting with UserOps.

179 lines (170 loc) 6.19 kB
const NonceManager = { compiler: { version: "0.8.23+commit.f704f362" }, language: "Solidity", output: { abi: [ { inputs: [ { internalType: "address", name: "sender", type: "address" }, { internalType: "uint192", name: "key", type: "uint192" } ], name: "getNonce", outputs: [ { internalType: "uint256", name: "nonce", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "uint192", name: "key", type: "uint192" } ], name: "incrementNonce", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "", type: "address" }, { internalType: "uint192", name: "", type: "uint192" } ], name: "nonceSequenceNumber", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" } ], devdoc: { kind: "dev", methods: { "getNonce(address,uint192)": { params: { key: "the high 192 bit of the nonce", sender: "the account address" }, returns: { nonce: "a full nonce to pass for next UserOp with this sender." } } }, version: 1 }, userdoc: { kind: "user", methods: { "getNonce(address,uint192)": { notice: "Return the next nonce for this sender. Within a given key, the nonce values are sequenced (starting with zero, and incremented by one on each userop) But UserOp with different keys can come with arbitrary order." }, "incrementNonce(uint192)": { notice: 'Manually increment the nonce of the sender. This method is exposed just for completeness.. Account does NOT need to call it, neither during validation, nor elsewhere, as the EntryPoint will update the nonce regardless. Possible use-case is call it with various keys to "initialize" their nonces to one, so that future UserOperations will not pay extra for the first transaction with a given key.' }, "nonceSequenceNumber(address,uint192)": { notice: "The next valid sequence number for a given nonce key." } }, notice: "nonce management functionality", version: 1 } }, settings: { compilationTarget: { "@account-abstraction/contracts/core/NonceManager.sol": "NonceManager" }, evmVersion: "paris", libraries: {}, metadata: { bytecodeHash: "ipfs", useLiteralContent: true }, optimizer: { enabled: true, runs: 1e6 }, remappings: [], viaIR: true }, sources: { "@account-abstraction/contracts/core/NonceManager.sol": { content: `// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.23; import "../interfaces/INonceManager.sol"; /** * nonce management functionality */ abstract contract NonceManager is INonceManager { /** * The next valid sequence number for a given nonce key. */ mapping(address => mapping(uint192 => uint256)) public nonceSequenceNumber; /// @inheritdoc INonceManager function getNonce(address sender, uint192 key) public view override returns (uint256 nonce) { return nonceSequenceNumber[sender][key] | (uint256(key) << 64); } // allow an account to manually increment its own nonce. // (mainly so that during construction nonce can be made non-zero, // to "absorb" the gas cost of first nonce increment to 1st transaction (construction), // not to 2nd transaction) function incrementNonce(uint192 key) public override { nonceSequenceNumber[msg.sender][key]++; } /** * validate nonce uniqueness for this account. * called just after validateUserOp() * @return true if the nonce was incremented successfully. * false if the current nonce doesn't match the given one. */ function _validateAndUpdateNonce(address sender, uint256 nonce) internal returns (bool) { uint192 key = uint192(nonce >> 64); uint64 seq = uint64(nonce); return nonceSequenceNumber[sender][key]++ == seq; } } `, keccak256: "0x1f951786ce6f171e7ed0242fee73ee4a205c7523404ee6cffca48b8c64ea5fe9", license: "GPL-3.0" }, "@account-abstraction/contracts/interfaces/INonceManager.sol": { content: '// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.7.5;\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: "0xd575af0f6ebbd5f0b2933307d44cd7b4e03a69f4b817a67db5409bd3c89aeecb", license: "GPL-3.0" } }, version: 1 }; export { NonceManager };