creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/interfaces/IERC1271.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n    /**\n     * @dev Should return whether the signature provided is valid for the provided data\n     * @param hash      Hash of the data to be signed\n     * @param signature Signature byte array associated with _data\n     */\n    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\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/ERC1155/utils/ERC1155Holder.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC1155Receiver.sol\";\n\n/**\n * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.\n *\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\n * stuck.\n *\n * @dev _Available since v3.1._\n */\ncontract ERC1155Holder is ERC1155Receiver {\n    function onERC1155Received(\n        address,\n        address,\n        uint256,\n        uint256,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155Received.selector;\n    }\n\n    function onERC1155BatchReceived(\n        address,\n        address,\n        uint256[] memory,\n        uint256[] memory,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155BatchReceived.selector;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n    }\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/ERC721/utils/ERC721Holder.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Receiver.sol\";\n\n/**\n * @dev Implementation of the {IERC721Receiver} interface.\n *\n * Accepts all token transfers.\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.\n */\ncontract ERC721Holder is IERC721Receiver {\n    /**\n     * @dev See {IERC721Receiver-onERC721Received}.\n     *\n     * Always returns `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address,\n        address,\n        uint256,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC721Received.selector;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.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     *\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://diligence.consensys.net/posts/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.5.11/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(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) 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/cryptography/ECDSA.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.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(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) 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(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) 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(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) 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(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) 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) {\n        // 32 is the length in bytes of hash,\n        // enforced by the type signature above\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\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) {\n        return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\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.8.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(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) 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                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1);\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(\n        uint256 x,\n        uint256 y,\n        uint256 denominator,\n        Rounding rounding\n    ) 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 10, 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 * 8) < value ? 1 : 0);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.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 `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"
      },
      "contracts/Avocado.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\n/// @title   IAvocado\n/// @notice  interface to access internal vars on-chain\ninterface IAvocado {\n    function _avoImpl() external view returns (address);\n\n    function _data() external view returns (uint256);\n\n    function _owner() external view returns (address);\n}\n\n/// @title      Avocado\n/// @notice     Proxy for Avocados as deployed by the AvoFactory.\n///             Basic Proxy with fallback to delegate and address for implementation contract at storage 0x0\n//\n// @dev        If this contract changes then the deployment addresses for new Avocados through factory change too!!\n//             Relayers might want to pass in version as new param then to forward to the correct factory\ncontract Avocado {\n    /// @notice flexible immutable data slot.\n    /// first 20 bytes: address owner\n    /// next 4 bytes: uint32 index\n    /// next 1 byte: uint8 type\n    /// next 9 bytes: used flexible for use-cases found in the future\n    uint256 internal immutable _data;\n\n    /// @notice address of the Avocado logic / implementation contract. IMPORTANT: SAME STORAGE SLOT AS FOR PROXY\n    //\n    // @dev    _avoImpl MUST ALWAYS be the first declared variable here in the proxy and in the logic contract\n    //         when upgrading, the storage at memory address 0x0 is upgraded (first slot).\n    //         To reduce deployment costs this variable is internal but can still be retrieved with\n    //         _avoImpl(), see code and comments in fallback below\n    address internal _avoImpl;\n\n    /// @notice   sets _avoImpl & immutable _data, fetching it from msg.sender.\n    //\n    // @dev      those values are not input params to not influence the deterministic Create2 address!\n    constructor() {\n        // \"\\x8c\\x65\\x73\\x89\" is hardcoded bytes of function selector for transientDeployData()\n        (, bytes memory deployData_) = msg.sender.staticcall(bytes(\"\\x8c\\x65\\x73\\x89\"));\n\n        address impl_;\n        uint256 data_;\n        assembly {\n            // cast first 20 bytes to version address (_avoImpl)\n            impl_ := mload(add(deployData_, 0x20))\n\n            // cast bytes in position 0x40 to uint256 data; deployData_ plus 0x40 due to padding\n            data_ := mload(add(deployData_, 0x40))\n        }\n\n        _data = data_;\n        _avoImpl = impl_;\n    }\n\n    /// @notice Delegates the current call to `_avoImpl` unless one of the view methods is called:\n    ///         `_avoImpl()` returns the address for `_avoImpl`, `_owner()` returns the first\n    ///         20 bytes of `_data`, `_data()` returns `_data`.\n    //\n    // @dev    Mostly based on OpenZeppelin Proxy.sol\n    // logic contract must not implement a function `_avoImpl()`, `_owner()` or  `_data()`\n    // as they will not be callable due to collision\n    fallback() external payable {\n        uint256 data_ = _data;\n        assembly {\n            let functionSelector_ := calldataload(0)\n\n            // 0xb2bdfa7b = function selector for _owner()\n            if eq(functionSelector_, 0xb2bdfa7b00000000000000000000000000000000000000000000000000000000) {\n                // store address owner at memory address 0x0, loading only last 20 bytes through the & mask\n                mstore(0, and(data_, 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff))\n                return(0, 0x20) // send 32 bytes of memory slot 0 as return value\n            }\n\n            // 0x68beab3f = function selector for _data()\n            if eq(functionSelector_, 0x68beab3f00000000000000000000000000000000000000000000000000000000) {\n                mstore(0, data_) // store uint256 _data at memory address 0x0\n                return(0, 0x20) // send 32 bytes of memory slot 0 as return value\n            }\n\n            // load address avoImpl_ from storage\n            let avoImpl_ := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n\n            // first 4 bytes of calldata specify which function to call.\n            // if those first 4 bytes == 874095c6 (function selector for _avoImpl()) then we return the _avoImpl address\n            // The value is right padded to 32-bytes with 0s\n            if eq(functionSelector_, 0x874095c600000000000000000000000000000000000000000000000000000000) {\n                mstore(0, avoImpl_) // store address avoImpl_ at memory address 0x0\n                return(0, 0x20) // send 32 bytes of memory slot 0 as return value\n            }\n\n            // @dev code below is taken from OpenZeppelin Proxy.sol _delegate function\n\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(), avoImpl_, 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"
      },
      "contracts/AvocadoMultisig/AvocadoMultisig.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\nimport { IERC1271 } from \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\n\nimport { IAvoRegistry } from \"../interfaces/IAvoRegistry.sol\";\nimport { IAvoSignersList } from \"../interfaces/IAvoSignersList.sol\";\nimport { IAvocadoMultisigV1Base } from \"../interfaces/IAvocadoMultisigV1.sol\";\nimport { IAvocadoMultisigV1Secondary, IAvocadoMultisigV1SecondaryConstants } from \"../interfaces/IAvocadoMultisigV1Secondary.sol\";\nimport { IAvocado } from \"../Avocado.sol\";\nimport { IAvoConfigV1 } from \"../interfaces/IAvoConfigV1.sol\";\nimport { AvocadoMultisigBase, AvocadoMultisigCore } from \"./AvocadoMultisigCore.sol\";\n\n// --------------------------- DEVELOPER NOTES -----------------------------------------\n// @dev IMPORTANT: all storage variables go into AvocadoMultisigVariables.sol\n// -------------------------------------------------------------------------------------\n\n// empty interface used for Natspec docs for nice layout in automatically generated docs:\n//\n/// @title  AvocadoMultisig v1.1.0\n/// @notice Smart wallet enabling meta transactions through multiple EIP712 signatures (Multisig n out of m).\n///\n/// Supports:\n/// - Executing arbitrary actions\n/// - Receiving NFTs (ERC721)\n/// - Receiving ERC1155 tokens\n/// - ERC1271 smart contract signatures\n/// - Instadapp Flashloan callbacks\n/// - chain-agnostic signatures, user can sign once for execution of actions on different chains.\n///\n/// The `cast` method allows the AvoForwarder (relayer) to execute multiple arbitrary actions authorized by signature.\n///\n/// Broadcasters are expected to call the AvoForwarder contract `execute()` method, which also automatically\n/// deploys an AvocadoMultisig if necessary first.\n///\n/// Upgradeable by calling `upgradeTo` through a `cast` / `castAuthorized` call.\n///\n/// The `castAuthorized` method allows the signers of the wallet to execute multiple arbitrary actions with signatures\n/// without the AvoForwarder in between, to guarantee the smart wallet is truly non-custodial.\n///\n/// _@dev Notes:_\n/// - This contract implements parts of EIP-2770 in a minimized form. E.g. domainSeparator is immutable etc.\n/// - This contract does not implement ERC2771, because trusting an upgradeable \"forwarder\" bears a security\n/// risk for this non-custodial wallet.\n/// - Signature related logic is based off of OpenZeppelin EIP712Upgradeable.\n/// - All signatures are validated for defaultChainId of `634` instead of `block.chainid` from opcode (EIP-1344).\n/// - For replay protection, the current `block.chainid` instead is used in the EIP-712 salt.\ninterface AvocadoMultisig_V1 {}\n\n/// @dev Simple contract to upgrade the implementation address stored at storage slot 0x0.\n///      Mostly based on OpenZeppelin ERC1967Upgrade contract, adapted with onlySelf etc.\n///      IMPORTANT: For any new implementation, the upgrade method MUST be in the implementation itself,\n///      otherwise it can not be upgraded anymore!\nabstract contract AvocadoMultisigSelfUpgradeable is AvocadoMultisigCore {\n    /// @notice upgrade the contract to a new implementation address.\n    ///         - Must be a valid version at the AvoRegistry.\n    ///         - Can only be self-called (authorization same as for `cast` methods).\n    /// @param avoImplementation_       New contract address\n    /// @param afterUpgradeHookData_    flexible bytes for custom usage in after upgrade hook logic\n    //\n    // Implementation must call `_afterUpgradeHook()`\n    function upgradeTo(address avoImplementation_, bytes calldata afterUpgradeHookData_) public onlySelf {\n        _spell(address(avoSecondary), msg.data);\n    }\n\n    /// @notice hook called after executing an upgrade from previous `fromImplementation_`, with flexible bytes `data_`\n    function _afterUpgradeHook(address fromImplementation_, bytes calldata data_) public virtual onlySelf {}\n}\n\nabstract contract AvocadoMultisigProtected is AvocadoMultisigCore {\n    /***********************************|\n    |             ONLY SELF             |\n    |__________________________________*/\n\n    /// @notice occupies the sequential `avoNonces_` in storage. This can be used to cancel / invalidate\n    ///         a previously signed request(s) because the nonce will be \"used\" up.\n    ///         - Can only be self-called (authorization same as for `cast` methods).\n    /// @param  avoNonces_ sequential ascending ordered nonces to be occupied in storage.\n    ///         E.g. if current AvoNonce is 77 and txs are queued with avoNonces 77, 78 and 79,\n    ///         then you would submit [78, 79] here because 77 will be occupied by the tx executing\n    ///         `occupyAvoNonces()` as an action itself. If executing via non-sequential nonces, you would\n    ///         submit [77, 78, 79].\n    ///         - Maximum array length is 5.\n    ///         - gap from the current avoNonce will revert (e.g. [79, 80] if current one is 77)\n    function occupyAvoNonces(uint88[] calldata avoNonces_) external onlySelf {\n        _spell(address(avoSecondary), msg.data);\n    }\n\n    /// @notice occupies the `nonSequentialNonces_` in storage. This can be used to cancel / invalidate\n    ///         previously signed request(s) because the nonce will be \"used\" up.\n    ///         - Can only be self-called (authorization same as for `cast` methods).\n    /// @param  nonSequentialNonces_ the non-sequential nonces to occupy\n    function occupyNonSequentialNonces(bytes32[] calldata nonSequentialNonces_) external onlySelf {\n        _spell(address(avoSecondary), msg.data);\n    }\n\n    /***********************************|\n    |         FLASHLOAN CALLBACK        |\n    |__________________________________*/\n\n    /// @dev                    callback used by Instadapp Flashloan Aggregator, executes operations while owning\n    ///                         the flashloaned amounts. `data_` must contain actions, one of them must pay back flashloan\n    // /// @param assets_       assets_ received a flashloan for\n    // /// @param amounts_      flashloaned amounts for each asset\n    // /// @param premiums_     fees to pay for the flashloan\n    /// @param initiator_       flashloan initiator -> must be this contract\n    /// @param data_            data bytes containing the `abi.encoded()` actions that are executed like in `CastParams.actions`\n    function executeOperation(\n        address[] calldata /*  assets_ */,\n        uint256[] calldata /*  amounts_ */,\n        uint256[] calldata /*  premiums_ */,\n        address initiator_,\n        bytes calldata data_\n    ) external returns (bool) {\n        // @dev using the valid case inverted via one ! to optimize gas usage\n        // data_ includes id and actions\n        if (\n            !(_transientAllowHash ==\n                bytes31(keccak256(abi.encode(data_, block.timestamp, EXECUTE_OPERATION_SELECTOR))) &&\n                initiator_ == address(this))\n        ) {\n            revert AvocadoMultisig__Unauthorized();\n        }\n\n        // get and reset transient id\n        uint256 id_ = uint256(_transientId);\n        _transientId = 0;\n\n        if (tx.origin == 0x000000000000000000000000000000000000dEaD) {\n            // tx origin 0x000000000000000000000000000000000000dEaD used for backend gas estimations -> forward to simulate\n            _spell(\n                address(avoSecondary),\n                abi.encodeCall(avoSecondary._simulateExecuteActions, (abi.decode(data_, (Action[])), id_, true))\n            );\n        } else {\n            // decode actions to be executed after getting the flashloan and id_ packed into the data_\n            _executeActions(abi.decode(data_, (Action[])), id_, true);\n        }\n\n        return true;\n    }\n\n    /***********************************|\n    |         INDIRECT INTERNAL         |\n    |__________________________________*/\n\n    /// @dev             executes a low-level .call or .delegateCall on all `actions_`.\n    ///                  Can only be self-called by this contract under certain conditions, essentially internal method.\n    ///                  This is called like an external call to create a separate execution frame.\n    ///                  This way we can revert all the `actions_` if one fails without reverting the whole transaction.\n    /// @param actions_  the actions to execute (target, data, value, operation)\n    /// @param id_       id for `actions_`, see `CastParams.id`\n    function _callTargets(Action[] calldata actions_, uint256 id_) external payable {\n        if (tx.origin == 0x000000000000000000000000000000000000dEaD) {\n            // tx origin 0x000000000000000000000000000000000000dEaD used for backend gas estimations -> forward to simulate\n            _spell(address(avoSecondary), abi.encodeCall(avoSecondary._simulateExecuteActions, (actions_, id_, false)));\n        } else {\n            // _transientAllowHash must be set\n            if (\n                (_transientAllowHash !=\n                    bytes31(keccak256(abi.encode(actions_, id_, block.timestamp, _CALL_TARGETS_SELECTOR))))\n            ) {\n                revert AvocadoMultisig__Unauthorized();\n            }\n\n            _executeActions(actions_, id_, false);\n        }\n    }\n}\n\nabstract contract AvocadoMultisigEIP1271 is AvocadoMultisigCore {\n    /// @inheritdoc IERC1271\n    /// @param signature This can be one of the following:\n    ///         - empty: `hash` must be a previously signed message in storage then.\n    ///         - 65 bytes: owner signature for a Multisig with only owner as signer (requiredSigners = 1, signers=[owner]).\n    ///         - a multiple of 85 bytes, through grouping of 65 bytes signature + 20 bytes signer address each.\n    ///           To signal decoding this way, the signature bytes must be prefixed with `0xDEC0DE6520`.\n    ///         - the `abi.encode` result for `SignatureParams` struct array.\n    /// @dev reverts with `AvocadoMultisig__InvalidEIP1271Signature` or `AvocadoMultisig__InvalidParams` if signature is invalid.\n    /// @dev input `message_` is hashed with `domainSeparatorV4()` according to EIP712 typed data (`EIP1271_TYPE_HASH`)\n    function isValidSignature(\n        bytes32 hash,\n        bytes calldata signature\n    ) external view override returns (bytes4 magicValue) {\n        // hashing with domain separator mitigates any potential replaying on other networks or other Avocados of the same owner\n        hash = ECDSA.toTypedDataHash(\n            _domainSeparatorV4(\n                DOMAIN_SEPARATOR_SALT_HASHED // includes block.chainid\n            ),\n            keccak256(abi.encode(EIP1271_TYPE_HASH, hash))\n        );\n\n        // @dev function params without _ for inheritdoc\n        if (signature.length == 0) {\n            // must be pre-allow-listed via `signMessage` method\n            if (_signedMessages[hash] != 1) {\n                revert AvocadoMultisig__InvalidEIP1271Signature();\n            }\n        } else {\n            (bool validSignature_, ) = _verifySig(\n                hash,\n                // decode signaturesParams_ from bytes signature\n                avoSecondary.decodeEIP1271Signature(signature, IAvocado(address(this))._owner()),\n                // we have no way to know nonce type, so make sure validity test covers everything.\n                // setting this flag true will check that the digest is not a used non-sequential nonce.\n                // unfortunately, for sequential nonces it adds unneeded verification and gas cost,\n                // because the check will always pass, but there is no way around it.\n                true\n            );\n            if (!validSignature_) {\n                revert AvocadoMultisig__InvalidEIP1271Signature();\n            }\n        }\n\n        return EIP1271_MAGIC_VALUE;\n    }\n\n    /// @notice Marks a bytes32 `message_` (signature digest) as signed, making it verifiable by EIP-1271 `isValidSignature()`.\n    ///         - Can only be self-called (authorization same as for `cast` methods).\n    /// @param message_ data hash to be allow-listed as signed\n    /// @dev input `message_` is hashed with `domainSeparatorV4()` according to EIP712 typed data (`EIP1271_TYPE_HASH`)\n    function signMessage(bytes32 message_) external onlySelf {\n        _spell(address(avoSecondary), msg.data);\n    }\n\n    /// @notice Removes a previously `signMessage()` signed bytes32 `message_` (signature digest).\n    ///         - Can only be self-called (authorization same as for `cast` methods).\n    /// @param message_ data hash to be removed from allow-listed signatures\n    function removeSignedMessage(bytes32 message_) external onlySelf {\n        _spell(address(avoSecondary), msg.data);\n    }\n}\n\nabstract contract AvocadoMultisigSigners is AvocadoMultisigCore {\n    /// @notice adds `addSigners_` to allowed signers and sets required signers count to `requiredSigners_`\n    /// Note the `addSigners_` to be added must:\n    ///     - NOT be duplicates (already present in current allowed signers)\n    ///     - NOT be the zero address\n    ///     - be sorted ascending\n    function addSigners(address[] calldata addSigners_, uint8 requiredSigners_) external onlySelf {\n        _spell(address(avoSecondary), msg.data);\n    }\n\n    /// @notice removes `removeSigners_` from allowed signers and sets required signers count to `requiredSigners_`\n    /// Note the `removeSigners_` to be removed must:\n    ///     - NOT be the owner\n    ///     - be sorted ascending\n    ///     - be present in current allowed signers\n    function removeSigners(address[] calldata removeSigners_, uint8 requiredSigners_) external onlySelf {\n        _spell(address(avoSecondary), msg.data);\n    }\n\n    /// @notice sets number of required signers for a valid request to `requiredSigners_`\n    function setRequiredSigners(uint8 requiredSigners_) external onlySelf {\n        _spell(address(avoSecondary), msg.data);\n    }\n}\n\nabstract contract AvocadoMultisigCast is AvocadoMultisigCore {\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function getSigDigest(\n        CastParams memory params_,\n        CastForwardParams memory forwardParams_\n    ) public view returns (bytes32) {\n        return _getSigDigest(params_, forwardParams_);\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function verify(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] calldata signaturesParams_\n    ) external view returns (bool) {\n        _validateParams(\n            params_.actions.length,\n            params_.avoNonce,\n            forwardParams_.validAfter,\n            forwardParams_.validUntil,\n            forwardParams_.value\n        );\n\n        _verifySigWithRevert(_getSigDigest(params_, forwardParams_), signaturesParams_, params_.avoNonce == -1);\n\n        return true;\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function cast(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] memory signaturesParams_\n    ) external payable returns (bool success_, string memory revertReason_) {\n        return _cast(params_, forwardParams_, signaturesParams_, new ChainAgnosticHash[](0));\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function simulateCast(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] memory signaturesParams_\n    ) external payable returns (bool success_, string memory revertReason_) {\n        return _simulateCast(params_, forwardParams_, signaturesParams_, new ChainAgnosticHash[](0), false);\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function estimateCast(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] memory signaturesParams_\n    ) external payable returns (bool success_, string memory revertReason_) {\n        return _simulateCast(params_, forwardParams_, signaturesParams_, new ChainAgnosticHash[](0), true);\n    }\n}\n\nabstract contract AvocadoMultisigCastChainAgnostic is AvocadoMultisigCore {\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function castChainAgnostic(\n        CastChainAgnosticParams calldata params_,\n        SignatureParams[] memory signaturesParams_,\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) external payable returns (bool success_, string memory revertReason_) {\n        if (params_.chainId != block.chainid) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        return _cast(params_.params, params_.forwardParams, signaturesParams_, chainAgnosticHashes_);\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function getChainAgnosticHashes(\n        CastChainAgnosticParams[] calldata params_\n    ) public pure returns (ChainAgnosticHash[] memory chainAgnosticHashes_) {\n        uint256 length_ = params_.length;\n        if (length_ < 2) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n        chainAgnosticHashes_ = new ChainAgnosticHash[](length_);\n        for (uint256 i; i < length_; ) {\n            chainAgnosticHashes_[i] = ChainAgnosticHash(\n                _castChainAgnosticParamsHash(params_[i].params, params_[i].forwardParams, params_[i].chainId),\n                params_[i].chainId\n            );\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function getSigDigestChainAgnostic(CastChainAgnosticParams[] calldata params_) public view returns (bytes32) {\n        return _getSigDigestChainAgnostic(getChainAgnosticHashes(params_));\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function getSigDigestChainAgnosticFromHashes(\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) public view returns (bytes32) {\n        return _getSigDigestChainAgnostic(chainAgnosticHashes_);\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function verifyChainAgnostic(\n        CastChainAgnosticParams calldata params_,\n        SignatureParams[] calldata signaturesParams_,\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) public view returns (bool) {\n        if (params_.chainId != block.chainid) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        _validateParams(\n            params_.params.actions.length,\n            params_.params.avoNonce,\n            params_.forwardParams.validAfter,\n            params_.forwardParams.validUntil,\n            params_.forwardParams.value\n        );\n\n        _validateChainAgnostic(\n            _castChainAgnosticParamsHash(params_.params, params_.forwardParams, block.chainid),\n            chainAgnosticHashes_\n        );\n\n        _verifySigWithRevert(\n            _getSigDigestChainAgnostic(chainAgnosticHashes_),\n            signaturesParams_,\n            params_.params.avoNonce == -1\n        );\n\n        return true;\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function simulateCastChainAgnostic(\n        CastChainAgnosticParams calldata params_,\n        SignatureParams[] memory signaturesParams_,\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) external payable returns (bool success_, string memory revertReason_) {\n        if (params_.chainId != block.chainid) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        return _simulateCast(params_.params, params_.forwardParams, signaturesParams_, chainAgnosticHashes_, false);\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function estimateCastChainAgnostic(\n        CastChainAgnosticParams calldata params_,\n        SignatureParams[] memory signaturesParams_,\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) external payable returns (bool success_, string memory revertReason_) {\n        if (params_.chainId != block.chainid) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        return _simulateCast(params_.params, params_.forwardParams, signaturesParams_, chainAgnosticHashes_, true);\n    }\n}\n\nabstract contract AvocadoMultisigCastAuthorized is AvocadoMultisigCore {\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function getSigDigestAuthorized(\n        CastParams memory params_,\n        CastAuthorizedParams memory authorizedParams_\n    ) public view returns (bytes32) {\n        return _getSigDigestAuthorized(params_, authorizedParams_);\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function verifyAuthorized(\n        CastParams calldata params_,\n        CastAuthorizedParams calldata authorizedParams_,\n        SignatureParams[] calldata signaturesParams_\n    ) external view returns (bool) {\n        // make sure actions are defined and nonce is valid\n        _validateParams(\n            params_.actions.length,\n            params_.avoNonce,\n            authorizedParams_.validAfter,\n            authorizedParams_.validUntil,\n            0 // no value param in authorized interaction\n        );\n\n        _verifySigWithRevert(\n            _getSigDigestAuthorized(params_, authorizedParams_),\n            signaturesParams_,\n            params_.avoNonce == -1\n        );\n\n        return true;\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function castAuthorized(\n        CastParams calldata params_,\n        CastAuthorizedParams calldata authorizedParams_,\n        SignatureParams[] memory signaturesParams_\n    ) external payable returns (bool success_, string memory revertReason_) {\n        uint256 gasSnapshot_ = gasleft();\n\n        // make sure actions are defined and nonce is valid\n        _validateParams(\n            params_.actions.length,\n            params_.avoNonce,\n            authorizedParams_.validAfter,\n            authorizedParams_.validUntil,\n            0 // no value param in authorized interaction\n        );\n\n        bytes32 digest_ = _getSigDigestAuthorized(params_, authorizedParams_);\n        address[] memory signers_ = _verifySigWithRevert(digest_, signaturesParams_, params_.avoNonce == -1);\n\n        (success_, revertReason_) = _executeCast(\n            params_,\n            _dynamicReserveGas(CAST_AUTHORIZED_RESERVE_GAS, signers_.length, params_.metadata.length),\n            params_.avoNonce == -1 ? digest_ : bytes32(0)\n        );\n\n        // @dev on changes in the code below this point, measure the needed reserve gas via `gasleft()` anew\n        // and update reserve gas constant amounts\n        if (success_) {\n            emit CastExecuted(params_.source, msg.sender, signers_, params_.metadata);\n        } else {\n            emit CastFailed(params_.source, msg.sender, signers_, revertReason_, params_.metadata);\n        }\n\n        // @dev `_payAuthorizedFee()` costs ~24.5k gas for if a fee is configured and maxFee is set\n        _spell(\n            address(avoSecondary),\n            abi.encodeCall(avoSecondary.payAuthorizedFee, (gasSnapshot_, authorizedParams_.maxFee))\n        );\n        // @dev ending point for measuring reserve gas should be here. Also see comment in `AvocadoMultisigCore._executeCast()`\n    }\n}\n\ncontract AvocadoMultisig is\n    AvocadoMultisigBase,\n    AvocadoMultisigCore,\n    AvocadoMultisigSelfUpgradeable,\n    AvocadoMultisigProtected,\n    AvocadoMultisigEIP1271,\n    AvocadoMultisigSigners,\n    AvocadoMultisigCast,\n    AvocadoMultisigCastAuthorized,\n    AvocadoMultisigCastChainAgnostic\n{\n    /***********************************|\n    |    CONSTRUCTOR / INITIALIZERS     |\n    |__________________________________*/\n\n    /// @notice                        constructor sets multiple immutable values for contracts and payFee fallback logic.\n    /// @param avoRegistry_            address of the avoRegistry (proxy) contract\n    /// @param avoForwarder_           address of the avoForwarder (proxy) contract\n    ///                                to forward tx with valid signatures. must be valid version in AvoRegistry.\n    /// @param avoSignersList_         address of the AvoSignersList (proxy) contract\n    /// @param avoConfigV1_            AvoConfigV1 contract holding values for authorizedFee values\n    /// @param secondary_              AvocadoMultisigSecondary contract for extended logic\n    constructor(\n        IAvoRegistry avoRegistry_,\n        address avoForwarder_,\n        IAvoSignersList avoSignersList_,\n        IAvoConfigV1 avoConfigV1_,\n        IAvocadoMultisigV1Secondary secondary_\n    ) AvocadoMultisigBase(avoRegistry_, avoForwarder_, avoSignersList_, avoConfigV1_) AvocadoMultisigCore(secondary_) {\n        // sanity checks to ensure all immutables are configured with same values on AvoSecondary\n        if (\n            address(IAvocadoMultisigV1SecondaryConstants(address(secondary_)).avoRegistry()) != address(avoRegistry_) ||\n            IAvocadoMultisigV1SecondaryConstants(address(secondary_)).avoForwarder() != avoForwarder_ ||\n            address(IAvocadoMultisigV1SecondaryConstants(address(secondary_)).avoSignersList()) !=\n            address(avoSignersList_) ||\n            IAvocadoMultisigV1SecondaryConstants(address(secondary_)).AUTHORIZED_MIN_FEE() != AUTHORIZED_MIN_FEE ||\n            IAvocadoMultisigV1SecondaryConstants(address(secondary_)).AUTHORIZED_MAX_FEE() != AUTHORIZED_MAX_FEE ||\n            IAvocadoMultisigV1SecondaryConstants(address(secondary_)).AUTHORIZED_FEE_COLLECTOR() !=\n            AUTHORIZED_FEE_COLLECTOR\n        ) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function initialize() public initializer {\n        _spell(address(avoSecondary), msg.data);\n    }\n\n    /***********************************|\n    |            PUBLIC API             |\n    |__________________________________*/\n\n    receive() external payable {}\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function domainSeparatorV4() public view returns (bytes32) {\n        return\n            _domainSeparatorV4(\n                DOMAIN_SEPARATOR_SALT_HASHED // includes block.chainid\n            );\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function domainSeparatorV4ChainAgnostic() public view returns (bytes32) {\n        return\n            _domainSeparatorV4(\n                DOMAIN_SEPARATOR_CHAIN_AGNOSTIC_SALT_HASHED // includes default chain id (634)\n            );\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function isSigner(address signer_) public view returns (bool) {\n        address[] memory allowedSigners_ = _getSigners(); // includes owner\n\n        uint256 allowedSignersLength_ = allowedSigners_.length;\n        for (uint256 i; i < allowedSignersLength_; ) {\n            if (allowedSigners_[i] == signer_) {\n                return true;\n            }\n\n            unchecked {\n                ++i;\n            }\n        }\n\n        return false;\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function signers() public view returns (address[] memory signers_) {\n        return _getSigners();\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function requiredSigners() public view returns (uint8) {\n        return _getRequiredSigners();\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function signersCount() public view returns (uint8) {\n        return _getSignersCount();\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function owner() public view returns (address) {\n        return IAvocado(address(this))._owner();\n    }\n\n    /// @inheritdoc IAvocadoMultisigV1Base\n    function index() public view returns (uint32) {\n        return uint32(IAvocado(address(this))._data() >> 160);\n    }\n\n    /// @notice incrementing nonce for each valid tx executed (to ensure uniqueness)\n    function avoNonce() public view returns (uint256) {\n        return uint256(_avoNonce);\n    }\n}\n"
      },
      "contracts/AvocadoMultisig/AvocadoMultisigCore.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\nimport { Strings } from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport { ERC721Holder } from \"@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol\";\nimport { IERC1271 } from \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\nimport { ERC1155Holder } from \"@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol\";\n\nimport { InstaFlashReceiverInterface } from \"../external/InstaFlashReceiverInterface.sol\";\nimport { IAvoRegistry } from \"../interfaces/IAvoRegistry.sol\";\nimport { IAvoSignersList } from \"../interfaces/IAvoSignersList.sol\";\nimport { IAvocadoMultisigV1Base } from \"../interfaces/IAvocadoMultisigV1.sol\";\nimport { IAvocadoMultisigV1Secondary } from \"../interfaces/IAvocadoMultisigV1Secondary.sol\";\nimport { IAvoConfigV1 } from \"../interfaces/IAvoConfigV1.sol\";\nimport { IAvocado } from \"../Avocado.sol\";\nimport { AvocadoMultisigErrors } from \"./AvocadoMultisigErrors.sol\";\nimport { AvocadoMultisigEvents } from \"./AvocadoMultisigEvents.sol\";\nimport { AvocadoMultisigVariables } from \"./AvocadoMultisigVariables.sol\";\nimport { AvocadoMultisigInitializable } from \"./lib/AvocadoMultisigInitializable.sol\";\nimport { AvocadoMultisigStructs } from \"./AvocadoMultisigStructs.sol\";\nimport { AvocadoMultisigProtected } from \"./AvocadoMultisig.sol\";\n\n/// @dev AvocadoMultisigBase contains all internal helper and base state needed for AvocadoMultisig main AND\n///      secondary contract logic.\nabstract contract AvocadoMultisigBase is\n    AvocadoMultisigErrors,\n    AvocadoMultisigEvents,\n    AvocadoMultisigVariables,\n    AvocadoMultisigStructs,\n    AvocadoMultisigInitializable\n{\n    /***********************************|\n    |    CONSTRUCTOR / INITIALIZERS     |\n    |__________________________________*/\n\n    constructor(\n        IAvoRegistry avoRegistry_,\n        address avoForwarder_,\n        IAvoSignersList avoSignersList_,\n        IAvoConfigV1 avoConfigV1_\n    ) AvocadoMultisigVariables(avoRegistry_, avoForwarder_, avoSignersList_, avoConfigV1_) {\n        // Ensure logic contract initializer is not abused by disabling initializing\n        // see https://forum.openzeppelin.com/t/security-advisory-initialize-uups-implementation-contracts/15301\n        // and https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#initializing_the_implementation_contract\n        _disableInitializers();\n    }\n\n    /***********************************|\n    |               INTERNAL            |\n    |__________________________________*/\n\n    /// @dev returns the dynamic reserve gas to be kept back for emitting the CastExecuted or CastFailed event\n    function _dynamicReserveGas(\n        uint256 fixedReserveGas_,\n        uint256 signersCount_,\n        uint256 metadataLength_\n    ) internal pure returns (uint256 reserveGas_) {\n        unchecked {\n            // the gas usage for the emitting the CastExecuted/CastFailed events depends on the signers count\n            // the cost per signer is PER_SIGNER_RESERVE_GAS. We calculate this dynamically to ensure\n            // enough reserve gas is reserved in Multisigs with a higher signersCount.\n            // same for metadata bytes length, dynamically calculated with cost per byte for emit event\n            reserveGas_ =\n                fixedReserveGas_ +\n                (PER_SIGNER_RESERVE_GAS * signersCount_) +\n                (EMIT_EVENT_COST_PER_BYTE * metadataLength_);\n        }\n    }\n\n    /// @dev Returns the domain separator for the chain with id `DEFAULT_CHAIN_ID` and `salt_`\n    function _domainSeparatorV4(bytes32 salt_) internal view returns (bytes32) {\n        return\n            keccak256(\n                abi.encode(\n                    TYPE_HASH,\n                    DOMAIN_SEPARATOR_NAME_HASHED,\n                    DOMAIN_SEPARATOR_VERSION_HASHED,\n                    DEFAULT_CHAIN_ID,\n                    address(this),\n                    salt_\n                )\n            );\n    }\n\n    /// @dev returns the EIP712 `CAST_PARAMS_TYPE_HASH` hash for `params_`.\n    function _castParamsHash(CastParams memory params_) internal pure returns (bytes32) {\n        // get keccak256s for actions\n        uint256 actionsLength_ = params_.actions.length;\n        bytes memory actionsAbiEncodePacked_;\n        for (uint256 i; i < actionsLength_; ) {\n            actionsAbiEncodePacked_ = abi.encodePacked(\n                actionsAbiEncodePacked_,\n                keccak256(\n                    abi.encode(\n                        ACTION_TYPE_HASH,\n                        params_.actions[i].target,\n                        keccak256(params_.actions[i].data),\n                        params_.actions[i].value,\n                        params_.actions[i].operation\n                    )\n                )\n            );\n\n            unchecked {\n                ++i;\n            }\n        }\n\n        return\n            keccak256(\n                abi.encode(\n                    CAST_PARAMS_TYPE_HASH,\n                    // actions[]\n                    keccak256(actionsAbiEncodePacked_),\n                    params_.id,\n                    params_.avoNonce,\n                    params_.salt,\n                    params_.source,\n                    keccak256(params_.metadata)\n                )\n            );\n    }\n\n    /// @dev returns the EIP712 `CAST_FORWARD_PARAMS_TYPE_HASH` hash for `forwardParams_`.\n    function _castForwardParamsHash(CastForwardParams memory forwardParams_) internal pure returns (bytes32) {\n        return\n            keccak256(\n                abi.encode(\n                    CAST_FORWARD_PARAMS_TYPE_HASH,\n                    forwardParams_.gas,\n                    forwardParams_.gasPrice,\n                    forwardParams_.validAfter,\n                    forwardParams_.validUntil,\n                    forwardParams_.value\n                )\n            );\n    }\n\n    /// @dev returns the EIP712 `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH` hash for `params_`, `forwardParams_`, `chainId_`.\n    function _castChainAgnosticParamsHash(\n        CastParams memory params_,\n        CastForwardParams memory forwardParams_,\n        uint256 chainId_\n    ) internal pure returns (bytes32) {\n        return\n            keccak256(\n                abi.encode(\n                    CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH,\n                    _castParamsHash(params_),\n                    _castForwardParamsHash(forwardParams_),\n                    chainId_\n                )\n            );\n    }\n\n    /// @dev                        gets the digest (hash) used to verify an EIP712 signature for `chainAgnosticHashes_`.\n    /// @param chainAgnosticHashes_ EIP712 type hashes of `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH` struct for all `CastChainAgnosticParams`\n    ///                             struct array elements as used when creating the signature. Result of `getChainAgnosticHashes()`.\n    ///                             must be set in the same order as when creating the signature.\n    /// @return                     bytes32 digest e.g. for signature or non-sequential nonce\n    function _getSigDigestChainAgnostic(\n        ChainAgnosticHash[] memory chainAgnosticHashes_\n    ) internal view returns (bytes32) {\n        uint256 length_ = chainAgnosticHashes_.length;\n\n        bytes memory hashesAbiEncodePacked_;\n        bytes memory chainIdsAbiEncodePacked_;\n        for (uint256 i; i < length_; ) {\n            hashesAbiEncodePacked_ = abi.encodePacked(hashesAbiEncodePacked_, chainAgnosticHashes_[i].hash);\n            chainIdsAbiEncodePacked_ = abi.encodePacked(chainIdsAbiEncodePacked_, chainAgnosticHashes_[i].chainId);\n\n            unchecked {\n                ++i;\n            }\n        }\n\n        return\n            ECDSA.toTypedDataHash(\n                // domain separator without chain id as salt for chain agnofstic actions (chain id is in signed params instead)\n                _domainSeparatorV4(\n                    DOMAIN_SEPARATOR_CHAIN_AGNOSTIC_SALT_HASHED // includes default chain id (634)\n                ),\n                // structHash according to CAST_CHAIN_AGNOSTIC_TYPE_HASH\n                keccak256(\n                    abi.encode(\n                        CAST_CHAIN_AGNOSTIC_TYPE_HASH,\n                        // hash for castChainAgnostic() params[]\n                        keccak256(hashesAbiEncodePacked_),\n                        // Note: chain ids must be included in this hash here to guarantee input params for the ChainAgnosticHashes\n                        // struct array at e.g. castChainAgnostic() are valid. Otherwise, chainIds for the non-current chain could\n                        // be passed in wrongly there.\n                        keccak256(chainIdsAbiEncodePacked_)\n                    )\n                )\n            );\n    }\n\n    /// @dev                     gets the digest (hash) used to verify an EIP712 signature for `forwardParams_`\n    /// @param params_           Cast params such as id, avoNonce and actions to execute\n    /// @param forwardParams_    Cast params related to validity of forwarding as instructed and signed\n    /// @return                  bytes32 digest e.g. for signature or non-sequential nonce\n    function _getSigDigest(\n        CastParams memory params_,\n        CastForwardParams memory forwardParams_\n    ) internal view returns (bytes32) {\n        return\n            ECDSA.toTypedDataHash(\n                // domain separator\n                _domainSeparatorV4(\n                    DOMAIN_SEPARATOR_SALT_HASHED // includes block.chainid\n                ),\n                // structHash according to CAST_TYPE_HASH\n                keccak256(abi.encode(CAST_TYPE_HASH, _castParamsHash(params_), _castForwardParamsHash(forwardParams_)))\n            );\n    }\n\n    /// @dev                          Verifies a EIP712 signature, returning valid status in `isValid_` or reverting\n    ///                               in case the params for the signatures / digest are wrong\n    /// @param digest_                the EIP712 digest for the signature\n    /// @param signaturesParams_      SignatureParams structs array for signature and signer:\n    ///                               - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                                 For smart contract signatures it must fulfill the requirements for the relevant\n    ///                                 smart contract `.isValidSignature()` EIP1271 logic\n    ///                               - signer: address of the signature signer.\n    ///                                 Must match the actual signature signer or refer to the smart contract\n    ///                                 that must be an allowed signer and validates signature via EIP1271\n    /// @param  isNonSequentialNonce_ flag to signal verify with non sequential nonce or not\n    /// @return isValid_              true if the signature is valid, false otherwise\n    /// @return recoveredSigners_     recovered valid signer addresses of the signatures. In case that `isValid_` is\n    ///                               false, the last element in the array with a value is the invalid signer\n    function _verifySig(\n        bytes32 digest_,\n        SignatureParams[] memory signaturesParams_,\n        bool isNonSequentialNonce_\n    ) internal view returns (bool isValid_, address[] memory recoveredSigners_) {\n        // gas measurements:\n        // cost until the for loop in verify signature is:\n        // 1 signer 3374 (_getSigners() with only owner is cheaper)\n        // 2 signers 6473\n        // every additional allowedSigner (!) + 160 gas (additional SSTORE2 load cost)\n        // For non-sequential nonce additional cold SLOAD + check cost is ~2200\n        // dynamic cost for verifying any additional signer ~6900\n        // So formula:\n        // Avoado signersCount == 1 ? -> 11_000 gas\n        // Avoado signersCount > 1 ? -> 6400  + allowedSignersCount * 160 + signersLength * 6900\n        // is non Sequential nonce? + 2200\n        // is smart contract signer? + buffer amount. A very basic ECDSA verify call like with e.g. MockSigner costs ~9k.\n        uint256 signaturesLength_ = signaturesParams_.length;\n\n        if (\n            // enough signatures must be submitted to reach quorom of `requiredSigners`\n            signaturesLength_ < _getRequiredSigners() ||\n            // for non sequential nonce, if nonce is already used, the signature has already been used and is invalid\n            (isNonSequentialNonce_ && nonSequentialNonces[digest_] == 1)\n        ) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        // fill recovered signers array for use in event emit\n        recoveredSigners_ = new address[](signaturesLength_);\n\n        // get current signers from storage\n        address[] memory allowedSigners_ = _getSigners(); // includes owner\n        uint256 allowedSignersLength_ = allowedSigners_.length;\n        // track last allowed signer index for loop performance improvements\n        uint256 lastAllowedSignerIndex_ = 0;\n\n        bool isContract_ = false; // keeping this variable outside the loop so it is not re-initialized in each loop -> cheaper\n        bool isAllowedSigner_ = false;\n        for (uint256 i; i < signaturesLength_; ) {\n            if (Address.isContract(signaturesParams_[i].signer)) {\n                recoveredSigners_[i] = signaturesParams_[i].signer;\n                // set flag that the signer is a contract so we don't have to check again in code below\n                isContract_ = true;\n            } else {\n                // recover signer from signature\n                recoveredSigners_[i] = ECDSA.recover(digest_, signaturesParams_[i].signature);\n\n                if (signaturesParams_[i].signer != recoveredSigners_[i]) {\n                    // signer does not match recovered signer. Either signer param is wrong or params used to\n                    // build digest are not the same as for the signature\n                    revert AvocadoMultisig__InvalidParams();\n                }\n            }\n\n            // because signers in storage and signers from signatures input params must be ordered ascending,\n            // the for loop can be optimized each new cycle to start from the position where the last signer\n            // has been found.\n            // this also ensures that input params signers must be ordered ascending off-chain\n            // (which again is used to improve performance and simplifies ensuring unique signers)\n            for (uint256 j = lastAllowedSignerIndex_; j < allowedSignersLength_; ) {\n                if (allowedSigners_[j] == recoveredSigners_[i]) {\n                    isAllowedSigner_ = true;\n                    unchecked {\n                        lastAllowedSignerIndex_ = j + 1; // set to j+1 so that next cycle starts at next array position\n                    }\n                    break;\n                }\n\n                // could be optimized by checking if allowedSigners_[j] > recoveredSigners_[i]\n                // and immediately skipping with a `break;` if so. Because that implies that the recoveredSigners_[i]\n                // can not be present in allowedSigners_ due to ascending sort.\n                // But that would optimize the failing invalid case and increase cost for the default case where\n                // the input data is valid -> skip.\n\n                unchecked {\n                    ++j;\n                }\n            }\n\n            // validate if signer is allowed\n            if (!isAllowedSigner_) {\n                return (false, recoveredSigners_);\n            } else {\n                // reset `isAllowedSigner_` for next loop\n                isAllowedSigner_ = false;\n            }\n\n            if (isContract_) {\n                // validate as smart contract signature\n                if (\n                    IERC1271(signaturesParams_[i].signer).isValidSignature(digest_, signaturesParams_[i].signature) !=\n                    EIP1271_MAGIC_VALUE\n                ) {\n                    // return value is not EIP1271_MAGIC_VALUE -> smart contract returned signature is invalid\n                    return (false, recoveredSigners_);\n                }\n\n                // reset isContract for next loop (because defined outside of the loop to save gas)\n                isContract_ = false;\n            }\n            // else already everything validated through recovered signer must be an allowed signer etc. in logic above\n\n            unchecked {\n                ++i;\n            }\n        }\n\n        return (true, recoveredSigners_);\n    }\n\n    /// @dev                          Verifies a EIP712 signature, reverting if it is not valid.\n    /// @param digest_                the EIP712 digest for the signature\n    /// @param signaturesParams_      SignatureParams structs array for signature and signer:\n    ///                               - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                                 For smart contract signatures it must fulfill the requirements for the relevant\n    ///                                 smart contract `.isValidSignature()` EIP1271 logic\n    ///                               - signer: address of the signature signer.\n    ///                                 Must match the actual signature signer or refer to the smart contract\n    ///                                 that must be an allowed signer and validates signature via EIP1271\n    /// @param  isNonSequentialNonce_ flag to signal verify with non sequential nonce or not\n    /// @return recoveredSigners_     recovered valid signer addresses of the signatures. In case that `isValid_` is\n    ///                               false, the last element in the array with a value is the invalid signer\n    function _verifySigWithRevert(\n        bytes32 digest_,\n        SignatureParams[] memory signaturesParams_,\n        bool isNonSequentialNonce_\n    ) internal view returns (address[] memory recoveredSigners_) {\n        bool validSignature_;\n        (validSignature_, recoveredSigners_) = _verifySig(digest_, signaturesParams_, isNonSequentialNonce_);\n\n        // signature must be valid\n        if (!validSignature_) {\n            revert AvocadoMultisig__InvalidSignature();\n        }\n    }\n}\n\n/// @dev AvocadoMultisigCore contains all internal helper and base state needed for AvocadoMultisig.sol main logic\nabstract contract AvocadoMultisigCore is\n    AvocadoMultisigBase,\n    ERC721Holder,\n    ERC1155Holder,\n    InstaFlashReceiverInterface,\n    IAvocadoMultisigV1Base,\n    IERC1271\n{\n    IAvocadoMultisigV1Secondary public immutable avoSecondary;\n\n    constructor(IAvocadoMultisigV1Secondary secondary_) {\n        if (address(secondary_) == address(0)) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        avoSecondary = secondary_;\n    }\n\n    /// @dev ensures the method can only be called by the same contract itself.\n    modifier onlySelf() {\n        _requireSelfCalled();\n        _;\n    }\n\n    /// @dev internal method for modifier logic to reduce bytecode size of contract.\n    function _requireSelfCalled() internal view {\n        if (msg.sender != address(this)) {\n            revert AvocadoMultisig__Unauthorized();\n        }\n    }\n\n    /// @dev method used to trigger a delegatecall with `data_` to `target_`.\n    function _spell(address target_, bytes memory data_) internal returns (bytes memory response_) {\n        assembly {\n            let succeeded := delegatecall(gas(), target_, add(data_, 0x20), mload(data_), 0, 0)\n            let size := returndatasize()\n\n            response_ := mload(0x40)\n            mstore(0x40, add(response_, and(add(add(size, 0x20), 0x1f), not(0x1f))))\n            mstore(response_, size)\n            returndatacopy(add(response_, 0x20), 0, size)\n\n            switch iszero(succeeded)\n            case 1 {\n                // throw if delegatecall failed\n                returndatacopy(0x00, 0x00, size)\n                revert(0x00, size)\n            }\n        }\n    }\n\n    /// @dev executes multiple cast actions according to CastParams `params_`, reserving `reserveGas_` in this contract.\n    /// Uses a sequential nonce unless `nonSequentialNonce_` is set.\n    /// @return success_ boolean flag indicating whether all actions have been executed successfully.\n    /// @return revertReason_ if `success_` is false, then revert reason is returned as string here.\n    function _executeCast(\n        CastParams calldata params_,\n        uint256 reserveGas_,\n        bytes32 nonSequentialNonce_\n    ) internal returns (bool success_, string memory revertReason_) {\n        // set allowHash to signal allowed entry into _callTargets with actions in current block only\n        _transientAllowHash = bytes31(\n            keccak256(abi.encode(params_.actions, params_.id, block.timestamp, _CALL_TARGETS_SELECTOR))\n        );\n\n        // nonce must be used *always* if signature is valid\n        if (nonSequentialNonce_ == bytes32(0)) {\n            // use sequential nonce, already validated in `_validateParams()`\n            _avoNonce++;\n        } else {\n            // use non-sequential nonce, already validated in `_verifySig()`\n            nonSequentialNonces[nonSequentialNonce_] = 1;\n        }\n\n        // execute _callTargets via a low-level call to create a separate execution frame\n        // this is used to revert all the actions if one action fails without reverting the whole transaction\n        bytes memory calldata_ = abi.encodeCall(AvocadoMultisigProtected._callTargets, (params_.actions, params_.id));\n        bytes memory result_;\n        unchecked {\n            if (gasleft() < reserveGas_ + 150) {\n                // catch out of gas issues when available gas does not even cover reserveGas\n                // -> immediately return with out of gas. + 150 to cover sload, sub etc.\n                _resetTransientStorage();\n                return (false, \"AVO__OUT_OF_GAS\");\n            }\n        }\n        // using inline assembly for delegatecall to define custom gas amount that should stay here in caller\n        assembly {\n            success_ := delegatecall(\n                // reserve some gas to make sure we can emit CastFailed event even for out of gas cases\n                // and execute fee paying logic for `castAuthorized()`.\n                // if gasleft() is less than the amount wanted to be sent along, sub would overflow and send all gas\n                // that's why there is the explicit check a few lines up.\n                sub(gas(), reserveGas_),\n                // load _avoImpl from slot 0 and explicitly convert to address with bit mask\n                and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff),\n                add(calldata_, 0x20),\n                mload(calldata_),\n                0,\n                0\n            )\n            let size := returndatasize()\n\n            result_ := mload(0x40)\n            mstore(0x40, add(result_, and(add(add(size, 0x20), 0x1f), not(0x1f))))\n            mstore(result_, size)\n            returndatacopy(add(result_, 0x20), 0, size)\n        }\n\n        // @dev starting point for measuring reserve gas should be here right after actions execution.\n        // on changes in code after execution (below here or below `_executeCast()` call in calling method),\n        // measure the needed reserve gas via `gasleft()` anew and update `CAST_AUTHORIZED_RESERVE_GAS`\n        // and `CAST_EVENTS_RESERVE_GAS` accordingly. use a method that forces maximum logic execution,\n        // e.g. `castAuthorized()` with failing action.\n        // gas measurement currently: ~1400 gas for logic in this method below\n        if (!success_) {\n            if (result_.length == 0) {\n                if (gasleft() < reserveGas_ - 150) {\n                    // catch out of gas errors where not the action ran out of gas but the logic around execution\n                    // of the action itself. -150 to cover gas cost until here\n                    revertReason_ = \"AVO__OUT_OF_GAS\";\n                } else {\n                    // @dev this case might be caused by edge-case out of gas errors that we were unable to catch,\n                    // but could potentially also have other reasons\n                    revertReason_ = \"AVO__REASON_NOT_DEFINED\";\n                }\n            } else {\n                assembly {\n                    result_ := add(result_, 0x04)\n                }\n                revertReason_ = abi.decode(result_, (string));\n            }\n        }\n\n        // reset all transient variables to get the gas refund (4800)\n        _resetTransientStorage();\n    }\n\n    /// @dev handles failure of an action execution depending on error cause,\n    /// decoding and reverting with `result_` as reason string.\n    function _handleActionFailure(uint256 actionMinGasLeft_, uint256 i_, bytes memory result_) internal view {\n        if (gasleft() < actionMinGasLeft_) {\n            // action ran out of gas. can not add action index as that again might run out of gas. keep revert minimal\n            revert(\"AVO__OUT_OF_GAS\");\n        }\n        revert(string.concat(Strings.toString(i_), avoSecondary.getRevertReasonFromReturnedData(result_)));\n    }\n\n    function _simulateCast(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] memory signaturesParams_,\n        ChainAgnosticHash[] memory chainAgnosticHashes_,\n        bool estimate_\n    ) internal returns (bool success_, string memory revertReason_) {\n        if (\n            !(msg.sender == 0x000000000000000000000000000000000000dEaD ||\n                (msg.sender == avoForwarder && tx.origin == 0x000000000000000000000000000000000000dEaD))\n        ) {\n            // sender must be the allowed AvoForwarder and tx origin must be dead address,\n            // or msg.sender must be 0x000000000000000000000000000000000000dEaD directly.\n            revert AvocadoMultisig__Unauthorized();\n        }\n\n        (success_, revertReason_) = abi.decode(\n            _spell(\n                address(avoSecondary),\n                abi.encodeCall(\n                    avoSecondary.simulateCast,\n                    (params_, forwardParams_, signaturesParams_, chainAgnosticHashes_)\n                )\n            ),\n            (bool, string)\n        );\n\n        if (estimate_ && !success_) {\n            // on estimate, revert to get a more accurate gas estimation result.\n            revert(revertReason_);\n        }\n    }\n\n    /// @dev                        executes a cast process for `cast()` or `castChainAgnostic()`\n    /// @param params_              Cast params such as id, avoNonce and actions to execute\n    /// @param forwardParams_       Cast params related to validity of forwarding as instructed and signed\n    /// @param signaturesParams_    SignatureParams structs array for signature and signer:\n    ///                              - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                                For smart contract signatures it must fulfill the requirements for the relevant\n    ///                                smart contract `.isValidSignature()` EIP1271 logic\n    ///                              - signer: address of the signature signer.\n    ///                                Must match the actual signature signer or refer to the smart contract\n    ///                                that must be an allowed signer and validates signature via EIP1271\n    /// @param chainAgnosticHashes_ EIP712 type hashes of `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH` struct for all `CastChainAgnosticParams`\n    ///                             struct array elements as used when creating the signature. Result of `getChainAgnosticHashes()`.\n    ///                             must be set in the same order as when creating the signature.\n    /// @return success_            true if all actions were executed succesfully, false otherwise.\n    /// @return revertReason_       revert reason if one of the actions fails in the following format:\n    ///                             The revert reason will be prefixed with the index of the action.\n    ///                             e.g. if action 1 fails, then the reason will be \"1_reason\".\n    ///                             if an action in the flashloan callback fails (or an otherwise nested action),\n    ///                             it will be prefixed with with two numbers: \"1_2_reason\".\n    ///                             e.g. if action 1 is the flashloan, and action 2 of flashloan actions fails,\n    ///                             the reason will be 1_2_reason.\n    function _cast(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] memory signaturesParams_,\n        ChainAgnosticHash[] memory chainAgnosticHashes_\n    ) internal returns (bool success_, string memory revertReason_) {\n        if (msg.sender != avoForwarder) {\n            // sender must be the allowed AvoForwarder\n            revert AvocadoMultisig__Unauthorized();\n        }\n\n        unchecked {\n            // compare actual sent gas to user instructed gas, adding 500 to `gasleft()` for approx. already used gas\n            if ((gasleft() + 500) < forwardParams_.gas) {\n                // relayer has not sent enough gas to cover gas limit as user instructed.\n                // this error should not be blamed on the user but rather on the relayer\n                revert AvocadoMultisig__InsufficientGasSent();\n            }\n        }\n\n        // @dev gas measurement: uses maximum 685 gas when all params must be validated\n        _validateParams(\n            params_.actions.length,\n            params_.avoNonce,\n            forwardParams_.validAfter,\n            forwardParams_.validUntil,\n            forwardParams_.value\n        );\n\n        bytes32 digest_;\n        if (chainAgnosticHashes_.length > 0) {\n            // validate that input `CastParams` and `CastForwardParams` are present in `chainAgnosticHashes_`\n            _validateChainAgnostic(\n                _castChainAgnosticParamsHash(params_, forwardParams_, block.chainid),\n                chainAgnosticHashes_\n            );\n\n            digest_ = _getSigDigestChainAgnostic(chainAgnosticHashes_);\n        } else {\n            digest_ = _getSigDigest(params_, forwardParams_);\n        }\n\n        address[] memory signers_ = _verifySigWithRevert(digest_, signaturesParams_, params_.avoNonce == -1);\n\n        (success_, revertReason_) = _executeCast(\n            params_,\n            _dynamicReserveGas(CAST_EVENTS_RESERVE_GAS, signers_.length, params_.metadata.length),\n            params_.avoNonce == -1 ? digest_ : bytes32(0)\n        );\n\n        // @dev on changes in the code below this point, measure the needed reserve gas via `gasleft()` anew\n        // and update the reserve gas constant amounts.\n        // gas measurement currently: ~7500 gas for emit event with max revertReason length\n        if (success_) {\n            emit CastExecuted(params_.source, msg.sender, signers_, params_.metadata);\n        } else {\n            emit CastFailed(params_.source, msg.sender, signers_, revertReason_, params_.metadata);\n        }\n        // @dev ending point for measuring reserve gas should be here. Also see comment in `AvocadoMultisigCore._executeCast()`\n    }\n\n    /// @dev executes `actions_` with respective target, calldata, operation etc.\n    /// IMPORTANT: Validation of `id_` and `_transientAllowHash` is expected to happen in `executeOperation()` and `_callTargets()`.\n    /// catches out of gas errors (as well as possible), reverting with `AVO__OUT_OF_GAS`.\n    /// reverts with action index + error code in case of failure (e.g. \"1_SOME_ERROR\").\n    function _executeActions(Action[] memory actions_, uint256 id_, bool isFlashloanCallback_) internal {\n        // reset _transientAllowHash immediately to avert reentrancy etc. & get the gas refund (4800)\n        _resetTransientStorage();\n\n        uint256 storageSlot0Snapshot_; // avoImpl, nonce, initialized vars\n        uint256 storageSlot1Snapshot_; // signers related variables\n        // delegate call = ids 1 and 21\n        bool isDelegateCallId_ = id_ == 1 || id_ == 21;\n        if (isDelegateCallId_) {\n            // store values before execution to make sure core storage vars are not modified by a delegatecall.\n            // this ensures the smart wallet does not end up in a corrupted state.\n            // for mappings etc. it is hard to protect against storage changes, so we must rely on the owner / signer\n            // to know what is being triggered and the effects of a tx\n            assembly {\n                storageSlot0Snapshot_ := sload(0x0) // avoImpl, nonce & initialized vars\n                storageSlot1Snapshot_ := sload(0x1) // signers related variables\n            }\n        }\n\n        uint256 actionsLength_ = actions_.length;\n        for (uint256 i; i < actionsLength_; ) {\n            Action memory action_ = actions_[i];\n\n            // execute action\n            bool success_;\n            bytes memory result_;\n            uint256 actionMinGasLeft_;\n            if (action_.operation == 0 && (id_ < 2 || id_ == 20 || id_ == 21)) {\n                // call (operation = 0 & id = call(0 / 20) or mixed(1 / 21))\n                unchecked {\n                    // store amount of gas that stays with caller, according to EIP150 to detect out of gas errors\n                    // -> as close as possible to actual call\n                    actionMinGasLeft_ = gasleft() / 64;\n                }\n\n                // low-level call will return success true also if action target is not even a contract.\n                // we do not explicitly check for this, default interaction is via UI which can check and handle this.\n                // Also applies to delegatecall etc.\n                (success_, result_) = action_.target.call{ value: action_.value }(action_.data);\n\n                // handle action failure right after external call to better detect out of gas errors\n                if (!success_) {\n                    _handleActionFailure(actionMinGasLeft_, i, result_);\n                }\n            } else if (action_.operation == 1 && isDelegateCallId_) {\n                // delegatecall (operation = 1 & id = mixed(1 / 21))\n                unchecked {\n                    // store amount of gas that stays with caller, according to EIP150 to detect out of gas errors\n                    // -> as close as possible to actual call\n                    actionMinGasLeft_ = gasleft() / 64;\n                }\n\n                (success_, result_) = action_.target.delegatecall(action_.data);\n\n                // handle action failure right after external call to better detect out of gas errors\n                if (!success_) {\n                    _handleActionFailure(actionMinGasLeft_, i, result_);\n                }\n\n                // reset _transientAllowHash to make sure it can not be set up in any way for reentrancy\n                _resetTransientStorage();\n\n                // for delegatecall, make sure storage was not modified. After every action, to also defend reentrancy\n                uint256 storageSlot0_;\n                uint256 storageSlot1_;\n                assembly {\n                    storageSlot0_ := sload(0x0) // avoImpl, nonce & initialized vars\n                    storageSlot1_ := sload(0x1) // signers related variables\n                }\n\n                if (!(storageSlot0_ == storageSlot0Snapshot_ && storageSlot1_ == storageSlot1Snapshot_)) {\n                    revert(string.concat(Strings.toString(i), \"_AVO__MODIFIED_STORAGE\"));\n                }\n            } else if (action_.operation == 2 && (id_ == 20 || id_ == 21)) {\n                // flashloan (operation = 2 & id = flashloan(20 / 21))\n                if (isFlashloanCallback_) {\n                    revert(string.concat(Strings.toString(i), \"_AVO__NO_FLASHLOAN_IN_FLASHLOAN\"));\n                }\n                // flashloan is always executed via .call, flashloan aggregator uses `msg.sender`, so .delegatecall\n                // wouldn't send funds to this contract but rather to the original sender.\n\n                bytes memory data_ = action_.data;\n                assembly {\n                    data_ := add(data_, 4) // Skip function selector (4 bytes)\n                }\n                // get actions data from calldata action_.data. Only supports InstaFlashAggregatorInterface\n                (, , , data_, ) = abi.decode(data_, (address[], uint256[], uint256, bytes, bytes));\n\n                // set allowHash to signal allowed entry into executeOperation()\n                _transientAllowHash = bytes31(\n                    keccak256(abi.encode(data_, block.timestamp, EXECUTE_OPERATION_SELECTOR))\n                );\n                // store id_ in transient storage slot\n                _transientId = uint8(id_);\n\n                unchecked {\n                    // store amount of gas that stays with caller, according to EIP150 to detect out of gas errors\n                    // -> as close as possible to actual call\n                    actionMinGasLeft_ = gasleft() / 64;\n                }\n\n                // handle action failure right after external call to better detect out of gas errors\n                (success_, result_) = action_.target.call{ value: action_.value }(action_.data);\n\n                if (!success_) {\n                    _handleActionFailure(actionMinGasLeft_, i, result_);\n                }\n\n                // reset _transientAllowHash to prevent reentrancy during actions execution\n                _resetTransientStorage();\n            } else {\n                // either operation does not exist or the id was not set according to what the action wants to execute\n                revert(string.concat(Strings.toString(i), \"_AVO__INVALID_ID_OR_OPERATION\"));\n            }\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /// @dev                   Validates input params, reverts on invalid values.\n    /// @param actionsLength_  the length of the actions array to execute\n    /// @param avoNonce_       the avoNonce from input CastParams\n    /// @param validAfter_     timestamp after which the request is valid\n    /// @param validUntil_     timestamp before which the request is valid\n    /// @param value_          the msg.value expected to be sent along\n    function _validateParams(\n        uint256 actionsLength_,\n        int256 avoNonce_,\n        uint256 validAfter_,\n        uint256 validUntil_,\n        uint256 value_\n    ) internal view {\n        // make sure actions are defined and nonce is valid:\n        // must be -1 to use a non-sequential nonce or otherwise it must match the avoNonce\n        if (!(actionsLength_ > 0 && (avoNonce_ == -1 || uint256(avoNonce_) == _avoNonce))) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        // make sure request is within valid timeframe\n        if ((validAfter_ > block.timestamp) || (validUntil_ > 0 && validUntil_ < block.timestamp)) {\n            revert AvocadoMultisig__InvalidTiming();\n        }\n\n        // make sure msg.value matches `value_` (if set)\n        if (value_ > 0 && msg.value != value_) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n    }\n\n    /// @dev Validates input params for `castChainAgnostic`: verifies that the `curCastChainAgnosticHash_` is present in\n    ///      the `castChainAgnosticHashes_` array of hashes. Reverts with `AvocadoMultisig__InvalidParams` if not.\n    ///      Reverts with `AvocadoMultisig__ChainAgnosticChainMismatch` if the hash is present but valid for another chain.\n    function _validateChainAgnostic(\n        bytes32 curCastChainAgnosticHash_,\n        ChainAgnosticHash[] memory castChainAgnosticHashes_\n    ) internal view {\n        uint256 length_ = castChainAgnosticHashes_.length;\n        // chain agnostic must be at least 2 hashes\n        if (length_ > 1) {\n            for (uint256 i; i < length_; ) {\n                if (\n                    curCastChainAgnosticHash_ == castChainAgnosticHashes_[i].hash &&\n                    block.chainid == castChainAgnosticHashes_[i].chainId\n                ) {\n                    // hash must be found, and must be for the current chain to be valid\n                    return;\n                }\n\n                unchecked {\n                    ++i;\n                }\n            }\n        }\n\n        // `_castChainAgnosticParamsHash()` of current input params is not present in castChainAgnosticHashes_ -> revert\n        revert AvocadoMultisig__InvalidParams();\n    }\n\n    /// @dev                      gets the digest (hash) used to verify an EIP712 signature for `authorizedParams_`\n    /// @param params_            Cast params such as id, avoNonce and actions to execute\n    /// @param authorizedParams_  Cast params related to execution through owner such as maxFee\n    /// @return                   bytes32 digest e.g. for signature or non-sequential nonce\n    function _getSigDigestAuthorized(\n        CastParams memory params_,\n        CastAuthorizedParams memory authorizedParams_\n    ) internal view returns (bytes32) {\n        return\n            ECDSA.toTypedDataHash(\n                // domain separator\n                _domainSeparatorV4(\n                    DOMAIN_SEPARATOR_SALT_HASHED // includes block.chainid\n                ),\n                // structHash according to CAST_AUTHORIZED_TYPE_HASH\n                keccak256(\n                    abi.encode(\n                        CAST_AUTHORIZED_TYPE_HASH,\n                        _castParamsHash(params_),\n                        // CastAuthorizedParams hash\n                        keccak256(\n                            abi.encode(\n                                CAST_AUTHORIZED_PARAMS_TYPE_HASH,\n                                authorizedParams_.maxFee,\n                                authorizedParams_.gasPrice,\n                                authorizedParams_.validAfter,\n                                authorizedParams_.validUntil\n                            )\n                        )\n                    )\n                )\n            );\n    }\n}\n"
      },
      "contracts/AvocadoMultisig/AvocadoMultisigErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\nabstract contract AvocadoMultisigErrors {\n    /// @notice thrown when a method is called with invalid params (e.g. a zero address as input param)\n    error AvocadoMultisig__InvalidParams();\n\n    /// @notice thrown when a signature is not valid (e.g. not signed by enough allowed signers)\n    error AvocadoMultisig__InvalidSignature();\n\n    /// @notice thrown when someone is trying to execute a in some way auth protected logic\n    error AvocadoMultisig__Unauthorized();\n\n    /// @notice thrown when forwarder/relayer does not send enough gas as the user has defined.\n    ///         this error should not be blamed on the user but rather on the relayer\n    error AvocadoMultisig__InsufficientGasSent();\n\n    /// @notice thrown when a signature has expired or when a request isn't valid yet\n    error AvocadoMultisig__InvalidTiming();\n\n    /// @notice thrown when _toHexDigit() fails\n    error AvocadoMultisig__ToHexDigit();\n\n    /// @notice thrown when an EIP1271 signature is invalid\n    error AvocadoMultisig__InvalidEIP1271Signature();\n\n    /// @notice thrown when a `castAuthorized()` `fee` is bigger than the `maxFee` given through the input param\n    error AvocadoMultisig__MaxFee(uint256 fee, uint256 maxFee);\n\n    /// @notice thrown when `castAuthorized()` fee can not be covered by available contract funds\n    error AvocadoMultisig__InsufficientBalance(uint256 fee);\n}\n"
      },
      "contracts/AvocadoMultisig/AvocadoMultisigEvents.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\nabstract contract AvocadoMultisigEvents {\n    /// @notice Emitted when the implementation is upgraded to a new logic contract\n    event Upgraded(address indexed newImplementation);\n\n    /// @notice Emitted when a message is marked as allowed smart contract signature\n    event SignedMessage(bytes32 indexed messageHash);\n\n    /// @notice Emitted when a previously allowed signed message is removed\n    event RemoveSignedMessage(bytes32 indexed messageHash);\n\n    /// @notice emitted when the avoNonce in storage is increased through an authorized call to\n    /// `occupyAvoNonces()`, which can be used to cancel a previously signed request\n    event AvoNonceOccupied(uint256 indexed occupiedAvoNonce);\n\n    /// @notice emitted when a non-sequential nonce is occupied in storage through an authorized call to\n    /// `useNonSequentialNonces()`, which can be used to cancel a previously signed request\n    event NonSequentialNonceOccupied(bytes32 indexed occupiedNonSequentialNonce);\n\n    /// @notice Emitted when a fee is paid through use of the `castAuthorized()` method\n    event FeePaid(uint256 indexed fee);\n\n    /// @notice Emitted when paying a fee reverts at the recipient\n    event FeePayFailed(uint256 indexed fee);\n\n    /// @notice emitted when syncing to the AvoSignersList fails\n    event ListSyncFailed();\n\n    /// @notice emitted when all actions are executed successfully.\n    /// caller = owner / AvoForwarder address. signers = addresses that triggered this execution\n    event CastExecuted(address indexed source, address indexed caller, address[] signers, bytes metadata);\n\n    /// @notice emitted if one of the executed actions fails. The reason will be prefixed with the index of the action.\n    /// e.g. if action 1 fails, then the reason will be 1_reason\n    /// if an action in the flashloan callback fails, it will be prefixed with with two numbers:\n    /// e.g. if action 1 is the flashloan, and action 2 of flashloan actions fails, the reason will be 1_2_reason.\n    /// caller = owner / AvoForwarder address. signers = addresses that triggered this execution\n    /// Note If the signature was invalid, the `signers` array last set element is the signer that caused the revert\n    event CastFailed(address indexed source, address indexed caller, address[] signers, string reason, bytes metadata);\n\n    /// @notice emitted when a signer is added as Multisig signer\n    event SignerAdded(address indexed signer);\n\n    /// @notice emitted when a signer is removed as Multisig signer\n    event SignerRemoved(address indexed signer);\n\n    /// @notice emitted when the required signers count is updated\n    event RequiredSignersSet(uint8 indexed requiredSigners);\n}\n"
      },
      "contracts/AvocadoMultisig/AvocadoMultisigStructs.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\ninterface AvocadoMultisigStructs {\n    /// @notice a combination of a bytes signature and its signer.\n    struct SignatureParams {\n        ///\n        /// @param signature ECDSA signature of `getSigDigest()` for default flow or EIP1271 smart contract signature\n        bytes signature;\n        ///\n        /// @param signer signer of the signature. Can be set to smart contract address that supports EIP1271\n        address signer;\n    }\n\n    /// @notice an arbitrary executable action\n    struct Action {\n        ///\n        /// @param target the target address to execute the action on\n        address target;\n        ///\n        /// @param data the calldata to be passed to the call for each target\n        bytes data;\n        ///\n        /// @param value the msg.value to be passed to the call for each target. set to 0 if none\n        uint256 value;\n        ///\n        /// @param operation type of operation to execute:\n        /// 0 -> .call; 1 -> .delegateCall, 2 -> flashloan (via .call)\n        uint256 operation;\n    }\n\n    /// @notice common params for both `cast()` and `castAuthorized()`\n    struct CastParams {\n        Action[] actions;\n        ///\n        /// @param id             Required:\n        ///                       id for actions, e.g. 0 = CALL, 1 = MIXED (call and delegatecall),\n        ///                                           20 = FLASHLOAN_CALL, 21 = FLASHLOAN_MIXED\n        uint256 id;\n        ///\n        /// @param avoNonce   Required:\n        ///                       avoNonce to be used for this tx. Must equal the avoNonce value on smart\n        ///                       wallet or alternatively it must be set to -1 to use a non-sequential nonce instead\n        int256 avoNonce;\n        ///\n        /// @param salt           Optional:\n        ///                       Salt to customize non-sequential nonce (if `avoNonce` is set to -1)\n        bytes32 salt;\n        ///\n        /// @param source         Optional:\n        ///                       Source / referral for this tx\n        address source;\n        ///\n        /// @param metadata       Optional:\n        ///                       metadata for any potential additional data to be tracked in the tx\n        bytes metadata;\n    }\n\n    /// @notice `cast()` input params related to forwarding validity\n    struct CastForwardParams {\n        ///\n        /// @param gas            Optional:\n        ///                       As EIP-2770: user instructed minimum amount of gas that the relayer (AvoForwarder)\n        ///                       must send for the execution. Sending less gas will fail the tx at the cost of the relayer.\n        ///                       Also protects against potential gas griefing attacks\n        ///                       See https://ronan.eth.limo/blog/ethereum-gas-dangers/\n        uint256 gas;\n        ///\n        /// @param gasPrice       Optional:\n        ///                       Not implemented / used yet\n        uint256 gasPrice;\n        ///\n        /// @param validAfter     Optional:\n        ///                       the earliest block timestamp that the request can be forwarded in,\n        ///                       or 0 if the request is not time-limited to occur after a certain time.\n        ///                       Protects against relayers executing a certain transaction at an earlier moment\n        ///                       not intended by the user, where it might have a completely different effect.\n        uint256 validAfter;\n        ///\n        /// @param validUntil     Optional:\n        ///                       Similar to EIP-2770: the latest block timestamp (instead of block number) the request\n        ///                       can be forwarded, or 0 if request should be valid forever.\n        ///                       Protects against relayers executing a certain transaction at a later moment\n        ///                       not intended by the user, where it might have a completely different effect.\n        uint256 validUntil;\n        ///\n        /// @param value          Optional:\n        ///                       Not implemented / used yet (`msg.value` amount the broadcaster should send along)\n        uint256 value;\n    }\n\n    /// @notice `castAuthorized()` input params\n    struct CastAuthorizedParams {\n        ///\n        /// @param maxFee         Optional:\n        ///                       the maximum Avocado charge-up allowed to be paid for tx execution\n        uint256 maxFee;\n        ///\n        /// @param gasPrice       Optional:\n        ///                       Not implemented / used yet\n        uint256 gasPrice;\n        ///\n        /// @param validAfter     Optional:\n        ///                       the earliest block timestamp that the request can be forwarded in,\n        ///                       or 0 if the request is not time-limited to occur after a certain time.\n        ///                       Protects against relayers executing a certain transaction at an earlier moment\n        ///                       not intended by the user, where it might have a completely different effect.\n        uint256 validAfter;\n        ///\n        /// @param validUntil     Optional:\n        ///                       Similar to EIP-2770: the latest block timestamp (instead of block number) the request\n        ///                       can be forwarded, or 0 if request should be valid forever.\n        ///                       Protects against relayers executing a certain transaction at a later moment\n        ///                       not intended by the user, where it might have a completely different effect.\n        uint256 validUntil;\n    }\n\n    /// @notice params for `castChainAgnostic()` to be used when casting txs on multiple chains with one signature\n    struct CastChainAgnosticParams {\n        ///\n        /// @param params cast params containing actions to be executed etc.\n        CastParams params;\n        ///\n        /// @param forwardParams params related to forwarding validity\n        CastForwardParams forwardParams;\n        ///\n        /// @param chainId chainId where these actions are valid\n        uint256 chainId;\n    }\n\n    /// @notice unique chain agnostic hash with chain id to be used for chain agnostic interactions\n    struct ChainAgnosticHash {\n        ///\n        /// @param hash EIP712 type `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH` hash for one specific `CastChainAgnosticParams` struct\n        bytes32 hash;\n        ///\n        /// @param chainId chainId where this `hash` is for\n        uint256 chainId;\n    }\n}\n"
      },
      "contracts/AvocadoMultisig/AvocadoMultisigVariables.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\nimport { SSTORE2 } from \"solmate/src/utils/SSTORE2.sol\";\n\nimport { IAvoRegistry } from \"../interfaces/IAvoRegistry.sol\";\nimport { IAvoSignersList } from \"../interfaces/IAvoSignersList.sol\";\nimport { IAvoConfigV1 } from \"../interfaces/IAvoConfigV1.sol\";\nimport { IAvocado } from \"../Avocado.sol\";\nimport { AvocadoMultisigErrors } from \"./AvocadoMultisigErrors.sol\";\nimport { AvocadoMultisigEvents } from \"./AvocadoMultisigEvents.sol\";\n\nabstract contract AvocadoMultisigConstants is AvocadoMultisigErrors {\n    /************************************|\n    |               CONSTANTS            |\n    |___________________________________*/\n\n    /// @notice overwrite chain id for EIP712 is always set to 634 for the Avocado RPC / network\n    uint256 public constant DEFAULT_CHAIN_ID = 634;\n\n    // constants for EIP712 values\n    string public constant DOMAIN_SEPARATOR_NAME = \"Avocado-Multisig\";\n    string public constant DOMAIN_SEPARATOR_VERSION = \"1.1.0\";\n    // hashed EIP712 values\n    bytes32 internal constant DOMAIN_SEPARATOR_NAME_HASHED = keccak256(bytes(DOMAIN_SEPARATOR_NAME));\n    bytes32 internal constant DOMAIN_SEPARATOR_VERSION_HASHED = keccak256(bytes(DOMAIN_SEPARATOR_VERSION));\n\n    /// @notice _TYPE_HASH is copied from OpenZeppelin EIP712 but with added salt as last param (we use it for `block.chainid`)\n    bytes32 public constant TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)\");\n\n    /// @notice EIP712 typehash for `cast()` calls, including structs\n    bytes32 public constant CAST_TYPE_HASH =\n        keccak256(\n            \"Cast(CastParams params,CastForwardParams forwardParams)Action(address target,bytes data,uint256 value,uint256 operation)CastForwardParams(uint256 gas,uint256 gasPrice,uint256 validAfter,uint256 validUntil,uint256 value)CastParams(Action[] actions,uint256 id,int256 avoNonce,bytes32 salt,address source,bytes metadata)\"\n        );\n\n    /// @notice EIP712 typehash for Action struct\n    bytes32 public constant ACTION_TYPE_HASH =\n        keccak256(\"Action(address target,bytes data,uint256 value,uint256 operation)\");\n\n    /// @notice EIP712 typehash for CastParams struct\n    bytes32 public constant CAST_PARAMS_TYPE_HASH =\n        keccak256(\n            \"CastParams(Action[] actions,uint256 id,int256 avoNonce,bytes32 salt,address source,bytes metadata)Action(address target,bytes data,uint256 value,uint256 operation)\"\n        );\n    /// @notice EIP712 typehash for CastForwardParams struct\n    bytes32 public constant CAST_FORWARD_PARAMS_TYPE_HASH =\n        keccak256(\n            \"CastForwardParams(uint256 gas,uint256 gasPrice,uint256 validAfter,uint256 validUntil,uint256 value)\"\n        );\n\n    /// @notice EIP712 typehash for `castAuthorized()` calls, including structs\n    bytes32 public constant CAST_AUTHORIZED_TYPE_HASH =\n        keccak256(\n            \"CastAuthorized(CastParams params,CastAuthorizedParams authorizedParams)Action(address target,bytes data,uint256 value,uint256 operation)CastAuthorizedParams(uint256 maxFee,uint256 gasPrice,uint256 validAfter,uint256 validUntil)CastParams(Action[] actions,uint256 id,int256 avoNonce,bytes32 salt,address source,bytes metadata)\"\n        );\n    /// @notice EIP712 typehash for CastAuthorizedParams struct\n    bytes32 public constant CAST_AUTHORIZED_PARAMS_TYPE_HASH =\n        keccak256(\"CastAuthorizedParams(uint256 maxFee,uint256 gasPrice,uint256 validAfter,uint256 validUntil)\");\n\n    /// @notice EIP712 typehash for `castChainAgnostic()` calls, bytes32 hashes array + chainId, made up of `getSigDigest()` for\n    ///         action on the respective chain.\n    bytes32 public constant CAST_CHAIN_AGNOSTIC_TYPE_HASH =\n        keccak256(\n            \"CastChainAgnostic(CastChainAgnosticParams[] params,uint256[] chainIds)Action(address target,bytes data,uint256 value,uint256 operation)CastChainAgnosticParams(CastParams params,CastForwardParams forwardParams,uint256 chainId)CastForwardParams(uint256 gas,uint256 gasPrice,uint256 validAfter,uint256 validUntil,uint256 value)CastParams(Action[] actions,uint256 id,int256 avoNonce,bytes32 salt,address source,bytes metadata)\"\n        );\n    /// @notice EIP712 typehash for CastChainAgnosticParams struct\n    bytes32 public constant CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH =\n        keccak256(\n            \"CastChainAgnosticParams(CastParams params,CastForwardParams forwardParams,uint256 chainId)Action(address target,bytes data,uint256 value,uint256 operation)CastForwardParams(uint256 gas,uint256 gasPrice,uint256 validAfter,uint256 validUntil,uint256 value)CastParams(Action[] actions,uint256 id,int256 avoNonce,bytes32 salt,address source,bytes metadata)\"\n        );\n\n    /// @notice EIP712 typehash for signed hashes used for EIP1271 (`isValidSignature()`)\n    bytes32 public constant EIP1271_TYPE_HASH = keccak256(\"AvocadoHash(bytes32 hash)\");\n\n    /// @notice defines the max signers count for the Multisig. This is chosen deliberately very high, as there shouldn't\n    /// really be a limit on signers count in practice. It is extremely unlikely that anyone runs into this very high\n    /// limit but it helps to implement test coverage within this given limit\n    uint256 public constant MAX_SIGNERS_COUNT = 90;\n\n    /// @dev \"magic value\" according to EIP1271 https://eips.ethereum.org/EIPS/eip-1271#specification\n    bytes4 internal constant EIP1271_MAGIC_VALUE = 0x1626ba7e;\n\n    /// @dev constants for _transientAllowHash functionality: function selectors\n    bytes4 internal constant _CALL_TARGETS_SELECTOR = bytes4(keccak256(bytes(\"_callTargets()\")));\n    bytes4 internal constant EXECUTE_OPERATION_SELECTOR = bytes4(keccak256(bytes(\"executeOpeartion()\")));\n\n    /// @dev amount of gas to keep in castAuthorized caller method as reserve for emitting event + paying fee.\n    /// the dynamic part is covered with PER_SIGNER_RESERVE_GAS.\n    /// use 48_500 as reserve gas for `castAuthorized()`. Usually it will cost less but 48_500 is the maximum amount\n    /// with buffer (~32_000 + 1_400 base) pay fee logic etc. could cost on maximum logic execution.\n    uint256 internal constant CAST_AUTHORIZED_RESERVE_GAS = 48_500;\n    /// @dev amount of gas to keep in cast caller method as reserve for emitting CastFailed / CastExecuted event.\n    /// ~7500 gas + ~1400 gas + buffer. the dynamic part is covered with PER_SIGNER_RESERVE_GAS and EMIT_EVENT_COST_PER_BYTE.\n    uint256 internal constant CAST_EVENTS_RESERVE_GAS = 10_000;\n\n    /// @dev emitting one byte in an event costs 8 byte see https://github.com/wolflo/evm-opcodes/blob/main/gas.md#a8-log-operations\n    uint256 internal constant EMIT_EVENT_COST_PER_BYTE = 8;\n\n    /// @dev maximum length of revert reason, longer will be truncated. necessary to reserve enugh gas for event emit\n    uint256 internal constant REVERT_REASON_MAX_LENGTH = 250;\n\n    /// @dev each additional signer costs ~358 gas to emit in the CastFailed / CastExecuted event. this amount must be\n    /// factored in dynamically depending on the number of signers (PER_SIGNER_RESERVE_GAS * number of signers)\n    uint256 internal constant PER_SIGNER_RESERVE_GAS = 370;\n\n    /************************************|\n    |             IMMUTABLES             |\n    |___________________________________*/\n    // hashed EIP712 value to reduce gas usage\n    bytes32 internal immutable DOMAIN_SEPARATOR_SALT_HASHED = keccak256(abi.encodePacked(block.chainid));\n    // hashed EIP712 value to reduce gas usage\n    bytes32 internal immutable DOMAIN_SEPARATOR_CHAIN_AGNOSTIC_SALT_HASHED =\n        keccak256(abi.encodePacked(DEFAULT_CHAIN_ID));\n\n    /// @notice  registry holding the valid versions (addresses) for Avocado smart wallet implementation contracts\n    ///          The registry is used to verify a valid version before upgrading & to pay fees for `castAuthorized()`\n    IAvoRegistry public immutable avoRegistry;\n\n    /// @notice address of the AvoForwarder (proxy) that is allowed to forward tx with valid signatures\n    address public immutable avoForwarder;\n\n    /// @notice Signers <> Avocados mapping list contract for easy on-chain tracking\n    IAvoSignersList public immutable avoSignersList;\n\n    // @dev Note that AvocadoMultisig.sol (main) also has an immutable for avoSecondary in AvocadoMultisigCore.sol\n\n    // backup fee logic\n    /// @dev minimum fee for fee charged via `castAuthorized()` to charge if `AvoRegistry.calcFee()` would fail\n    uint256 public immutable AUTHORIZED_MIN_FEE;\n    /// @dev global maximum for fee charged via `castAuthorized()`. If AvoRegistry returns a fee higher than this,\n    /// then MAX_AUTHORIZED_FEE is charged as fee instead (capping)\n    uint256 public immutable AUTHORIZED_MAX_FEE;\n    /// @dev address that the fee charged via `castAuthorized()` is sent to in the fallback case\n    address payable public immutable AUTHORIZED_FEE_COLLECTOR;\n\n    /***********************************|\n    |            CONSTRUCTOR            |\n    |__________________________________*/\n\n    constructor(\n        IAvoRegistry avoRegistry_,\n        address avoForwarder_,\n        IAvoSignersList avoSignersList_,\n        IAvoConfigV1 avoConfigV1_\n    ) {\n        if (\n            address(avoRegistry_) == address(0) ||\n            avoForwarder_ == address(0) ||\n            address(avoSignersList_) == address(0) ||\n            address(avoConfigV1_) == address(0)\n        ) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        avoRegistry = avoRegistry_;\n        avoForwarder = avoForwarder_;\n        avoSignersList = avoSignersList_;\n\n        // get values from AvoConfigV1 contract\n        IAvoConfigV1.AvocadoMultisigConfig memory avoConfig_ = avoConfigV1_.avocadoMultisigConfig();\n\n        // min & max fee settings, fee collector address are required\n        if (\n            avoConfig_.authorizedMinFee == 0 ||\n            avoConfig_.authorizedMaxFee == 0 ||\n            avoConfig_.authorizedFeeCollector == address(0) ||\n            avoConfig_.authorizedMinFee > avoConfig_.authorizedMaxFee\n        ) {\n            revert AvocadoMultisig__InvalidParams();\n        }\n\n        AUTHORIZED_MIN_FEE = avoConfig_.authorizedMinFee;\n        AUTHORIZED_MAX_FEE = avoConfig_.authorizedMaxFee;\n        AUTHORIZED_FEE_COLLECTOR = payable(avoConfig_.authorizedFeeCollector);\n    }\n}\n\nabstract contract AvocadoMultisigVariablesSlot0 {\n    /// @notice address of the smart wallet logic / implementation contract.\n    //  @dev    IMPORTANT: SAME STORAGE SLOT AS FOR PROXY (`Avocado`). DO NOT MOVE THIS VARIABLE.\n    //         _avoImpl MUST ALWAYS be the first declared variable here in the logic contract and in the proxy!\n    //         When upgrading, the storage at memory address 0x0 is upgraded (first slot).\n    //         Note immutable and constants do not take up storage slots so they can come before.\n    address internal _avoImpl;\n\n    /// @dev nonce that is incremented for every `cast` / `castAuthorized` transaction (unless it uses a non-sequential nonce)\n    uint80 internal _avoNonce;\n\n    /// @dev AvocadoMultisigInitializable.sol variables (modified from OpenZeppelin), see ./lib folder\n    /// @dev Indicates that the contract has been initialized.\n    uint8 internal _initialized;\n    /// @dev Indicates that the contract is in the process of being initialized.\n    bool internal _initializing;\n}\n\nabstract contract AvocadoMultisigVariablesSlot1 is AvocadoMultisigConstants, AvocadoMultisigEvents {\n    /// @dev signers are stored with SSTORE2 to save gas, especially for storage checks at delegateCalls.\n    /// getter and setter are implemented below\n    address internal _signersPointer;\n\n    /// @notice signers count required to reach quorom and be able to execute actions\n    uint8 internal _requiredSigners;\n\n    /// @notice number of signers currently listed as allowed signers\n    //\n    // @dev should be updated directly via `_setSigners()` in AvocadoMultisigSecondary\n    uint8 internal _signersCount;\n\n    // 10 bytes empty\n\n    /***********************************|\n    |           SIGNERS GETTERS         |\n    |__________________________________*/\n\n    /// @dev reads signers from storage with SSTORE2\n    function _getSigners() internal view returns (address[] memory signers_) {\n        address pointer_ = _signersPointer;\n        if (pointer_ == address(0)) {\n            // signers not set yet -> only owner is signer currently.\n            signers_ = new address[](1);\n            signers_[0] = IAvocado(address(this))._owner();\n            return signers_;\n        }\n\n        return abi.decode(SSTORE2.read(pointer_), (address[]));\n    }\n\n    /// @dev reads required signers (and returns 1 if it is not set)\n    function _getRequiredSigners() internal view returns (uint8 requiredSigners_) {\n        requiredSigners_ = _requiredSigners;\n        if (requiredSigners_ == 0) {\n            requiredSigners_ = 1;\n        }\n    }\n\n    /// @dev reads signers count (and returns 1 if it is not set)\n    function _getSignersCount() internal view returns (uint8 signersCount_) {\n        signersCount_ = _signersCount;\n        if (signersCount_ == 0) {\n            signersCount_ = 1;\n        }\n    }\n}\n\nabstract contract AvocadoMultisigVariablesSlot2 {\n    /// @dev allow-listed signed messages, e.g. for Permit2 Uniswap interaction.\n    /// mappings are not in sequential storage slot, thus not influenced by previous storage variables\n    /// (but consider the slot number in calculating the hash of the key to store).\n    mapping(bytes32 => uint256) internal _signedMessages;\n}\n\nabstract contract AvocadoMultisigVariablesSlot3 {\n    /// @notice occupied non-sequential nonces (which can not be used again)\n    mapping(bytes32 => uint256) public nonSequentialNonces;\n}\n\nabstract contract AvocadoMultisigSlotGaps {\n    // slots 4 to 53\n\n    // create some storage slot gaps for future expansion before the transient storage slot\n    uint256[50] private __gaps;\n}\n\nabstract contract AvocadoMultisigTransient {\n    // slot 54\n\n    /// @dev transient allow hash used to signal allowing certain entry into methods such as _callTargets etc.\n    bytes31 internal _transientAllowHash;\n    /// @dev transient id used for passing id to flashloan callback\n    uint8 internal _transientId;\n}\n\n/// @notice Defines storage variables for AvocadoMultisig\nabstract contract AvocadoMultisigVariables is\n    AvocadoMultisigConstants,\n    AvocadoMultisigVariablesSlot0,\n    AvocadoMultisigVariablesSlot1,\n    AvocadoMultisigVariablesSlot2,\n    AvocadoMultisigVariablesSlot3,\n    AvocadoMultisigSlotGaps,\n    AvocadoMultisigTransient\n{\n    constructor(\n        IAvoRegistry avoRegistry_,\n        address avoForwarder_,\n        IAvoSignersList avoSignersList_,\n        IAvoConfigV1 avoConfigV1_\n    ) AvocadoMultisigConstants(avoRegistry_, avoForwarder_, avoSignersList_, avoConfigV1_) {}\n\n    /// @dev resets transient storage to default value (1). 1 is better than 0 for optimizing gas refunds\n    function _resetTransientStorage() internal {\n        assembly {\n            sstore(54, 1) // Store 1 in the transient storage 54\n        }\n    }\n}\n"
      },
      "contracts/AvocadoMultisig/lib/AvocadoMultisigInitializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\nimport { AvocadoMultisigVariables } from \"../AvocadoMultisigVariables.sol\";\n\n/// @dev contract copied from OpenZeppelin Initializable but with storage vars moved to AvocadoMultisigVariables.sol\n/// from OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n/// see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.1/contracts/proxy/utils/Initializable.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 * ```\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\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 AvocadoMultisigInitializable is AvocadoMultisigVariables {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    // uint8 private _initialized; // -> in AvocadoMultisigVariables\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    // bool private _initializing; // -> in AvocadoMultisigVariables\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"
      },
      "contracts/external/InstaFlashReceiverInterface.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\ninterface InstaFlashReceiverInterface {\n    function executeOperation(\n        address[] calldata assets,\n        uint256[] calldata amounts,\n        uint256[] calldata premiums,\n        address initiator,\n        bytes calldata _data\n    ) external returns (bool);\n}\n"
      },
      "contracts/interfaces/IAvocadoMultisigV1.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\nimport { AvocadoMultisigStructs } from \"../AvocadoMultisig/AvocadoMultisigStructs.sol\";\n\n// @dev base interface without getters for storage variables (to avoid overloads issues)\ninterface IAvocadoMultisigV1Base is AvocadoMultisigStructs {\n    /// @notice initializer called by AvoFactory after deployment, sets the `owner_` as the only signer\n    function initialize() external;\n\n    /// @notice returns the domainSeparator for EIP712 signature\n    function domainSeparatorV4() external view returns (bytes32);\n\n    /// @notice returns the domainSeparator for EIP712 signature for `castChainAgnostic`\n    function domainSeparatorV4ChainAgnostic() external view returns (bytes32);\n\n    /// @notice               gets the digest (hash) used to verify an EIP712 signature for `cast()`.\n    ///\n    ///                       This is also used as the non-sequential nonce that will be marked as used when the\n    ///                       request with the matching `params_` and `forwardParams_` is executed via `cast()`.\n    /// @param params_        Cast params such as id, avoNonce and actions to execute\n    /// @param forwardParams_ Cast params related to validity of forwarding as instructed and signed\n    /// @return               bytes32 digest to verify signature (or used as non-sequential nonce)\n    function getSigDigest(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_\n    ) external view returns (bytes32);\n\n    /// @notice                   gets the digest (hash) used to verify an EIP712 signature for `castAuthorized()`.\n    ///\n    ///                           This is also the non-sequential nonce that will be marked as used when the request\n    ///                           with the matching `params_` and `authorizedParams_` is executed via `castAuthorized()`.\n    /// @param params_            Cast params such as id, avoNonce and actions to execute\n    /// @param authorizedParams_  Cast params related to authorized execution such as maxFee, as signed\n    /// @return                   bytes32 digest to verify signature (or used as non-sequential nonce)\n    function getSigDigestAuthorized(\n        CastParams calldata params_,\n        CastAuthorizedParams calldata authorizedParams_\n    ) external view returns (bytes32);\n\n    /// @notice                   Verify the signatures for a `cast()' call are valid and can be executed.\n    ///                           This does not guarantuee that the tx will not revert, simply that the params are valid.\n    ///                           Does not revert and returns successfully if the input is valid.\n    ///                           Reverts if input params, signature or avoNonce etc. are invalid.\n    /// @param params_            Cast params such as id, avoNonce and actions to execute\n    /// @param forwardParams_     Cast params related to validity of forwarding as instructed and signed\n    /// @param signaturesParams_  SignatureParams structs array for signature and signer:\n    ///                           - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                             For smart contract signatures it must fulfill the requirements for the relevant\n    ///                             smart contract `.isValidSignature()` EIP1271 logic\n    ///                           - signer: address of the signature signer.\n    ///                             Must match the actual signature signer or refer to the smart contract\n    ///                             that must be an allowed signer and validates signature via EIP1271\n    /// @return                   returns true if everything is valid, otherwise reverts\n    function verify(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] calldata signaturesParams_\n    ) external view returns (bool);\n\n    /// @notice                   Verify the signatures for a `castAuthorized()' call are valid and can be executed.\n    ///                           This does not guarantuee that the tx will not revert, simply that the params are valid.\n    ///                           Does not revert and returns successfully if the input is valid.\n    ///                           Reverts if input params, signature or avoNonce etc. are invalid.\n    /// @param params_            Cast params such as id, avoNonce and actions to execute\n    /// @param authorizedParams_  Cast params related to authorized execution such as maxFee, as signed\n    /// @param signaturesParams_  SignatureParams structs array for signature and signer:\n    ///                           - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                             For smart contract signatures it must fulfill the requirements for the relevant\n    ///                             smart contract `.isValidSignature()` EIP1271 logic\n    ///                           - signer: address of the signature signer.\n    ///                             Must match the actual signature signer or refer to the smart contract\n    ///                             that must be an allowed signer and validates signature via EIP1271\n    /// @return                   returns true if everything is valid, otherwise reverts\n    function verifyAuthorized(\n        CastParams calldata params_,\n        CastAuthorizedParams calldata authorizedParams_,\n        SignatureParams[] calldata signaturesParams_\n    ) external view returns (bool);\n\n    /// @notice                   Executes arbitrary actions with valid signatures. Only executable by AvoForwarder.\n    ///                           If one action fails, the transaction doesn't revert, instead emits the `CastFailed` event.\n    ///                           In that case, all previous actions are reverted.\n    ///                           On success, emits CastExecuted event.\n    /// @dev                      validates EIP712 signature then executes each action via .call or .delegatecall\n    /// @param params_            Cast params such as id, avoNonce and actions to execute\n    /// @param forwardParams_     Cast params related to validity of forwarding as instructed and signed\n    /// @param signaturesParams_  SignatureParams structs array for signature and signer:\n    ///                           - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                             For smart contract signatures it must fulfill the requirements for the relevant\n    ///                             smart contract `.isValidSignature()` EIP1271 logic\n    ///                           - signer: address of the signature signer.\n    ///                             Must match the actual signature signer or refer to the smart contract\n    ///                             that must be an allowed signer and validates signature via EIP1271\n    /// @return success           true if all actions were executed succesfully, false otherwise.\n    /// @return revertReason      revert reason if one of the actions fails in the following format:\n    ///                           The revert reason will be prefixed with the index of the action.\n    ///                           e.g. if action 1 fails, then the reason will be \"1_reason\".\n    ///                           if an action in the flashloan callback fails (or an otherwise nested action),\n    ///                           it will be prefixed with with two numbers: \"1_2_reason\".\n    ///                           e.g. if action 1 is the flashloan, and action 2 of flashloan actions fails,\n    ///                           the reason will be 1_2_reason.\n    function cast(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] calldata signaturesParams_\n    ) external payable returns (bool success, string memory revertReason);\n\n    /// @notice                   Simulates a `cast()` call with exact same params and execution logic except for:\n    ///                           - any `gasleft()` use removed to remove potential problems when estimating gas.\n    ///                           - reverts on param validations removed (verify validity with `verify` instead).\n    ///                           - signature validation is skipped (must be manually added to gas estimations).\n    /// @dev                      tx.origin must be dead address, msg.sender must be AvoForwarder.\n    /// @dev                      - set `signaturesParams_` to empty to automatically simulate with required signers length.\n    ///                           - if `signaturesParams_` first element signature is not set, or if first signer is set to\n    ///                             0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF, then gas usage burn is simulated\n    ///                             for verify signature functionality. DO NOT set signature to non-empty for subsequent\n    ///                             elements then; set all signatures to empty!\n    ///                           - if `signaturesParams_` is set normally, signatures are verified as in actual execute\n    ///                           - buffer amounts for mock smart contract signers signature verification must be added\n    ///                             off-chain as this varies on a case per case basis.\n    function simulateCast(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] memory signaturesParams_\n    ) external payable returns (bool success_, string memory revertReason_);\n\n    /// @notice                   Exact same as `simulateCast`, just reverts in case of `success_` = false to optimize\n    ///                           for use with .estimateGas().\n    function estimateCast(\n        CastParams calldata params_,\n        CastForwardParams calldata forwardParams_,\n        SignatureParams[] memory signaturesParams_\n    ) external payable returns (bool success_, string memory revertReason_);\n\n    /// @notice                   Executes arbitrary actions through authorized transaction sent with valid signatures.\n    ///                           Includes a fee in native network gas token, amount depends on registry `calcFee()`.\n    ///                           If one action fails, the transaction doesn't revert, instead emits the `CastFailed` event.\n    ///                           In that case, all previous actions are reverted.\n    ///                           On success, emits CastExecuted event.\n    /// @dev                      executes a .call or .delegateCall for every action (depending on params)\n    /// @param params_            Cast params such as id, avoNonce and actions to execute\n    /// @param authorizedParams_  Cast params related to authorized execution such as maxFee, as signed\n    /// @param signaturesParams_  SignatureParams structs array for signature and signer:\n    ///                           - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                             For smart contract signatures it must fulfill the requirements for the relevant\n    ///                             smart contract `.isValidSignature()` EIP1271 logic\n    ///                           - signer: address of the signature signer.\n    ///                             Must match the actual signature signer or refer to the smart contract\n    ///                             that must be an allowed signer and validates signature via EIP1271\n    /// @return success           true if all actions were executed succesfully, false otherwise.\n    /// @return revertReason      revert reason if one of the actions fails in the following format:\n    ///                           The revert reason will be prefixed with the index of the action.\n    ///                           e.g. if action 1 fails, then the reason will be \"1_reason\".\n    ///                           if an action in the flashloan callback fails (or an otherwise nested action),\n    ///                           it will be prefixed with with two numbers: \"1_2_reason\".\n    ///                           e.g. if action 1 is the flashloan, and action 2 of flashloan actions fails,\n    ///                           the reason will be 1_2_reason.\n    function castAuthorized(\n        CastParams calldata params_,\n        CastAuthorizedParams calldata authorizedParams_,\n        SignatureParams[] calldata signaturesParams_\n    ) external payable returns (bool success, string memory revertReason);\n\n    /// @notice returns the hashes struct for each `CastChainAgnosticParams` element of `params_`. The returned array must be\n    ///         passed into `castChainAgnostic()` as the param `chainAgnosticHashes_` there (order must be the same).\n    ///         The returned hash for each element is the EIP712 type hash for `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH`,\n    ///         as used when the signature digest is built.\n    function getChainAgnosticHashes(\n        CastChainAgnosticParams[] calldata params_\n    ) external pure returns (ChainAgnosticHash[] memory chainAgnosticHashes_);\n\n    /// @notice                   gets the digest (hash) used to verify an EIP712 signature for `castChainAgnostic()`,\n    ///                           built from the `CastChainAgnosticParams`.\n    ///\n    ///                           This is also the non-sequential nonce that will be marked as used when the request\n    ///                           with the matching `params_` is executed via `castChainAgnostic()`.\n    /// @param params_            Cast params such as id, avoNonce and actions to execute\n    /// @return                   bytes32 digest to verify signature (or used as non-sequential nonce)\n    function getSigDigestChainAgnostic(CastChainAgnosticParams[] calldata params_) external view returns (bytes32);\n\n    /// @notice                     gets the digest (hash) used to verify an EIP712 signature for `castChainAgnostic()`,\n    ///                             built from the chain agnostic hashes (result of `getChainAgnosticHashes()`).\n    ///\n    ///                             This is also the non-sequential nonce that will be marked as used when the request\n    ///                             with the matching `params_` is executed via `castChainAgnostic()`.\n    /// @param chainAgnosticHashes_ EIP712 type hashes of `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH` for all `CastChainAgnosticParams`\n    ///                             struct array elements as used when creating the signature. Result of `getChainAgnosticHashes()`.\n    ///                             must be set in the same order as when creating the signature.\n    /// @return                     bytes32 digest to verify signature (or used as non-sequential nonce)\n    function getSigDigestChainAgnosticFromHashes(\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) external view returns (bytes32);\n\n    /// @notice                     Executes arbitrary actions with valid signatures. Only executable by AvoForwarder.\n    ///                             If one action fails, the transaction doesn't revert, instead emits the `CastFailed` event.\n    ///                             In that case, all previous actions are reverted.\n    ///                             On success, emits CastExecuted event.\n    /// @dev                        validates EIP712 signature then executes each action via .call or .delegatecall\n    /// @param params_              params containing info and intents regarding actions to be executed. Made up of\n    ///                             same params as for `cast()` plus chain id.\n    /// @param signaturesParams_    SignatureParams structs array for signature and signer:\n    ///                             - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                               For smart contract signatures it must fulfill the requirements for the relevant\n    ///                               smart contract `.isValidSignature()` EIP1271 logic\n    ///                             - signer: address of the signature signer.\n    ///                               Must match the actual signature signer or refer to the smart contract\n    ///                               that must be an allowed signer and validates signature via EIP1271\n    /// @param chainAgnosticHashes_ EIP712 type hashes of `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH` for all `CastChainAgnosticParams`\n    ///                             struct array elements as used when creating the signature. Result of `getChainAgnosticHashes()`.\n    ///                             must be set in the same order as when creating the signature.\n    /// @return success             true if all actions were executed succesfully, false otherwise.\n    /// @return revertReason        revert reason if one of the actions fails in the following format:\n    ///                             The revert reason will be prefixed with the index of the action.\n    ///                             e.g. if action 1 fails, then the reason will be \"1_reason\".\n    ///                             if an action in the flashloan callback fails (or an otherwise nested action),\n    ///                             it will be prefixed with with two numbers: \"1_2_reason\".\n    ///                             e.g. if action 1 is the flashloan, and action 2 of flashloan actions fails,\n    ///                             the reason will be 1_2_reason.\n    function castChainAgnostic(\n        CastChainAgnosticParams calldata params_,\n        SignatureParams[] memory signaturesParams_,\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) external payable returns (bool success, string memory revertReason);\n\n    /// @notice                   Simulates a `castChainAgnostic()` call with exact same params and execution logic except for:\n    ///                           - any `gasleft()` use removed to remove potential problems when estimating gas.\n    ///                           - reverts on param validations removed (verify validity with `verify` instead).\n    ///                           - signature validation is skipped (must be manually added to gas estimations).\n    /// @dev                      tx.origin must be dead address, msg.sender must be AvoForwarder.\n    /// @dev                      - set `signaturesParams_` to empty to automatically simulate with required signers length.\n    ///                           - if `signaturesParams_` first element signature is not set, or if first signer is set to\n    ///                             0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF, then gas usage burn is simulated\n    ///                             for verify signature functionality. DO NOT set signature to non-empty for subsequent\n    ///                             elements then; set all signatures to empty!\n    ///                           - if `signaturesParams_` is set normally, signatures are verified as in actual execute\n    ///                           - buffer amounts for mock smart contract signers signature verification must be added\n    ///                             off-chain as this varies on a case per case basis.\n    function simulateCastChainAgnostic(\n        CastChainAgnosticParams calldata params_,\n        SignatureParams[] memory signaturesParams_,\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) external payable returns (bool success_, string memory revertReason_);\n\n    /// @notice                   Exact same as `simulateCastChainAgnostic`, just reverts in case of `success_` = false to\n    ///                           optimize for use with .estimateGas().\n    function estimateCastChainAgnostic(\n        CastChainAgnosticParams calldata params_,\n        SignatureParams[] memory signaturesParams_,\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) external payable returns (bool success_, string memory revertReason_);\n\n    /// @notice                     Verify the signatures for a `castChainAgnostic()' call are valid and can be executed.\n    ///                             This does not guarantuee that the tx will not revert, simply that the params are valid.\n    ///                             Does not revert and returns successfully if the input is valid.\n    ///                             Reverts if input params, signature or avoNonce etc. are invalid.\n    /// @param params_              params containing info and intents regarding actions to be executed. Made up of\n    ///                             same params as for `cast()` plus chain id.\n    /// @param signaturesParams_    SignatureParams structs array for signature and signer:\n    ///                             - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                               For smart contract signatures it must fulfill the requirements for the relevant\n    ///                               smart contract `.isValidSignature()` EIP1271 logic\n    ///                             - signer: address of the signature signer.\n    ///                               Must match the actual signature signer or refer to the smart contract\n    ///                               that must be an allowed signer and validates signature via EIP1271\n    /// @param chainAgnosticHashes_ EIP712 type hashes of `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH` for all `CastChainAgnosticParams`\n    ///                             struct array elements as used when creating the signature. Result of `getChainAgnosticHashes()`.\n    ///                             must be set in the same order as when creating the signature.\n    /// @return                     returns true if everything is valid, otherwise reverts\n    function verifyChainAgnostic(\n        CastChainAgnosticParams calldata params_,\n        SignatureParams[] calldata signaturesParams_,\n        ChainAgnosticHash[] calldata chainAgnosticHashes_\n    ) external view returns (bool);\n\n    /// @notice checks if an address `signer_` is an allowed signer (returns true if allowed)\n    function isSigner(address signer_) external view returns (bool);\n\n    /// @notice returns allowed signers on Avocado wich can trigger actions if reaching quorum `requiredSigners`.\n    ///         signers automatically include owner.\n    function signers() external view returns (address[] memory signers_);\n\n    /// @notice returns the number of required signers\n    function requiredSigners() external view returns (uint8);\n\n    /// @notice returns the number of allowed signers\n    function signersCount() external view returns (uint8);\n\n    /// @notice Avocado owner\n    function owner() external view returns (address);\n\n    /// @notice Avocado index (number of Avocado for EOA owner)\n    function index() external view returns (uint32);\n}\n\n// @dev full interface with some getters for storage variables\ninterface IAvocadoMultisigV1 is IAvocadoMultisigV1Base {\n    /// @notice Domain separator name for signatures\n    function DOMAIN_SEPARATOR_NAME() external view returns (string memory);\n\n    /// @notice Domain separator version for signatures\n    function DOMAIN_SEPARATOR_VERSION() external view returns (string memory);\n\n    /// @notice incrementing nonce for each valid tx executed (to ensure uniqueness)\n    function avoNonce() external view returns (uint256);\n}\n"
      },
      "contracts/interfaces/IAvocadoMultisigV1Secondary.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\nimport { IAvoRegistry } from \"./IAvoRegistry.sol\";\nimport { IAvoSignersList } from \"./IAvoSignersList.sol\";\n\nimport { AvocadoMultisigStructs } from \"../AvocadoMultisig/AvocadoMultisigStructs.sol\";\n\ninterface IAvocadoMultisigV1Secondary {\n    /// @notice             pays the fee for `castAuthorized()` calls via the AvoRegistry (or fallback)\n    /// @param gasUsedFrom_ `gasleft()` snapshot at gas measurement starting point\n    /// @param maxFee_      maximum acceptable fee to be paid, revert if fee is bigger than this value\n    function payAuthorizedFee(uint256 gasUsedFrom_, uint256 maxFee_) external payable;\n\n    /// @notice decodes `signature` for EIP1271 into `signaturesParams_`\n    function decodeEIP1271Signature(\n        bytes calldata signature,\n        address owner_\n    ) external pure returns (AvocadoMultisigStructs.SignatureParams[] memory signaturesParams_);\n\n    /// @notice Get the revert reason from the returnedData (supports Panic, Error & Custom Errors).\n    /// @param returnedData_ revert data of the call\n    /// @return reason_      revert reason\n    function getRevertReasonFromReturnedData(bytes memory returnedData_) external pure returns (string memory reason_);\n\n    /// @notice upgrade the contract to a new implementation address.\n    ///         - Must be a valid version at the AvoRegistry.\n    ///         - Can only be self-called (authorization same as for `cast` methods).\n    /// @param avoImplementation_       New contract address\n    /// @param afterUpgradeHookData_    flexible bytes for custom usage in after upgrade hook logic\n    //\n    // Implementation must call `_afterUpgradeHook()`\n    function upgradeTo(address avoImplementation_, bytes calldata afterUpgradeHookData_) external;\n\n    /// @notice                     executes a SIMULATE cast process for `cast()` or `castChainAgnostic()` for gas estimations.\n    /// @param params_              Cast params such as id, avoNonce and actions to execute\n    /// @param forwardParams_       Cast params related to validity of forwarding as instructed and signed\n    /// @param signaturesParams_    SignatureParams structs array for signature and signer:\n    ///                              - signature: the EIP712 signature, 65 bytes ECDSA signature for a default EOA.\n    ///                                For smart contract signatures it must fulfill the requirements for the relevant\n    ///                                smart contract `.isValidSignature()` EIP1271 logic\n    ///                              - signer: address of the signature signer.\n    ///                                Must match the actual signature signer or refer to the smart contract\n    ///                                that must be an allowed signer and validates signature via EIP1271\n    /// @param chainAgnosticHashes_ EIP712 type hashes of `CAST_CHAIN_AGNOSTIC_PARAMS_TYPE_HASH` struct for all `CastChainAgnosticParams`\n    ///                             struct array elements as used when creating the signature. Result of `getChainAgnosticHashes()`.\n    ///                             must be set in the same order as when creating the signature.\n    /// @return success_            true if all actions were executed succesfully, false otherwise.\n    /// @return revertReason_       revert reason if one of the actions fails in the following format:\n    ///                             The revert reason will be prefixed with the index of the action.\n    ///                             e.g. if action 1 fails, then the reason will be \"1_reason\".\n    ///                             if an action in the flashloan callback fails (or an otherwise nested action),\n    ///                             it will be prefixed with with two numbers: \"1_2_reason\".\n    ///                             e.g. if action 1 is the flashloan, and action 2 of flashloan actions fails,\n    ///                             the reason will be 1_2_reason.\n    function simulateCast(\n        AvocadoMultisigStructs.CastParams calldata params_,\n        AvocadoMultisigStructs.CastForwardParams calldata forwardParams_,\n        AvocadoMultisigStructs.SignatureParams[] memory signaturesParams_,\n        AvocadoMultisigStructs.ChainAgnosticHash[] memory chainAgnosticHashes_\n    ) external returns (bool success_, string memory revertReason_);\n\n    /// @notice SIMULATES: executes `actions_` with respective target, calldata, operation etc.\n    function _simulateExecuteActions(\n        AvocadoMultisigStructs.Action[] memory actions_,\n        uint256 id_,\n        bool isFlashloanCallback_\n    ) external;\n}\n\ninterface IAvocadoMultisigV1SecondaryConstants {\n    function avoRegistry() external view returns (IAvoRegistry);\n    function avoForwarder() external view returns (address);\n    function avoSignersList() external view returns (IAvoSignersList);\n    function AUTHORIZED_MIN_FEE() external view returns (uint256);\n    function AUTHORIZED_MAX_FEE() external view returns (uint256);\n    function AUTHORIZED_FEE_COLLECTOR() external view returns (address);\n}\n"
      },
      "contracts/interfaces/IAvoConfigV1.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\ninterface IAvoConfigV1 {\n    struct AvocadoMultisigConfig {\n        ///\n        /// @param authorizedMinFee_       minimum for fee charged via `castAuthorized()` to charge if\n        ///                                `AvoRegistry.calcFee()` would fail.\n        uint256 authorizedMinFee;\n        ///\n        /// @param authorizedMaxFee_       maximum for fee charged via `castAuthorized()`. If AvoRegistry\n        ///                                returns a fee higher than this, then `authorizedMaxFee_` is charged as fee instead.\n        uint256 authorizedMaxFee;\n        ///\n        /// @param authorizedFeeCollector_ address that the fee charged via `castAuthorized()` is sent to in the fallback case.\n        address authorizedFeeCollector;\n    }\n\n    struct AvoDepositManagerConfig {\n        address depositToken;\n    }\n\n    struct AvoSignersListConfig {\n        bool trackInStorage;\n    }\n\n    /// @notice config for AvocadoMultisig\n    function avocadoMultisigConfig() external view returns (AvocadoMultisigConfig memory);\n\n    /// @notice config for AvoDepositManager\n    function avoDepositManagerConfig() external view returns (AvoDepositManagerConfig memory);\n\n    /// @notice config for AvoSignersList\n    function avoSignersListConfig() external view returns (AvoSignersListConfig memory);\n}\n"
      },
      "contracts/interfaces/IAvoRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\ninterface IAvoFeeCollector {\n    /// @notice fee config params used to determine the fee for Avocado smart wallet `castAuthorized()` calls\n    struct FeeConfig {\n        ///\n        /// @param feeCollector address that the fee should be paid to\n        address payable feeCollector;\n        ///\n        /// @param mode current fee mode: 0 = percentage fee (gas cost markup); 1 = static fee (better for L2)\n        uint8 mode;\n        ///\n        /// @param fee current fee amount:\n        /// - for mode percentage: fee in 1e6 percentage (1e8 = 100%, 1e6 = 1%)\n        /// - for static mode: absolute amount in native gas token to charge\n        ///                    (max value 30_9485_009,821345068724781055 in 1e18)\n        uint88 fee;\n    }\n\n    /// @notice calculates the `feeAmount_` for an Avocado (`msg.sender`) transaction `gasUsed_` based on\n    ///         fee configuration present on the contract\n    /// @param  gasUsed_       amount of gas used, required if mode is percentage. not used if mode is static fee.\n    /// @return feeAmount_    calculated fee amount to be paid\n    /// @return feeCollector_ address to send the fee to\n    function calcFee(uint256 gasUsed_) external view returns (uint256 feeAmount_, address payable feeCollector_);\n}\n\ninterface IAvoRegistry is IAvoFeeCollector {\n    /// @notice                      checks if an address is listed as allowed AvoForwarder version, reverts if not.\n    /// @param avoForwarderVersion_  address of the AvoForwarder logic contract to check\n    function requireValidAvoForwarderVersion(address avoForwarderVersion_) external view;\n\n    /// @notice                     checks if an address is listed as allowed Avocado version, reverts if not.\n    /// @param avoVersion_          address of the Avocado logic contract to check\n    function requireValidAvoVersion(address avoVersion_) external view;\n}\n"
      },
      "contracts/interfaces/IAvoSignersList.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.18;\n\ninterface IAvoSignersList {\n    /// @notice adds mappings of `addSigners_` to an Avocado `avocado_`.\n    ///         checks the data present at the Avocado to validate input data.\n    ///\n    /// If `trackInStorage` flag is set to false, then only an event will be emitted for off-chain tracking.\n    /// The contract itself will not track avocados per signer on-chain!\n    ///\n    /// Silently ignores `addSigners_` that are already added\n    ///\n    /// There is expectedly no need for this method to be called by anyone other than the Avocado itself.\n    function syncAddAvoSignerMappings(address avocado_, address[] calldata addSigners_) external;\n\n    /// @notice removes mappings of `removeSigners_` from an Avocado `avocado_`.\n    ///         checks the data present at the Avocado to validate input data.\n    ///\n    /// If `trackInStorage` flag is set to false, then only an event will be emitted for off-chain tracking.\n    /// The contract itself will not track avocados per signer on-chain!\n    ///\n    /// Silently ignores `removeSigners_` that are already removed\n    ///\n    /// There is expectedly no need for this method to be called by anyone other than the Avocado itself.\n    function syncRemoveAvoSignerMappings(address avocado_, address[] calldata removeSigners_) external;\n}\n"
      },
      "solmate/src/utils/SSTORE2.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Read and write to persistent storage at a fraction of the cost.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SSTORE2.sol)\n/// @author Modified from 0xSequence (https://github.com/0xSequence/sstore2/blob/master/contracts/SSTORE2.sol)\nlibrary SSTORE2 {\n    uint256 internal constant DATA_OFFSET = 1; // We skip the first byte as it's a STOP opcode to ensure the contract can't be called.\n\n    /*//////////////////////////////////////////////////////////////\n                               WRITE LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function write(bytes memory data) internal returns (address pointer) {\n        // Prefix the bytecode with a STOP opcode to ensure it cannot be called.\n        bytes memory runtimeCode = abi.encodePacked(hex\"00\", data);\n\n        bytes memory creationCode = abi.encodePacked(\n            //---------------------------------------------------------------------------------------------------------------//\n            // Opcode  | Opcode + Arguments  | Description  | Stack View                                                     //\n            //---------------------------------------------------------------------------------------------------------------//\n            // 0x60    |  0x600B             | PUSH1 11     | codeOffset                                                     //\n            // 0x59    |  0x59               | MSIZE        | 0 codeOffset                                                   //\n            // 0x81    |  0x81               | DUP2         | codeOffset 0 codeOffset                                        //\n            // 0x38    |  0x38               | CODESIZE     | codeSize codeOffset 0 codeOffset                               //\n            // 0x03    |  0x03               | SUB          | (codeSize - codeOffset) 0 codeOffset                           //\n            // 0x80    |  0x80               | DUP          | (codeSize - codeOffset) (codeSize - codeOffset) 0 codeOffset   //\n            // 0x92    |  0x92               | SWAP3        | codeOffset (codeSize - codeOffset) 0 (codeSize - codeOffset)   //\n            // 0x59    |  0x59               | MSIZE        | 0 codeOffset (codeSize - codeOffset) 0 (codeSize - codeOffset) //\n            // 0x39    |  0x39               | CODECOPY     | 0 (codeSize - codeOffset)                                      //\n            // 0xf3    |  0xf3               | RETURN       |                                                                //\n            //---------------------------------------------------------------------------------------------------------------//\n            hex\"60_0B_59_81_38_03_80_92_59_39_F3\", // Returns all code in the contract except for the first 11 (0B in hex) bytes.\n            runtimeCode // The bytecode we want the contract to have after deployment. Capped at 1 byte less than the code size limit.\n        );\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Deploy a new contract with the generated creation code.\n            // We start 32 bytes into the code to avoid copying the byte length.\n            pointer := create(0, add(creationCode, 32), mload(creationCode))\n        }\n\n        require(pointer != address(0), \"DEPLOYMENT_FAILED\");\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                               READ LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function read(address pointer) internal view returns (bytes memory) {\n        return readBytecode(pointer, DATA_OFFSET, pointer.code.length - DATA_OFFSET);\n    }\n\n    function read(address pointer, uint256 start) internal view returns (bytes memory) {\n        start += DATA_OFFSET;\n\n        return readBytecode(pointer, start, pointer.code.length - start);\n    }\n\n    function read(\n        address pointer,\n        uint256 start,\n        uint256 end\n    ) internal view returns (bytes memory) {\n        start += DATA_OFFSET;\n        end += DATA_OFFSET;\n\n        require(pointer.code.length >= end, \"OUT_OF_BOUNDS\");\n\n        return readBytecode(pointer, start, end - start);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                          INTERNAL HELPER LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function readBytecode(\n        address pointer,\n        uint256 start,\n        uint256 size\n    ) private view returns (bytes memory data) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Get a pointer to some free memory.\n            data := mload(0x40)\n\n            // Update the free memory pointer to prevent overriding our data.\n            // We use and(x, not(31)) as a cheaper equivalent to sub(x, mod(x, 32)).\n            // Adding 31 to size and running the result through the logic above ensures\n            // the memory pointer remains word-aligned, following the Solidity convention.\n            mstore(0x40, add(data, and(add(add(size, 32), 31), not(31))))\n\n            // Store the size of the data in the first 32 byte chunk of free memory.\n            mstore(data, size)\n\n            // Copy the code into memory right after the 32 bytes we used to store the size.\n            extcodecopy(pointer, add(data, 32), start, size)\n        }\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 10000
      },
      "libraries": {},
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    }
  }}