creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev An operation with an ERC20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error AddressInsufficientBalance(address account);\n\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedInnerCall();\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert AddressInsufficientBalance(address(this));\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert FailedInnerCall();\n        }\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 or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {FailedInnerCall} error.\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    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\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    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert AddressInsufficientBalance(address(this));\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n     * unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {FailedInnerCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n     */\n    function _revert(bytes memory returndata) 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 FailedInnerCall();\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n    uint8 private constant ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev The `value` string doesn't fit in the specified `length`.\n     */\n    error StringsInsufficientHexLength(uint256 value, uint256 length);\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), HEX_DIGITS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toStringSigned(int256 value) internal pure returns (string memory) {\n        return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        uint256 localValue = value;\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] = HEX_DIGITS[localValue & 0xf];\n            localValue >>= 4;\n        }\n        if (localValue != 0) {\n            revert StringsInsufficientHexLength(value, length);\n        }\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\n     * representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\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    }\n\n    /**\n     * @dev The signature derives the `address(0)`.\n     */\n    error ECDSAInvalidSignature();\n\n    /**\n     * @dev The signature has an invalid length.\n     */\n    error ECDSAInvalidSignatureLength(uint256 length);\n\n    /**\n     * @dev The signature has an S value that is in the upper half order.\n     */\n    error ECDSAInvalidSignatureS(bytes32 s);\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n     * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n     * and a bytes32 providing additional information about the error.\n     *\n     * If no error is returned, then the address can be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile 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 {MessageHashUtils-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    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {\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, bytes32(signature.length));\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 precompile 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 {MessageHashUtils-toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n        _throwError(error, errorArg);\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    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {\n        unchecked {\n            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n            // We do not check for an overflow here since the shift operation results in 0 or 1.\n            uint8 v = uint8((uint256(vs) >> 255) + 27);\n            return tryRecover(hash, v, r, s);\n        }\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n        _throwError(error, errorArg);\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    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address, RecoverError, bytes32) {\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, s);\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, bytes32(0));\n        }\n\n        return (signer, RecoverError.NoError, bytes32(0));\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n     */\n    function _throwError(RecoverError error, bytes32 errorArg) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert ECDSAInvalidSignature();\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert ECDSAInvalidSignatureLength(uint256(errorArg));\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert ECDSAInvalidSignatureS(errorArg);\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.20;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n    /**\n     * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing a bytes32 `messageHash` with\n     * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n     * keccak256, although any bytes32 value can be safely used because the final digest will\n     * be re-hashed.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n        }\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing an arbitrary `message` with\n     * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n        return\n            keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-191 signed data with version\n     * `0x00` (data with intended validator).\n     *\n     * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n     * `validator` address. Then hashing the result.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).\n     *\n     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n     * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(ptr, hex\"19_01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            digest := keccak256(ptr, 0x42)\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    /**\n     * @dev Muldiv operation overflow.\n     */\n    error MathOverflowedMulDiv();\n\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\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 towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            return a / b;\n        }\n\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\n     * denominator == 0.\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0 = x * y; // 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                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            if (denominator <= prod1) {\n                revert MathOverflowedMulDiv();\n            }\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.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\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\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (unsignedRoundsUp(rounding) && 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\n     * towards zero.\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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position is the index of the value in the `values` array plus 1.\n        // Position 0 is used to mean a value is not in the set.\n        mapping(bytes32 value => uint256) _positions;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._positions[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We cache the value's position to prevent multiple reads from the same storage slot\n        uint256 position = set._positions[value];\n\n        if (position != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 valueIndex = position - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (valueIndex != lastIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the lastValue to the index where the value to delete is\n                set._values[valueIndex] = lastValue;\n                // Update the tracked position of the lastValue (that was just moved)\n                set._positions[lastValue] = position;\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the tracked position for the deleted slot\n            delete set._positions[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._positions[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"
      },
      "lib/wormhole-circle-integration/evm/src/interfaces/ICircleIntegration.sol": {
        "content": "// SPDX-License-Identifier: Apache 2\n\npragma solidity ^0.8.19;\n\nimport {IWormhole} from \"wormhole/interfaces/IWormhole.sol\";\nimport {ICircleBridge} from \"./circle/ICircleBridge.sol\";\nimport {IMessageTransmitter} from \"./circle/IMessageTransmitter.sol\";\n\ninterface ICircleIntegration {\n    struct TransferParameters {\n        address token;\n        uint256 amount;\n        uint16 targetChain;\n        bytes32 mintRecipient;\n    }\n\n    struct RedeemParameters {\n        bytes encodedWormholeMessage;\n        bytes circleBridgeMessage;\n        bytes circleAttestation;\n    }\n\n    struct DepositWithPayload {\n        bytes32 token;\n        uint256 amount;\n        uint32 sourceDomain;\n        uint32 targetDomain;\n        uint64 nonce;\n        bytes32 fromAddress;\n        bytes32 mintRecipient;\n        bytes payload;\n    }\n\n    function transferTokensWithPayload(TransferParameters memory transferParams, uint32 batchId, bytes memory payload)\n        external\n        payable\n        returns (uint64 messageSequence);\n\n    function redeemTokensWithPayload(RedeemParameters memory params)\n        external\n        returns (DepositWithPayload memory depositWithPayload);\n\n    function fetchLocalTokenAddress(uint32 sourceDomain, bytes32 sourceToken)\n        external\n        view\n        returns (bytes32);\n\n    function encodeDepositWithPayload(DepositWithPayload memory message) external pure returns (bytes memory);\n\n    function decodeDepositWithPayload(bytes memory encoded) external pure returns (DepositWithPayload memory message);\n\n    function isInitialized(address impl) external view returns (bool);\n\n    function wormhole() external view returns (IWormhole);\n\n    function chainId() external view returns (uint16);\n\n    function wormholeFinality() external view returns (uint8);\n\n    function circleBridge() external view returns (ICircleBridge);\n\n    function circleTransmitter() external view returns (IMessageTransmitter);\n\n    function getRegisteredEmitter(uint16 emitterChainId) external view returns (bytes32);\n\n    function isAcceptedToken(address token) external view returns (bool);\n\n    function getDomainFromChainId(uint16 chainId_) external view returns (uint32);\n\n    function getChainIdFromDomain(uint32 domain) external view returns (uint16);\n\n    function isMessageConsumed(bytes32 hash) external view returns (bool);\n\n    function localDomain() external view returns (uint32);\n\n    function verifyGovernanceMessage(bytes memory encodedMessage, uint8 action)\n        external\n        view\n        returns (bytes32 messageHash, bytes memory payload);\n\n    function evmChain() external view returns (uint256);\n\n    // guardian governance only\n    function updateWormholeFinality(bytes memory encodedMessage) external;\n\n    function registerEmitterAndDomain(bytes memory encodedMessage) external;\n\n    function upgradeContract(bytes memory encodedMessage) external;\n}\n"
      },
      "lib/wormhole-circle-integration/evm/src/interfaces/IWormhole.sol": {
        "content": "// contracts/Messages.sol\n// SPDX-License-Identifier: Apache 2\n\npragma solidity ^0.8.0;\n\ninterface IWormhole {\n    struct GuardianSet {\n        address[] keys;\n        uint32 expirationTime;\n    }\n\n    struct Signature {\n        bytes32 r;\n        bytes32 s;\n        uint8 v;\n        uint8 guardianIndex;\n    }\n\n    struct VM {\n        uint8 version;\n        uint32 timestamp;\n        uint32 nonce;\n        uint16 emitterChainId;\n        bytes32 emitterAddress;\n        uint64 sequence;\n        uint8 consistencyLevel;\n        bytes payload;\n\n        uint32 guardianSetIndex;\n        Signature[] signatures;\n\n        bytes32 hash;\n    }\n\n    struct ContractUpgrade {\n        bytes32 module;\n        uint8 action;\n        uint16 chain;\n\n        address newContract;\n    }\n\n    struct GuardianSetUpgrade {\n        bytes32 module;\n        uint8 action;\n        uint16 chain;\n\n        GuardianSet newGuardianSet;\n        uint32 newGuardianSetIndex;\n    }\n\n    struct SetMessageFee {\n        bytes32 module;\n        uint8 action;\n        uint16 chain;\n\n        uint256 messageFee;\n    }\n\n    struct TransferFees {\n        bytes32 module;\n        uint8 action;\n        uint16 chain;\n\n        uint256 amount;\n        bytes32 recipient;\n    }\n\n    struct RecoverChainId {\n        bytes32 module;\n        uint8 action;\n\n        uint256 evmChainId;\n        uint16 newChainId;\n    }\n\n    event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel);\n    event ContractUpgraded(address indexed oldContract, address indexed newContract);\n    event GuardianSetAdded(uint32 indexed index);\n\n    function publishMessage(\n        uint32 nonce,\n        bytes memory payload,\n        uint8 consistencyLevel\n    ) external payable returns (uint64 sequence);\n\n    function initialize() external;\n\n    function parseAndVerifyVM(bytes calldata encodedVM) external view returns (VM memory vm, bool valid, string memory reason);\n\n    function verifyVM(VM memory vm) external view returns (bool valid, string memory reason);\n\n    function verifySignatures(bytes32 hash, Signature[] memory signatures, GuardianSet memory guardianSet) external pure returns (bool valid, string memory reason);\n\n    function parseVM(bytes memory encodedVM) external pure returns (VM memory vm);\n\n    function quorum(uint numGuardians) external pure returns (uint numSignaturesRequiredForQuorum);\n\n    function getGuardianSet(uint32 index) external view returns (GuardianSet memory);\n\n    function getCurrentGuardianSetIndex() external view returns (uint32);\n\n    function getGuardianSetExpiry() external view returns (uint32);\n\n    function governanceActionIsConsumed(bytes32 hash) external view returns (bool);\n\n    function isInitialized(address impl) external view returns (bool);\n\n    function chainId() external view returns (uint16);\n\n    function isFork() external view returns (bool);\n\n    function governanceChainId() external view returns (uint16);\n\n    function governanceContract() external view returns (bytes32);\n\n    function messageFee() external view returns (uint256);\n\n    function evmChainId() external view returns (uint256);\n\n    function nextSequence(address emitter) external view returns (uint64);\n\n    function parseContractUpgrade(bytes memory encodedUpgrade) external pure returns (ContractUpgrade memory cu);\n\n    function parseGuardianSetUpgrade(bytes memory encodedUpgrade) external pure returns (GuardianSetUpgrade memory gsu);\n\n    function parseSetMessageFee(bytes memory encodedSetMessageFee) external pure returns (SetMessageFee memory smf);\n\n    function parseTransferFees(bytes memory encodedTransferFees) external pure returns (TransferFees memory tf);\n\n    function parseRecoverChainId(bytes memory encodedRecoverChainId) external pure returns (RecoverChainId memory rci);\n\n    function submitContractUpgrade(bytes memory _vm) external;\n\n    function submitSetMessageFee(bytes memory _vm) external;\n\n    function submitNewGuardianSet(bytes memory _vm) external;\n\n    function submitTransferFees(bytes memory _vm) external;\n\n    function submitRecoverChainId(bytes memory _vm) external;\n}\n"
      },
      "lib/wormhole-circle-integration/evm/src/interfaces/circle/ICircleBridge.sol": {
        "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.19;\n\nimport {IMessageTransmitter} from \"./IMessageTransmitter.sol\";\nimport {ITokenMinter} from \"./ITokenMinter.sol\";\n\ninterface ICircleBridge {\n    /**\n     * @notice Deposits and burns tokens from sender to be minted on destination domain.\n     * Emits a `DepositForBurn` event.\n     * @dev reverts if:\n     * - given burnToken is not supported\n     * - given destinationDomain has no CircleBridge registered\n     * - transferFrom() reverts. For example, if sender's burnToken balance or approved allowance\n     * to this contract is less than `amount`.\n     * - burn() reverts. For example, if `amount` is 0.\n     * - MessageTransmitter returns false or reverts.\n     * @param _amount amount of tokens to burn\n     * @param _destinationDomain destination domain (ETH = 0, AVAX = 1)\n     * @param _mintRecipient address of mint recipient on destination domain\n     * @param _burnToken address of contract to burn deposited tokens, on local domain\n     * @return _nonce unique nonce reserved by message\n     */\n    function depositForBurn(uint256 _amount, uint32 _destinationDomain, bytes32 _mintRecipient, address _burnToken)\n        external\n        returns (uint64 _nonce);\n\n    /**\n     * @notice Deposits and burns tokens from sender to be minted on destination domain. The mint\n     * on the destination domain must be called by `_destinationCaller`.\n     * WARNING: if the `_destinationCaller` does not represent a valid address as bytes32, then it will not be possible\n     * to broadcast the message on the destination domain. This is an advanced feature, and the standard\n     * depositForBurn() should be preferred for use cases where a specific destination caller is not required.\n     * Emits a `DepositForBurn` event.\n     * @dev reverts if:\n     * - given destinationCaller is zero address\n     * - given burnToken is not supported\n     * - given destinationDomain has no CircleBridge registered\n     * - transferFrom() reverts. For example, if sender's burnToken balance or approved allowance\n     * to this contract is less than `amount`.\n     * - burn() reverts. For example, if `amount` is 0.\n     * - MessageTransmitter returns false or reverts.\n     * @param _amount amount of tokens to burn\n     * @param _destinationDomain destination domain\n     * @param _mintRecipient address of mint recipient on destination domain\n     * @param _burnToken address of contract to burn deposited tokens, on local domain\n     * @param _destinationCaller caller on the destination domain, as bytes32\n     * @return _nonce unique nonce reserved by message\n     */\n    function depositForBurnWithCaller(\n        uint256 _amount,\n        uint32 _destinationDomain,\n        bytes32 _mintRecipient,\n        address _burnToken,\n        bytes32 _destinationCaller\n    ) external returns (uint64 _nonce);\n\n    function owner() external view returns (address);\n\n    function handleReceiveMessage(uint32 _remoteDomain, bytes32 _sender, bytes memory messageBody)\n        external\n        view\n        returns (bool);\n\n    function localMessageTransmitter() external view returns (IMessageTransmitter);\n\n    function localMinter() external view returns (ITokenMinter);\n\n    function remoteCircleBridges(uint32 domain) external view returns (bytes32);\n\n    // owner only methods\n    function transferOwnership(address newOwner) external;\n}\n"
      },
      "lib/wormhole-circle-integration/evm/src/interfaces/circle/IMessageTransmitter.sol": {
        "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.19;\n\ninterface IMessageTransmitter {\n    event MessageSent(bytes message);\n\n    /**\n     * @notice Emitted when tokens are minted\n     * @param _mintRecipient recipient address of minted tokens\n     * @param _amount amount of minted tokens\n     * @param _mintToken contract address of minted token\n     */\n    event MintAndWithdraw(address _mintRecipient, uint256 _amount, address _mintToken);\n\n    /**\n     * @notice Receive a message. Messages with a given nonce\n     * can only be broadcast once for a (sourceDomain, destinationDomain)\n     * pair. The message body of a valid message is passed to the\n     * specified recipient for further processing.\n     *\n     * @dev Attestation format:\n     * A valid attestation is the concatenated 65-byte signature(s) of exactly\n     * `thresholdSignature` signatures, in increasing order of attester address.\n     * ***If the attester addresses recovered from signatures are not in\n     * increasing order, signature verification will fail.***\n     * If incorrect number of signatures or duplicate signatures are supplied,\n     * signature verification will fail.\n     *\n     * Message format:\n     * Field Bytes Type Index\n     * version 4 uint32 0\n     * sourceDomain 4 uint32 4\n     * destinationDomain 4 uint32 8\n     * nonce 8 uint64 12\n     * sender 32 bytes32 20\n     * recipient 32 bytes32 52\n     * messageBody dynamic bytes 84\n     * @param _message Message bytes\n     * @param _attestation Concatenated 65-byte signature(s) of `_message`, in increasing order\n     * of the attester address recovered from signatures.\n     * @return success bool, true if successful\n     */\n    function receiveMessage(bytes memory _message, bytes calldata _attestation) external returns (bool success);\n\n    function attesterManager() external view returns (address);\n\n    function availableNonces(uint32 domain) external view returns (uint64);\n\n    function getNumEnabledAttesters() external view returns (uint256);\n\n    function isEnabledAttester(address _attester) external view returns (bool);\n\n    function localDomain() external view returns (uint32);\n\n    function maxMessageBodySize() external view returns (uint256);\n\n    function owner() external view returns (address);\n\n    function paused() external view returns (bool);\n\n    function pauser() external view returns (address);\n\n    function rescuer() external view returns (address);\n\n    function version() external view returns (uint32);\n\n    // owner only methods\n    function transferOwnership(address newOwner) external;\n\n    function updateAttesterManager(address _newAttesterManager) external;\n\n    // attester manager only methods\n    function getEnabledAttester(uint256 _index) external view returns (address);\n\n    function disableAttester(address _attester) external;\n\n    function enableAttester(address _attester) external;\n\n    function setSignatureThreshold(uint256 newSignatureThreshold) external;\n}\n"
      },
      "lib/wormhole-circle-integration/evm/src/interfaces/circle/ITokenMinter.sol": {
        "content": "// SPDX-License-Identifier: Apache 2\npragma solidity ^0.8.19;\n\n/**\n * @title ITokenMinter\n * @notice interface for minter of tokens that are mintable, burnable, and interchangeable\n * across domains.\n */\ninterface ITokenMinter {\n    function burnLimitsPerMessage(address token) external view returns (uint256);\n\n    function remoteTokensToLocalTokens(bytes32 sourceIdHash) external view returns (address);\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/DecimalMath.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\nimport \"./SafeCast.sol\";\n\n/**\n * @title Utility library used to represent \"decimals\" (fixed point numbers) with integers, with two different levels of precision.\n *\n * They are represented by N * UNIT, where UNIT is the number of decimals of precision in the representation.\n *\n * Examples:\n * 1) Given UNIT = 100\n * then if A = 50, A represents the decimal 0.50\n * 2) Given UNIT = 1000000000000000000\n * then if A = 500000000000000000, A represents the decimal 0.500000000000000000\n *\n * Note: An accompanying naming convention of the postfix \"D<Precision>\" is helpful with this utility. I.e. if a variable \"myValue\" represents a low resolution decimal, it should be named \"myValueD18\", and if it was a high resolution decimal \"myValueD27\". While scaling, intermediate precision decimals like \"myValue45\" could arise. Non-decimals should have no postfix, i.e. just \"myValue\".\n *\n * Important: Multiplication and division operations are currently not supported for high precision decimals. Using these operations on them will yield incorrect results and fail silently.\n */\nlibrary DecimalMath {\n    using SafeCastU256 for uint256;\n    using SafeCastI256 for int256;\n\n    // solhint-disable numcast/safe-cast\n\n    // Numbers representing 1.0 (low precision).\n    uint256 public constant UNIT = 1e18;\n    int256 public constant UNIT_INT = int256(UNIT);\n    uint128 public constant UNIT_UINT128 = uint128(UNIT);\n    int128 public constant UNIT_INT128 = int128(UNIT_INT);\n\n    // Numbers representing 1.0 (high precision).\n    uint256 public constant UNIT_PRECISE = 1e27;\n    int256 public constant UNIT_PRECISE_INT = int256(UNIT_PRECISE);\n    int128 public constant UNIT_PRECISE_INT128 = int128(UNIT_PRECISE_INT);\n\n    // Precision scaling, (used to scale down/up from one precision to the other).\n    uint256 public constant PRECISION_FACTOR = 9; // 27 - 18 = 9 :)\n\n    // solhint-enable numcast/safe-cast\n\n    // -----------------\n    // uint256\n    // -----------------\n\n    /**\n     * @dev Multiplies two low precision decimals.\n     *\n     * Since the two numbers are assumed to be fixed point numbers,\n     * (x * UNIT) * (y * UNIT) = x * y * UNIT ^ 2,\n     * the result is divided by UNIT to remove double scaling.\n     */\n    function mulDecimal(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        return (x * y) / UNIT;\n    }\n\n    /**\n     * @dev Divides two low precision decimals.\n     *\n     * Since the two numbers are assumed to be fixed point numbers,\n     * (x * UNIT) / (y * UNIT) = x / y (Decimal representation is lost),\n     * x is first scaled up to end up with a decimal representation.\n     */\n    function divDecimal(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        return (x * UNIT) / y;\n    }\n\n    /**\n     * @dev Scales up a value.\n     *\n     * E.g. if value is not a decimal, a scale up by 18 makes it a low precision decimal.\n     * If value is a low precision decimal, a scale up by 9 makes it a high precision decimal.\n     */\n    function upscale(uint256 x, uint256 factor) internal pure returns (uint256) {\n        return x * 10 ** factor;\n    }\n\n    /**\n     * @dev Scales down a value.\n     *\n     * E.g. if value is a high precision decimal, a scale down by 9 makes it a low precision decimal.\n     * If value is a low precision decimal, a scale down by 9 makes it a regular integer.\n     *\n     * Scaling down a regular integer would not make sense.\n     */\n    function downscale(uint256 x, uint256 factor) internal pure returns (uint256) {\n        return x / 10 ** factor;\n    }\n\n    // -----------------\n    // uint128\n    // -----------------\n\n    // Note: Overloading doesn't seem to work for similar types, i.e. int256 and int128, uint256 and uint128, etc, so explicitly naming the functions differently here.\n\n    /**\n     * @dev See mulDecimal for uint256.\n     */\n    function mulDecimalUint128(uint128 x, uint128 y) internal pure returns (uint128) {\n        return (x * y) / UNIT_UINT128;\n    }\n\n    /**\n     * @dev See divDecimal for uint256.\n     */\n    function divDecimalUint128(uint128 x, uint128 y) internal pure returns (uint128) {\n        return (x * UNIT_UINT128) / y;\n    }\n\n    /**\n     * @dev See upscale for uint256.\n     */\n    function upscaleUint128(uint128 x, uint256 factor) internal pure returns (uint128) {\n        return x * (10 ** factor).to128();\n    }\n\n    /**\n     * @dev See downscale for uint256.\n     */\n    function downscaleUint128(uint128 x, uint256 factor) internal pure returns (uint128) {\n        return x / (10 ** factor).to128();\n    }\n\n    // -----------------\n    // int256\n    // -----------------\n\n    /**\n     * @dev See mulDecimal for uint256.\n     */\n    function mulDecimal(int256 x, int256 y) internal pure returns (int256) {\n        return (x * y) / UNIT_INT;\n    }\n\n    /**\n     * @dev See divDecimal for uint256.\n     */\n    function divDecimal(int256 x, int256 y) internal pure returns (int256) {\n        return (x * UNIT_INT) / y;\n    }\n\n    /**\n     * @dev See upscale for uint256.\n     */\n    function upscale(int256 x, uint256 factor) internal pure returns (int256) {\n        return x * (10 ** factor).toInt();\n    }\n\n    /**\n     * @dev See downscale for uint256.\n     */\n    function downscale(int256 x, uint256 factor) internal pure returns (int256) {\n        return x / (10 ** factor).toInt();\n    }\n\n    // -----------------\n    // int128\n    // -----------------\n\n    /**\n     * @dev See mulDecimal for uint256.\n     */\n    function mulDecimalInt128(int128 x, int128 y) internal pure returns (int128) {\n        return (x * y) / UNIT_INT128;\n    }\n\n    /**\n     * @dev See divDecimal for uint256.\n     */\n    function divDecimalInt128(int128 x, int128 y) internal pure returns (int128) {\n        return (x * UNIT_INT128) / y;\n    }\n\n    /**\n     * @dev See upscale for uint256.\n     */\n    function upscaleInt128(int128 x, uint256 factor) internal pure returns (int128) {\n        return x * ((10 ** factor).toInt()).to128();\n    }\n\n    /**\n     * @dev See downscale for uint256.\n     */\n    function downscaleInt128(int128 x, uint256 factor) internal pure returns (int128) {\n        return x / ((10 ** factor).toInt().to128());\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * Utilities that convert numeric types avoiding silent overflows.\n */\nimport \"./SafeCast/SafeCastU32.sol\";\nimport \"./SafeCast/SafeCastI32.sol\";\nimport \"./SafeCast/SafeCastI24.sol\";\nimport \"./SafeCast/SafeCastU56.sol\";\nimport \"./SafeCast/SafeCastI56.sol\";\nimport \"./SafeCast/SafeCastU64.sol\";\nimport \"./SafeCast/SafeCastI64.sol\";\nimport \"./SafeCast/SafeCastI128.sol\";\nimport \"./SafeCast/SafeCastI256.sol\";\nimport \"./SafeCast/SafeCastU128.sol\";\nimport \"./SafeCast/SafeCastU160.sol\";\nimport \"./SafeCast/SafeCastU256.sol\";\nimport \"./SafeCast/SafeCastAddress.sol\";\nimport \"./SafeCast/SafeCastBytes32.sol\";\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastAddress.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastAddress {\n    function toBytes32(address x) internal pure returns (bytes32) {\n        return bytes32(uint256(uint160(x)));\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastBytes32.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastBytes32 {\n    function toAddress(bytes32 x) internal pure returns (address) {\n        return address(uint160(uint256(x)));\n    }\n\n    function toUint(bytes32 x) internal pure returns (uint) {\n        return uint(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastI128.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastI128 {\n    error OverflowInt128ToUint128();\n    error OverflowInt128ToInt32();\n\n    function toUint(int128 x) internal pure returns (uint128) {\n        // ----------------<==============o==============>-----------------\n        // ----------------xxxxxxxxxxxxxxxo===============>----------------\n        if (x < 0) {\n            revert OverflowInt128ToUint128();\n        }\n\n        return uint128(x);\n    }\n\n    function to256(int128 x) internal pure returns (int256) {\n        return int256(x);\n    }\n\n    function to32(int128 x) internal pure returns (int32) {\n        // ----------------<==============o==============>-----------------\n        // ----------------xxxxxxxxxxxx<==o==>xxxxxxxxxxxx-----------------\n        if (x < int256(type(int32).min) || x > int256(type(int32).max)) {\n            revert OverflowInt128ToInt32();\n        }\n\n        return int32(x);\n    }\n\n    function zero() internal pure returns (int128) {\n        return int128(0);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastI24.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastI24 {\n    function to256(int24 x) internal pure returns (int256) {\n        return int256(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastI256.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastI256 {\n    error OverflowInt256ToUint256();\n    error OverflowInt256ToInt128();\n    error OverflowInt256ToInt24();\n\n    function to128(int256 x) internal pure returns (int128) {\n        // ----<==========================o===========================>----\n        // ----xxxxxxxxxxxx<==============o==============>xxxxxxxxxxxxx----\n        if (x < int256(type(int128).min) || x > int256(type(int128).max)) {\n            revert OverflowInt256ToInt128();\n        }\n\n        return int128(x);\n    }\n\n    function to24(int256 x) internal pure returns (int24) {\n        // ----<==========================o===========================>----\n        // ----xxxxxxxxxxxxxxxxxxxx<======o=======>xxxxxxxxxxxxxxxxxxxx----\n        if (x < int256(type(int24).min) || x > int256(type(int24).max)) {\n            revert OverflowInt256ToInt24();\n        }\n\n        return int24(x);\n    }\n\n    function toUint(int256 x) internal pure returns (uint256) {\n        // ----<==========================o===========================>----\n        // ----xxxxxxxxxxxxxxxxxxxxxxxxxxxo===============================>\n        if (x < 0) {\n            revert OverflowInt256ToUint256();\n        }\n\n        return uint256(x);\n    }\n\n    function zero() internal pure returns (int256) {\n        return int256(0);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastI32.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastI32 {\n    error OverflowInt32ToUint32();\n\n    function toUint(int32 x) internal pure returns (uint32) {\n        // ----------------------<========o========>----------------------\n        // ----------------------xxxxxxxxxo=========>----------------------\n        if (x < 0) {\n            revert OverflowInt32ToUint32();\n        }\n\n        return uint32(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastI56.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastI56 {\n    error OverflowInt56ToInt24();\n\n    function to24(int56 x) internal pure returns (int24) {\n        // ----------------------<========o========>-----------------------\n        // ----------------------xxx<=====o=====>xxx-----------------------\n        if (x < int256(type(int24).min) || x > int256(type(int24).max)) {\n            revert OverflowInt56ToInt24();\n        }\n\n        return int24(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastI64.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastI64 {\n    error OverflowInt64ToUint64();\n\n    function toUint(int64 x) internal pure returns (uint64) {\n        // ----------------------<========o========>----------------------\n        // ----------------------xxxxxxxxxo=========>----------------------\n        if (x < 0) {\n            revert OverflowInt64ToUint64();\n        }\n\n        return uint64(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastU128.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastU128 {\n    error OverflowUint128ToInt128();\n\n    function to256(uint128 x) internal pure returns (uint256) {\n        return uint256(x);\n    }\n\n    function toInt(uint128 x) internal pure returns (int128) {\n        // -------------------------------o===============>----------------\n        // ----------------<==============o==============>x----------------\n        if (x > uint128(type(int128).max)) {\n            revert OverflowUint128ToInt128();\n        }\n\n        return int128(x);\n    }\n\n    function toBytes32(uint128 x) internal pure returns (bytes32) {\n        return bytes32(uint256(x));\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastU160.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastU160 {\n    function to256(uint160 x) internal pure returns (uint256) {\n        return uint256(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastU256.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastU256 {\n    error OverflowUint256ToUint128();\n    error OverflowUint256ToInt256();\n    error OverflowUint256ToUint64();\n    error OverflowUint256ToUint32();\n    error OverflowUint256ToUint160();\n\n    function to128(uint256 x) internal pure returns (uint128) {\n        // -------------------------------o===============================>\n        // -------------------------------o===============>xxxxxxxxxxxxxxxx\n        if (x > type(uint128).max) {\n            revert OverflowUint256ToUint128();\n        }\n\n        return uint128(x);\n    }\n\n    function to64(uint256 x) internal pure returns (uint64) {\n        // -------------------------------o===============================>\n        // -------------------------------o======>xxxxxxxxxxxxxxxxxxxxxxxxx\n        if (x > type(uint64).max) {\n            revert OverflowUint256ToUint64();\n        }\n\n        return uint64(x);\n    }\n\n    function to32(uint256 x) internal pure returns (uint32) {\n        // -------------------------------o===============================>\n        // -------------------------------o===>xxxxxxxxxxxxxxxxxxxxxxxxxxxx\n        if (x > type(uint32).max) {\n            revert OverflowUint256ToUint32();\n        }\n\n        return uint32(x);\n    }\n\n    function to160(uint256 x) internal pure returns (uint160) {\n        // -------------------------------o===============================>\n        // -------------------------------o==================>xxxxxxxxxxxxx\n        if (x > type(uint160).max) {\n            revert OverflowUint256ToUint160();\n        }\n\n        return uint160(x);\n    }\n\n    function toBytes32(uint256 x) internal pure returns (bytes32) {\n        return bytes32(x);\n    }\n\n    function toInt(uint256 x) internal pure returns (int256) {\n        // -------------------------------o===============================>\n        // ----<==========================o===========================>xxxx\n        if (x > uint256(type(int256).max)) {\n            revert OverflowUint256ToInt256();\n        }\n\n        return int256(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastU32.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastU32 {\n    error OverflowUint32ToInt32();\n\n    function toInt(uint32 x) internal pure returns (int32) {\n        // -------------------------------o=========>----------------------\n        // ----------------------<========o========>x----------------------\n        if (x > uint32(type(int32).max)) {\n            revert OverflowUint32ToInt32();\n        }\n\n        return int32(x);\n    }\n\n    function to256(uint32 x) internal pure returns (uint256) {\n        return uint256(x);\n    }\n\n    function to56(uint32 x) internal pure returns (uint56) {\n        return uint56(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastU56.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastU56 {\n    error OverflowUint56ToInt56();\n\n    function toInt(uint56 x) internal pure returns (int56) {\n        // -------------------------------o=========>----------------------\n        // ----------------------<========o========>x----------------------\n        if (x > uint56(type(int56).max)) {\n            revert OverflowUint56ToInt56();\n        }\n\n        return int56(x);\n    }\n}\n"
      },
      "node_modules/@synthetixio/core-contracts/contracts/utils/SafeCast/SafeCastU64.sol": {
        "content": "//SPDX-License-Identifier: MIT\npragma solidity >=0.8.11 <0.9.0;\n\n/**\n * @title See SafeCast.sol.\n */\nlibrary SafeCastU64 {\n    error OverflowUint64ToInt64();\n\n    function toInt(uint64 x) internal pure returns (int64) {\n        // -------------------------------o=========>----------------------\n        // ----------------------<========o========>x----------------------\n        if (x > uint64(type(int64).max)) {\n            revert OverflowUint64ToInt64();\n        }\n\n        return int64(x);\n    }\n\n    function to256(uint64 x) internal pure returns (uint256) {\n        return uint256(x);\n    }\n}\n"
      },
      "src/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n/**\n * @title Initializable module\n */\nlibrary Initializable {\n    // ------- Storage -------\n    struct InitializableStorageData {\n        bool initialized;\n    }\n\n    error AlreadyInitialized();\n    error NotInitialized();\n\n    /**\n     * @dev Returns the account stored at the specified account id.\n     */\n    function getStorage() internal pure returns (InitializableStorageData storage data) {\n        bytes32 slot = keccak256(abi.encode(\"io.infinex.InitializableStorage\"));\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            data.slot := slot\n        }\n    }\n\n    // ------- Implementation -------\n    function initialize() internal {\n        InitializableStorageData storage data = getStorage();\n\n        // Note: We don't use onlyUninitialized here to save gas by preventing a double call to load().\n        if (data.initialized) revert AlreadyInitialized();\n\n        data.initialized = true;\n    }\n\n    modifier onlyInitialized() {\n        if (!getStorage().initialized) revert NotInitialized();\n        _;\n    }\n\n    modifier onlyUninitialized() {\n        if (getStorage().initialized) revert AlreadyInitialized();\n        _;\n    }\n}\n"
      },
      "src/accounts/modules/BridgingModule.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\nimport { BridgeIntegrations } from \"src/integrations/BridgeIntegrations.sol\";\nimport { SecurityModifiers } from \"src/accounts/utils/SecurityModifiers.sol\";\nimport { Bridge } from \"src/accounts/storage/Bridge.sol\";\nimport { Account } from \"src/accounts/storage/Account.sol\";\n\nimport { IBridgingModule } from \"src/interfaces/accounts/IBridgingModule.sol\";\nimport { ICircleIntegration } from \"wormhole-circle-integration/interfaces/ICircleIntegration.sol\";\n\nimport { DecimalScaling } from \"src/libraries/DecimalScaling.sol\";\nimport { Error } from \"src/libraries/Error.sol\";\nimport { SolanaUtils } from \"src/libraries/SolanaUtils.sol\";\n\n//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n\ncontract BridgingModule is IBridgingModule, SecurityModifiers {\n    using SafeERC20 for IERC20;\n\n    /**\n     * @notice Maximum amount that can be bridged in one transaction.\n     * @return The maximum bridging amount.\n     */\n    function getBridgeMaxAmount() external view returns (uint256) {\n        return BridgeIntegrations._getBridgeMaxAmount();\n    }\n\n    /**\n     * @notice Process an attested Wormhole bridge and Circle CCTP message to redeem tokens that were bridged.\n     * @param _redeemParams The parameters for redeeming tokens.\n     * redeemParams: {\n     * encodedWormholeMessage,\n     * circleBridgeMessage,\n     * circleAttestation\n     * }\n     */\n    function processWormholeBridgeMessage(ICircleIntegration.RedeemParameters calldata _redeemParams) external {\n        BridgeIntegrations._processWormholeBridgeMessage(_redeemParams);\n    }\n\n    /**\n     * @notice Bridge USDC tokens from the current address to the same address on the destination chain, using Wormhole.\n     * @param _amount is the amount to be sent in 18 decimals scaled to 6 for usdc.\n     * @param _wormholeChainId is the allowlisted wormhole chain ID that usdc can be sent to.\n     * @dev Requires the sender to be the sudo key or operation key.\n     */\n    function bridgeUSDCWithWormholeEVM(uint256 _amount, uint16 _wormholeChainId) external requiresAuthorizedOperationsParty {\n        if (!Account._infinexProtocolConfig().isSupportedWormholeChainId(_wormholeChainId)) revert Error.InvalidWormholeChainId();\n\n        _bridgeUSDCWithWormhole(_amount, bytes32(uint256(uint160(address(this)))), _wormholeChainId);\n    }\n\n    /**\n     * @notice Bridge USDC tokens from the current chain to Solana, using CCTP.\n     * @param _amount is the amount to be sent in 18 decimals scaled to 6 decimals for usdc.\n     * @param _solanaAccount The Solana account.\n     * @param _solanaTokenAccount The Solana token account.\n     * @param _accountBump A number used to ensure the derived address for the account is unique.\n     * @param _tokenAccountBump A number used to ensure the derived for the token account address is unique\n     * @dev The amount defined in the amount will be sent as usdc to the specified destination chain.\n     * @dev Requires the sender to be the sudo key or operation key.\n     */\n    function bridgeUSDCWithCCTPSolana(\n        uint256 _amount,\n        bytes32 _solanaAccount,\n        bytes32 _solanaTokenAccount,\n        uint8 _accountBump,\n        uint8 _tokenAccountBump\n    ) external requiresAuthorizedOperationsParty {\n        uint32 solanaDestinationDomain = Account._infinexProtocolConfig().getSolanaCCTPDestinationDomain();\n\n        (\n            bytes memory walletSeed,\n            bytes memory fixedPDASeed,\n            bytes32 walletProgramAddress,\n            bytes32 tokenMintAddress,\n            bytes32 tokenProgramAddress,\n            bytes32 associatedTokenProgramAddress\n        ) = Account._infinexProtocolConfig().getSolanaConfiguration();\n\n        SolanaUtils.AccountArgs memory accountArgs = SolanaUtils.AccountArgs({\n            account: address(this),\n            solanaAccount: _solanaAccount,\n            solanaWalletSeed: walletSeed,\n            solanaFixedPDASeed: fixedPDASeed,\n            solanaWalletProgramAddress: walletProgramAddress,\n            accountBump: _accountBump\n        });\n\n        SolanaUtils.TokenAccountArgs memory tokenAccountArgs = SolanaUtils.TokenAccountArgs({\n            solanaTokenAccount: _solanaTokenAccount,\n            solanaTokenMintAddress: tokenMintAddress,\n            solanaTokenProgramAddress: tokenProgramAddress,\n            solanaAssociatedTokenProgramAddress: associatedTokenProgramAddress,\n            tokenAccountBump: _tokenAccountBump\n        });\n\n        if (!SolanaUtils.isTokenAccountValid(accountArgs, tokenAccountArgs)) revert Error.InvalidSolanaAddress();\n\n        _bridgeUSDCWithCCTP(_amount, _solanaTokenAccount, solanaDestinationDomain);\n    }\n\n    /**\n     * @notice Internal function to bridge USDC tokens from the current chain to the destination chain.\n     * @param _amount amount of USDC in 18 decimals.\n     * @param _destinationAddress destination address to recieve the bridged tokens.\n     * @param _destinationDomain the id of the destination chain.\n     */\n    function _bridgeUSDCWithCCTP(uint256 _amount, bytes32 _destinationAddress, uint32 _destinationDomain) internal {\n        address USDC = Bridge._USDC();\n\n        uint256 scaledAmount = _scaleAndCheckUSDCAmount(_amount, USDC);\n\n        emit BridgeToDomainStartedCCTP(USDC, _destinationDomain, _destinationAddress, scaledAmount);\n\n        BridgeIntegrations._CCTPBridgeUSDC(scaledAmount, _destinationAddress, _destinationDomain);\n    }\n\n    /**\n     * @notice Internal function to bridge USDC tokens from the current chain to the destination chain.\n     * @param _amount amount of USDC in 18 decimals.\n     * @param _destinationAddress destination address to recieve the bridged tokens.\n     * @param _wormholeChainId the id of the destination chain.\n     */\n    function _bridgeUSDCWithWormhole(uint256 _amount, bytes32 _destinationAddress, uint16 _wormholeChainId) internal {\n        address USDC = Bridge._USDC();\n\n        uint256 scaledAmount = _scaleAndCheckUSDCAmount(_amount, USDC);\n\n        emit BridgeToChainIdStartedWormhole(USDC, _wormholeChainId, _destinationAddress, scaledAmount);\n\n        BridgeIntegrations._wormholeBridgeUSDC(scaledAmount, _destinationAddress, _wormholeChainId);\n    }\n\n    /**\n     * @notice scales and checks the USDC amount that can be sent to the bridge.\n     * @param _amount The amount to send in 18 decimals.\n     * @param _USDC Address of the USDC contract.\n     * @return scaled amount in the denoted token decimals.\n     */\n    function _scaleAndCheckUSDCAmount(uint256 _amount, address _USDC) internal returns (uint256) {\n        uint256 scaledAmount = uint256(DecimalScaling.scaleTo(int256(_amount), IERC20Metadata(_USDC).decimals()));\n\n        if (scaledAmount > BridgeIntegrations._getBridgeMaxAmount()) revert Error.BridgeMaxAmountExceeded();\n\n        if (scaledAmount > IERC20(_USDC).balanceOf(address(this))) revert Error.InsufficientBalance();\n\n        return scaledAmount;\n    }\n}\n"
      },
      "src/accounts/storage/Account.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { IInfinexProtocolConfigBeacon } from \"src/interfaces/beacons/IInfinexProtocolConfigBeacon.sol\";\n\n/**\n * @title Account storage struct\n */\nlibrary Account {\n    struct Data {\n        address infinexProtocolConfigBeacon; // Address of the Infinex Protocol Config Beacon\n        uint256 referralTokenId; // ID of the referral token\n    }\n\n    /**\n     * @dev Returns the account stored at the specified account id.\n     */\n    function getStorage() internal pure returns (Data storage data) {\n        bytes32 s = keccak256(abi.encode(\"io.infinex.AccountStorage\"));\n        assembly {\n            data.slot := s\n        }\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                VIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Get the Infinex Protocol Config\n     * @return The Infinex Protocol Config Beacon\n     */\n    function _infinexProtocolConfig() internal view returns (IInfinexProtocolConfigBeacon) {\n        Data storage data = getStorage();\n        return IInfinexProtocolConfigBeacon(data.infinexProtocolConfigBeacon);\n    }\n}\n"
      },
      "src/accounts/storage/Bridge.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n/**\n * @title Bridging related storage struct and functions\n */\nlibrary Bridge {\n    struct Data {\n        // Parameters for interacting with USDC and the Circle Bridge\n        address circleBridge;\n        address circleMinter;\n        address USDC;\n        address wormholeCircleBridge;\n        uint32 defaultDestinationCCTPDomain;\n        uint16 defaultDestinationWormholeChainId;\n    }\n\n    /**\n     * @dev Returns the account stored at the specified account id.\n     */\n    function getStorage() internal pure returns (Data storage data) {\n        bytes32 s = keccak256(abi.encode(\"io.infinex.Bridge\"));\n        assembly {\n            data.slot := s\n        }\n    }\n\n    /**\n     * @dev Returns the address of the USDC token.\n     */\n    function _USDC() internal view returns (address) {\n        return getStorage().USDC;\n    }\n\n    /**\n     * @dev Returns the address of the Circle Bridge contract.\n     */\n    // slither-disable-next-line dead-code\n    function _circleBridge() internal view returns (address) {\n        return getStorage().circleBridge;\n    }\n\n    /**\n     * @dev Returns the address of the Circle Minter contract.\n     * The minter contract stores the maximum amount of tokens that can be minted or burned.\n     * The contract is responsible for minting and burning tokens as part of a bridging transaction.\n     */\n    // slither-disable-next-line dead-code\n    function _circleMinter() internal view returns (address) {\n        return getStorage().circleMinter;\n    }\n\n    /**\n     * @dev Returns the address of the Wormhole Circle Bridge contract.\n     */\n    function _wormholeCircleBridge() internal view returns (address) {\n        return getStorage().wormholeCircleBridge;\n    }\n\n    /**\n     * @dev Returns the CCTP domain of the default destination chain.\n     */\n    // slither-disable-next-line dead-code\n    function _defaultDestinationCCTPDomain() internal view returns (uint32) {\n        return getStorage().defaultDestinationCCTPDomain;\n    }\n\n    /**\n     * @dev Returns the Wormhole chain id of the default destination chain.\n     */\n    // slither-disable-next-line dead-code\n    function _defaultDestinationWormholeChainId() internal view returns (uint16) {\n        return getStorage().defaultDestinationWormholeChainId;\n    }\n}\n"
      },
      "src/accounts/storage/EIP712.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.21;\n\nimport { MessageHashUtils } from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\n\nlibrary EIP712 {\n    bytes32 private constant TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.EIP712\n    struct EIP712Storage {\n        /// @custom:oz-renamed-from _HASHED_NAME\n        bytes32 _hashedName;\n        /// @custom:oz-renamed-from _HASHED_VERSION\n        bytes32 _hashedVersion;\n        string _name;\n        string _version;\n    }\n\n    function _getEIP712Storage() private pure returns (EIP712Storage storage data) {\n        bytes32 s = keccak256(abi.encode(\"io.infinex.EIP712\"));\n        assembly {\n            data.slot := s\n        }\n    }\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    function __EIP712_init(string memory name, string memory version) internal {\n        __EIP712_init_unchained(name, version);\n    }\n\n    function __EIP712_init_unchained(string memory name, string memory version) internal {\n        EIP712Storage storage $ = _getEIP712Storage();\n        $._name = name;\n        $._version = version;\n\n        // Reset prior values in storage if upgrading\n        $._hashedName = 0;\n        $._hashedVersion = 0;\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        return _buildDomainSeparator();\n    }\n\n    function _buildDomainSeparator() private view returns (bytes32) {\n        return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view returns (bytes32) {\n        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /**\n     * @dev See {IERC-5267}.\n     */\n    function eip712Domain()\n        internal\n        view\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        )\n    {\n        EIP712Storage storage $ = _getEIP712Storage();\n        // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n        // and the EIP712 domain is not reliable, as it will be missing name and version.\n        // solhint-disable-next-line gas-custom-errors\n        require($._hashedName == 0 && $._hashedVersion == 0, \"EIP712: Uninitialized\");\n\n        return (\n            hex\"0f\", // 01111\n            _EIP712Name(),\n            _EIP712Version(),\n            block.chainid,\n            address(this),\n            bytes32(0),\n            new uint256[](0)\n        );\n    }\n\n    /**\n     * @dev The name parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712Name() internal view returns (string memory) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        return $._name;\n    }\n\n    /**\n     * @dev The version parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712Version() internal view returns (string memory) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        return $._version;\n    }\n\n    /**\n     * @dev The hash of the name parameter for the EIP712 domain.\n     *\n     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n     */\n    function _EIP712NameHash() internal view returns (bytes32) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        string memory name = _EIP712Name();\n        if (bytes(name).length > 0) {\n            return keccak256(bytes(name));\n        } else {\n            // If the name is empty, the contract may have been upgraded without initializing the new storage.\n            // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n            bytes32 hashedName = $._hashedName;\n            if (hashedName != 0) {\n                return hashedName;\n            } else {\n                return keccak256(\"\");\n            }\n        }\n    }\n\n    /**\n     * @dev The hash of the version parameter for the EIP712 domain.\n     *\n     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n     */\n    function _EIP712VersionHash() internal view returns (bytes32) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        string memory version = _EIP712Version();\n        if (bytes(version).length > 0) {\n            return keccak256(bytes(version));\n        } else {\n            // If the version is empty, the contract may have been upgraded without initializing the new storage.\n            // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n            bytes32 hashedVersion = $._hashedVersion;\n            if (hashedVersion != 0) {\n                return hashedVersion;\n            } else {\n                return keccak256(\"\");\n            }\n        }\n    }\n}\n"
      },
      "src/accounts/storage/SecurityKeys.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { MessageHashUtils } from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\n\nimport { Error } from \"src/libraries/Error.sol\";\n\n/**\n * @title Security keys storage and functions\n */\nlibrary SecurityKeys {\n    using MessageHashUtils for bytes32;\n\n    // slither-disable-next-line constable-states,unused-state\n    bytes32 internal constant _SIGNATURE_REQUEST_TYPEHASH = keccak256(\n        \"Request(address _address,address _address2,uint256 _uint256,bytes32 _nonce,uint32 _uint32,bool _bool,bytes4 _selector)\"\n    );\n\n    struct Data {\n        mapping(bytes32 => bool) nonces; // Mapping of nonces\n        mapping(address => bool) operationKeys;\n        mapping(address => bool) recoveryKeys;\n        mapping(address => bool) sudoKeys;\n        uint16 sudoKeysCounter;\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tEVENTS / ERRORS\n    ///////////////////////////////////////////////////////////////*/\n\n    event NonceConsumed(bytes32 nonce);\n    event OperationKeyStatusSet(address operationKey, bool isValid);\n    event RecoveryKeyStatusSet(address recoveryKey, bool isValid);\n    event SudoKeyStatusSet(address sudoKey, bool isValid);\n\n    /**\n     * @dev Returns the account stored at the specified account id.\n     */\n    function getStorage() internal pure returns (Data storage data) {\n        bytes32 s = keccak256(abi.encode(\"io.infinex.SecurityKeys\"));\n        assembly {\n            data.slot := s\n        }\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                    VIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Check if the provided operation key is valid\n     * @param _operationKey The operation key to check\n     * @return A boolean indicating if the operation key is valid\n     */\n    function _isValidOperationKey(address _operationKey) internal view returns (bool) {\n        Data storage data = getStorage();\n        return data.operationKeys[_operationKey];\n    }\n\n    /**\n     * @notice Check if the provided recovery key is valid\n     * @param _recoveryKey The recovery key to check\n     * @return A boolean indicating if the recovery key is valid\n     */\n    function _isValidRecoveryKey(address _recoveryKey) internal view returns (bool) {\n        Data storage data = getStorage();\n        return data.recoveryKeys[_recoveryKey];\n    }\n\n    /**\n     * @notice Check if the provided sudo key is valid\n     * @param _sudoKey The sudo key to check\n     * @return A boolean indicating if the sudo key is valid\n     */\n    function _isValidSudoKey(address _sudoKey) internal view returns (bool) {\n        Data storage data = getStorage();\n        return data.sudoKeys[_sudoKey];\n    }\n\n    /**\n     * @notice Check if the provided nonce is valid\n     * @param _nonce The nonce to check\n     * @return A boolean indicating if the nonce is valid\n     */\n    function _isValidNonce(bytes32 _nonce) internal view returns (bool) {\n        Data storage data = getStorage();\n        return !data.nonces[_nonce];\n    }\n\n    /*///////////////////////////////////////////////////////////////\n                                MUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Set an operation key for the account\n     * @param _operationKey The operation key address to be set\n     * @param _isValid Whether the key is to be set as valid or invalid\n     */\n    function _setOperationKeyStatus(address _operationKey, bool _isValid) internal {\n        Data storage data = getStorage();\n        if (_operationKey == address(0)) revert Error.NullAddress();\n        if (data.operationKeys[_operationKey]) {\n            if (_isValid) revert Error.KeyAlreadyValid();\n        } else {\n            if (!_isValid) revert Error.KeyAlreadyInvalid();\n        }\n        emit OperationKeyStatusSet(_operationKey, _isValid);\n        data.operationKeys[_operationKey] = _isValid;\n    }\n\n    /**\n     * @notice Set a new recovery key for the account\n     * @param _recoveryKey The recovery key address to be set\n     * @param _isValid Whether the key is to be set as valid or invalid\n     */\n    function _setRecoveryKeyStatus(address _recoveryKey, bool _isValid) internal {\n        Data storage data = getStorage();\n        if (_recoveryKey == address(0)) revert Error.NullAddress();\n        if (data.recoveryKeys[_recoveryKey]) {\n            if (_isValid) revert Error.KeyAlreadyValid();\n        } else {\n            if (!_isValid) revert Error.KeyAlreadyInvalid();\n        }\n        emit RecoveryKeyStatusSet(_recoveryKey, _isValid);\n        data.recoveryKeys[_recoveryKey] = _isValid;\n    }\n\n    /**\n     * @notice Set a sudo key for the account\n     * @param _sudoKey The sudo key address to be set\n     * @param _isValid Whether the key is to be set as valid or invalid\n     */\n    function _setSudoKeyStatus(address _sudoKey, bool _isValid) internal {\n        Data storage data = getStorage();\n        if (_sudoKey == address(0)) revert Error.NullAddress();\n        if (data.sudoKeys[_sudoKey]) {\n            if (_isValid) revert Error.KeyAlreadyValid();\n            if (data.sudoKeysCounter == 1) revert Error.CannotRemoveLastKey();\n            --data.sudoKeysCounter;\n        } else {\n            if (!_isValid) revert Error.KeyAlreadyInvalid();\n            ++data.sudoKeysCounter;\n        }\n        emit SudoKeyStatusSet(_sudoKey, _isValid);\n        data.sudoKeys[_sudoKey] = _isValid;\n    }\n\n    /**\n     * @notice Consumes a nonce, marking it as used\n     * @param _nonce The nonce to consume\n     * @dev Reverts if nonce has already been consumed.\n     */\n    function _consumeNonce(bytes32 _nonce) internal returns (bool) {\n        Data storage data = getStorage();\n        if (data.nonces[_nonce]) revert Error.InvalidNonce(_nonce);\n        emit NonceConsumed(_nonce);\n        data.nonces[_nonce] = true;\n        return true;\n    }\n}\n"
      },
      "src/accounts/utils/RequestTypes.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\ncontract RequestTypes {\n    struct Request {\n        address _address;\n        address _address2;\n        uint256 _uint256;\n        bytes32 _nonce;\n        uint32 _uint32;\n        bool _bool;\n        bytes4 _selector;\n    }\n}\n"
      },
      "src/accounts/utils/SecurityModifiers.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport { MessageHashUtils } from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\n\nimport { RequestTypes } from \"./RequestTypes.sol\";\n\nimport { ERC2771Context } from \"src/forwarder/ERC2771Context.sol\";\nimport { Account } from \"../storage/Account.sol\";\nimport { EIP712 } from \"../storage/EIP712.sol\";\nimport { SecurityKeys } from \"../storage/SecurityKeys.sol\";\n\nimport { Error } from \"src/libraries/Error.sol\";\n\ncontract SecurityModifiers {\n    using MessageHashUtils for bytes32;\n\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\tEVENTS / ERRORS\n    ///////////////////////////////////////////////////////////////*/\n\n    event PayloadProcessed(RequestTypes.Request request, bytes signature);\n\n    /*///////////////////////////////////////////////////////////////\n                            SECURITY CHECK MODIFIERS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Modifier to check if the request requires an sudo key.\n     * @param _request The request data.\n     * @param _signature The sudo key signature to process the transaction.\n     */\n    modifier requiresSudoKey(RequestTypes.Request calldata _request, bytes calldata _signature) {\n        if (_request._selector != msg.sig) {\n            revert Error.InvalidRequest();\n        }\n        bytes32 messageHash = EIP712._hashTypedDataV4(keccak256(abi.encode(SecurityKeys._SIGNATURE_REQUEST_TYPEHASH, _request)));\n\n        address sudoKey = ECDSA.recover(messageHash, _signature);\n        if (!SecurityKeys._isValidSudoKey(sudoKey)) {\n            revert Error.InvalidKeySignature(sudoKey);\n        }\n\n        SecurityKeys._consumeNonce(_request._nonce);\n        emit PayloadProcessed(_request, _signature);\n\n        _;\n    }\n\n    /**\n     * @notice Modifier to check if the sender is an sudo key.\n     */\n    modifier requiresSudoKeySender() {\n        if (!SecurityKeys._isValidSudoKey(ERC2771Context._msgSender())) {\n            revert Error.InvalidKeySignature(ERC2771Context._msgSender());\n        }\n\n        _;\n    }\n\n    /**\n     * @notice Modifier to check if the sender is a sudo or operation key.\n     * If not, it reverts with an error message.\n     */\n    modifier requiresAuthorizedOperationsParty() {\n        address sender = ERC2771Context._msgSender();\n        if (!SecurityKeys._isValidSudoKey(sender) && !SecurityKeys._isValidOperationKey(sender)) {\n            revert Error.InvalidKeySignature(sender);\n        }\n        _;\n    }\n\n    /**\n     * @notice Modifier to check if the sender is an sudo key, a recovery key or a trusted recovery keeper.\n     * If not, it reverts with an error message.\n     */\n    modifier requiresAuthorizedRecoveryParty() {\n        address sender = ERC2771Context._msgSender();\n        if (\n            !SecurityKeys._isValidSudoKey(sender) && !SecurityKeys._isValidRecoveryKey(sender)\n                && !Account._infinexProtocolConfig().isTrustedRecoveryKeeper(sender)\n        ) {\n            revert Error.InvalidKeySignature(sender);\n        }\n        _;\n    }\n\n    /**\n     * @notice Modifier to check if the sender is a trusted keeper for recovery.\n     * If not, reverts with an error message.\n     */\n    modifier requiresTrustedRecoveryKeeper() {\n        if (!Account._infinexProtocolConfig().isTrustedRecoveryKeeper(ERC2771Context._msgSender())) {\n            revert Error.InvalidKeySignature(ERC2771Context._msgSender());\n        }\n        _;\n    }\n}\n"
      },
      "src/forwarder/ERC2771Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// Originally sourced from OpenZeppelin Contracts (last updated v4.9.3) (metatx/ERC2771Context.sol)\n\npragma solidity ^0.8.21;\n\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { Initializable } from \"../Initializable.sol\";\n\nimport { Error } from \"src/libraries/Error.sol\";\n\n/**\n * @dev Context variant with ERC2771 support.\n */\nlibrary ERC2771Context {\n    event TrustedForwarderAdded(address forwarder);\n    event TrustedForwarderRemoved(address forwarder);\n\n    struct Data {\n        EnumerableSet.AddressSet trustedForwarders;\n    }\n\n    function getStorage() internal pure returns (Data storage data) {\n        bytes32 slot = keccak256(abi.encode(\"io.infinex.ERC2771Context\"));\n        assembly {\n            data.slot := slot\n        }\n    }\n\n    function initialize(address initialTrustedForwarder) internal {\n        Initializable.initialize();\n\n        EnumerableSet.add(getStorage().trustedForwarders, initialTrustedForwarder);\n    }\n\n    function isTrustedForwarder(address forwarder) internal view returns (bool) {\n        return EnumerableSet.contains(getStorage().trustedForwarders, forwarder);\n    }\n\n    function trustedForwarder() internal view returns (address[] memory) {\n        return EnumerableSet.values(getStorage().trustedForwarders);\n    }\n\n    function _addTrustedForwarder(address forwarder) internal returns (bool) {\n        if (EnumerableSet.add(getStorage().trustedForwarders, forwarder)) {\n            emit TrustedForwarderAdded(forwarder);\n            return true;\n        } else {\n            revert Error.AlreadyExists();\n        }\n    }\n\n    function _removeTrustedForwarder(address forwarder) internal returns (bool) {\n        if (EnumerableSet.remove(getStorage().trustedForwarders, forwarder)) {\n            emit TrustedForwarderRemoved(forwarder);\n            return true;\n        } else {\n            revert Error.DoesNotExist();\n        }\n    }\n\n    function _msgSender() internal view returns (address) {\n        uint256 calldataLength = msg.data.length;\n        uint256 contextSuffixLength = _contextSuffixLength();\n        if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {\n            return address(bytes20(msg.data[calldataLength - contextSuffixLength:]));\n        } else {\n            return msg.sender;\n        }\n    }\n\n    // slither-disable-start dead-code\n    function _msgData() internal view returns (bytes calldata) {\n        uint256 calldataLength = msg.data.length;\n        uint256 contextSuffixLength = _contextSuffixLength();\n        if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {\n            return msg.data[:calldataLength - contextSuffixLength];\n        } else {\n            return msg.data;\n        }\n    }\n\n    /**\n     * @dev ERC-2771 specifies the context as being a single address (20 bytes).\n     */\n    function _contextSuffixLength() internal pure returns (uint256) {\n        return 20;\n    }\n    // slither-disable-end dead-code\n}\n"
      },
      "src/integrations/BridgeIntegrations.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport { Bridge } from \"src/accounts/storage/Bridge.sol\";\nimport { Account } from \"src/accounts/storage/Account.sol\";\n\nimport { Error } from \"src/libraries/Error.sol\";\n\nimport { ITokenMessenger } from \"src/interfaces/circle/ITokenMessenger.sol\";\nimport { ITokenMinter } from \"src/interfaces/circle/ITokenMinter.sol\";\nimport { ICircleIntegration } from \"wormhole-circle-integration/interfaces/ICircleIntegration.sol\";\n\n//       c=<\n//        |\n//        |   ////\\    1@2\n//    @@  |  /___\\**   @@@2\t\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   @@@  |  |~L~ |*   @@@@@@\t\t@@@  @@@@@        @@@@    @@@ @@@@    @@@  @@@@@@@@ @@@@ @@@@    @@@ @@@@@@@@@ @@@@   @@@@\n//  @@@@@ |   \\=_/8    @@@@1@@\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@   @@@ @@@@@@@@@ @@@@ @@@@@  @@@@ @@@@@@@@@  @@@@ @@@@\n// @@@@@@| _ /| |\\__ @@@@@@@@2\t\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@ @@@ @@@@      @@@@ @@@@@@ @@@@ @@@         @@@@@@@\n// 1@@@@@@|\\  \\___/)   @@1@@@@@2\t~~~  ~~~~~  @@@@  ~~@@    ~~~ ~~~~~~~~~~~ ~~~~      ~~~~ ~~~~~~~~~~~ ~@@          @@@@@\n// 2@@@@@ |  \\ \\ / |     @@@@@@2\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@@@    @@@@@\n// 2@@@@  |_  >   <|__    @@1@12\t@@@  @@@@@  @@@@  @@@@    @@@ @@@@ @@@@@@ @@@@      @@@@ @@@@ @@@@@@ @@@         @@@@@@@\n// @@@@  / _|  / \\/    \\   @@1@\t\t@@@   @@@   @@@@  @@@@    @@@ @@@@  @@@@@ @@@@      @@@@ @@@@  @@@@@ @@@@@@@@@  @@@@ @@@@\n//  @@ /  |^\\/   |      |   @@1\t\t@@@         @@@@  @@@@    @@@ @@@@    @@@ @@@@      @@@@ @@@    @@@@ @@@@@@@@@ @@@@   @@@@\n//   /     / ---- \\ \\\\\\=    @@\t\t@@@@@@@@@@@@@@@@@@@@@@\n//   \\___/ --------  ~~    @@@\n//     @@  | |   | |  --   @@\n// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————\n\n/**\n * @notice A library for bridging tokens via third parties such as Wormhole and Circle.\n */\nlibrary BridgeIntegrations {\n    event TokenBridged(\n        address indexed token, bytes32 indexed destinationAddress, uint32 indexed destinationDomain, address bridge, uint256 amount\n    );\n\n    event TokenBridgeMessageRedeemed(address indexed token, uint32 indexed sourceDomain, uint256 amount);\n\n    /**\n     * @notice Bridge USDC tokens to another chain using the Circle Bridge.\n     * @param _amount The amount of USDC tokens to bridge.\n     * @param _destinationAddress The address on the destination domain to receive the bridged tokens.\n     * @param _destinationDomain The address of the destination domain.\n     */\n    function _CCTPBridgeUSDC(uint256 _amount, bytes32 _destinationAddress, uint32 _destinationDomain) internal {\n        _checkExceedsMinBridgeAmount(_amount);\n        address USDC = Bridge._USDC();\n        address circleBridge = Bridge._circleBridge();\n        // Call the bridge with the necessary approvals\n        IERC20(USDC).approve(circleBridge, _amount);\n        emit TokenBridged(USDC, _destinationAddress, _destinationDomain, circleBridge, _amount);\n        ITokenMessenger(circleBridge).depositForBurn(\n            _amount,\n            _destinationDomain,\n            // The circle bridge expects the mint recipient address as a bytes32\n            _destinationAddress,\n            USDC\n        );\n    }\n\n    /**\n     * @notice Bridge USDC tokens to another chain using the Wormhole facilitated Circle Bridge.\n     * @param _amount The amount of USDC tokens to bridge.\n     * @param _destinationAddress The address on the destination domain to receive the bridged tokens.\n     * @param _destinationWormholeChainId The wormhole chain id of the destination chain.\n     */\n    function _wormholeBridgeUSDC(uint256 _amount, bytes32 _destinationAddress, uint16 _destinationWormholeChainId) internal {\n        _checkExceedsMinBridgeAmount(_amount);\n        if (!_validateWormholeChainId(_destinationWormholeChainId)) revert Error.InvalidWormholeChainId();\n        address USDC = Bridge._USDC();\n        address wormholeCircleBridge = Bridge._wormholeCircleBridge();\n        ICircleIntegration.TransferParameters memory transferParameters = ICircleIntegration.TransferParameters({\n            token: USDC,\n            amount: _amount,\n            targetChain: _destinationWormholeChainId,\n            // The circle bridge expects the mint recipient address as a bytes32\n            mintRecipient: _destinationAddress\n        });\n\n        // Call the bridge with the necessary approvals\n        IERC20(USDC).approve(wormholeCircleBridge, _amount);\n        emit TokenBridged(USDC, _destinationAddress, uint32(_destinationWormholeChainId), wormholeCircleBridge, _amount);\n        ICircleIntegration(wormholeCircleBridge).transferTokensWithPayload(transferParameters, 0, abi.encode(msg.sender));\n    }\n\n    /**\n     * @notice Process a Wormhole Bridge message to complete a bridging transaction.\n     * @param _redeemParams The redeem parameters for the bridge message.\n     */\n    function _processWormholeBridgeMessage(ICircleIntegration.RedeemParameters calldata _redeemParams) internal {\n        // Call the bridge with the payload\n        ICircleIntegration circleIntegration = ICircleIntegration(Bridge._wormholeCircleBridge());\n\n        ICircleIntegration.DepositWithPayload memory depositWithPayload = circleIntegration.redeemTokensWithPayload(_redeemParams);\n        emit TokenBridgeMessageRedeemed(\n            address(uint160(uint256(depositWithPayload.token))), depositWithPayload.sourceDomain, depositWithPayload.amount\n        );\n    }\n\n    /**\n     * @notice Validate the wormhole chain id.\n     * @param _chainId The wormhole chain id.\n     * @return isValid A boolean indicating if the chain id is valid or not.\n     */\n    function _validateWormholeChainId(uint16 _chainId) internal view returns (bool isValid) {\n        if (ICircleIntegration(Bridge._wormholeCircleBridge()).getRegisteredEmitter(_chainId) == bytes32(0)) return false;\n        return true;\n    }\n\n    /**\n     * @notice Checks the amount given is greater than the minimum bridging amount.\n     * @param _amount The amount to be checked against the minimum.\n     */\n    function _checkExceedsMinBridgeAmount(uint256 _amount) internal view {\n        if (_amount < Account._infinexProtocolConfig().getMinimumUSDCBridgeAmount()) revert Error.InsufficientBridgeAmount();\n    }\n\n    /**\n     * @notice Internal function to get the maximum amount that can be bridged.\n     * @return the maximum bridging amount.\n     */\n    function _getBridgeMaxAmount() internal view returns (uint256) {\n        return ITokenMinter(Bridge._circleMinter()).burnLimitsPerMessage(Bridge._USDC());\n    }\n\n    /**\n     * @notice Internal function to calculate the amount of USDC tokens to bridge.\n     * @dev This function retrieves the balance of USDC tokens held by the contract and performs checks on the amount.\n     * @return amountToBridge The amount of USDC tokens to bridge in native decimals (6).\n     * @return isTotalAmount A boolean indicating if the amount to bridge is the full balance of the account.\n     */\n    function _getUSDCBridgeableAmount(uint256 _amount) internal view returns (uint256 amountToBridge, bool isTotalAmount) {\n        // Check that the amount is less than the maximum bridge amount, if not, just bridge the max\n        uint256 maxBridgeAmount = _getBridgeMaxAmount();\n\n        if (_amount > maxBridgeAmount) {\n            amountToBridge = maxBridgeAmount;\n            isTotalAmount = false;\n        } else {\n            amountToBridge = _amount;\n            isTotalAmount = true;\n        }\n    }\n}\n"
      },
      "src/interfaces/accounts/IBridgingModule.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nimport { ICircleIntegration } from \"wormhole-circle-integration/interfaces/ICircleIntegration.sol\";\n\n/**\n * @title Bridging funds from one chain to another to the same account.\n */\ninterface IBridgingModule {\n    /*///////////////////////////////////////////////////////////////\n                    \t\t\t    EVENTS\n    ///////////////////////////////////////////////////////////////*/\n\n    event BridgeToChainIdStartedWormhole(\n        address indexed tokenAddress, uint16 wormholeChainId, bytes32 indexed destinationAddress, uint256 amount\n    );\n    event BridgeToDomainStartedCCTP(\n        address indexed tokenAddress, uint32 destinationDomain, bytes32 indexed destinationAddress, uint256 amount\n    );\n\n    /**\n     * @notice Maximum amount that can be bridged in one transaction.\n     * @return The maximum bridging amount.\n     */\n    function getBridgeMaxAmount() external view returns (uint256);\n\n    /**\n     * @notice Bridge USDC tokens from the same address on the current chain to the destination chain.\n     * @param _amount is the amount to be sent in usdc.\n     * @param _wormholeChainId is the allowlisted wormhole chain ID that usdc can be sent to.\n     * @dev The amount defined in amount will be sent as usdc to the specified destination chain.\n     * @dev This function takes 18 decimals 'amount' and scales to target token amount.\n     * @dev Requires the sender to be an origin key or operation key.\n     */\n    function bridgeUSDCWithWormholeEVM(uint256 _amount, uint16 _wormholeChainId) external;\n\n    /**\n     * @notice Bridge USDC tokens from the current chain to Solana.\n     * @param _amount is the amount to be sent in 18 decimals scaled to 6 decimals for usdc.\n     * @param _solanaAccount The Solana account.\n     * @param _solanaTokenAccount The Solana token account.\n     * @param _accountBump A number used to ensure the derived address for the account is unique.\n     * @param _tokenAccountBump A number used to ensure the derived for the token account address is unique\n     * @dev The amount defined in whe amount will be sent as usdc to the specified destination chain.\n     * @dev Requires the sender to be the origin key or operation key.\n     */\n    function bridgeUSDCWithCCTPSolana(\n        uint256 _amount,\n        bytes32 _solanaAccount,\n        bytes32 _solanaTokenAccount,\n        uint8 _accountBump,\n        uint8 _tokenAccountBump\n    ) external;\n\n    /**\n     * @notice Process an attested Wormhole bridge and Circle CCTP message to redeem tokens that were bridged.\n     * @param _redeemParams The parameters for redeeming tokens.\n     * redeemParams: {\n     * encodedWormholeMessage,\n     * circleBridgeMessage,\n     * circleAttestation\n     * }\n     */\n    function processWormholeBridgeMessage(ICircleIntegration.RedeemParameters calldata _redeemParams) external;\n}\n"
      },
      "src/interfaces/beacons/IInfinexProtocolConfigBeacon.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\n/**\n * @title IInfinexProtocolConfigBeacon\n * @notice Interface for the Infinex Protocol Config Beacon contract.\n */\ninterface IInfinexProtocolConfigBeacon {\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t\t\t\t\t\tSTRUCTS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Struct containing the constructor arguments for the InfinexProtocolConfigBeacon contract\n     * @param trustedForwarder Address of the trusted forwarder contract\n     * @param latestAccountImplementation Address of the latest account implementation contract\n     * @param initialProxyImplementation Address of the initial proxy implementation contract\n     * @param revenuePool Address of the revenue pool contract\n     * @param USDC Address of the USDC token contract\n     * @param minimumUSDCBridgeAmount Minimum amount of USDC required to bridge\n     * @param circleBridge Address of the Circle bridge contract\n     * @param circleMinter Address of the Circle minter contract, used for checking the maximum bridge amount\n     * @param wormholeCircleBridge Address of the Wormhole Circle bridge contract\n     * @param defaultDestinationCCTPDomain the CCTP domain of the default destination chain.\n     * @param defaultDestinationWormholeChainId the Wormhole chain id of the default destination chain.\n     * @param solanaWalletSeed The salt used to generate the Solana account (fixed seed \"wallet\")\n     * @param solanaFixedPDASeed The salt used to generate the PDA (Program Derived Address)\n     * @param solanaWalletProgramAddress The Solana Wallet Program Address\n     * @param solanaTokenMintAddress The Solana token mint address\n     * @param solanaTokenProgramAddress The Solana token program address\n     * @param solanaAssociatedTokenProgramAddress The Solana ATA program address\n     */\n    struct InfinexBeaconConstructorArgs {\n        address trustedForwarder;\n        address latestAccountImplementation;\n        address initialProxyImplementation;\n        address revenuePool;\n        address USDC;\n        uint256 minimumUSDCBridgeAmount;\n        address circleBridge;\n        address circleMinter;\n        address wormholeCircleBridge;\n        uint32 defaultDestinationCCTPDomain;\n        uint16 defaultDestinationWormholeChainId;\n        uint16[] supportedWormholeChainIds;\n        uint32 solanaCCTPDestinationDomain;\n        bytes solanaWalletSeed;\n        bytes solanaFixedPDASeed;\n        bytes32 solanaWalletProgramAddress;\n        bytes32 solanaTokenMintAddress;\n        bytes32 solanaTokenProgramAddress;\n        bytes32 solanaAssociatedTokenProgramAddress;\n    }\n\n    /**\n     * @notice Struct containing both Circle and Wormhole bridge configuration\n     * @param minimumUSDCBridgeAmount Minimum amount of USDC required to bridge\n     * @param circleBridge Address of the Circle bridge contract\n     * @param circleMinter Address of the Circle minter contract, used for checking the maximum bridge amount\n     * @param wormholeCircleBridge Address of the Wormhole Circle bridge contract\n     * @param defaultDestinationCCTPDomain the CCTP domain of the default destination chain.\n     * @param defaultDestinationWormholeChainId the Wormhole chain id of the default destination chain.\n     * @dev Chain id is the official chain id for evm chains and documented one for non evm chains.\n     */\n    struct BridgeConfiguration {\n        uint256 minimumUSDCBridgeAmount;\n        address circleBridge;\n        address circleMinter;\n        address wormholeCircleBridge;\n        uint32 defaultDestinationCCTPDomain;\n        uint16 defaultDestinationWormholeChainId;\n    }\n\n    /**\n     * @notice The addresses for implementations referenced by the beacon\n     * @param initialProxyImplementation The initial proxy implementation address used for account creation to ensure identical cross chain addresses\n     * @param latestAccountImplementation The latest account implementation address, used for account upgrades and new accounts\n     * @param latestInfinexProtocolConfigBeacon The latest Infinex Protocol config beacon address, used for pointing account updates to the latest beacon\n     */\n    struct ImplementationAddresses {\n        address initialProxyImplementation;\n        address latestAccountImplementation;\n        address latestInfinexProtocolConfigBeacon;\n    }\n\n    /**\n     * @notice Struct containing the Solana configuration needed to verify addresses\n     * @param walletSeed The salt used to generate the Solana account (fixed seed \"wallet\")\n     * @param fixedPDASeed The salt used to generate the PDA (Program Derived Address)\n     * @param walletProgramAddress The Solana Wallet Program Address\n     * @param tokenMintAddress The Solana token mint address\n     * @param tokenProgramAddress The Solana token address\n     * @param associatedTokenProgramAddress The Solana ATA program address\n     */\n    struct SolanaConfiguration {\n        bytes walletSeed;\n        bytes fixedPDASeed;\n        bytes32 walletProgramAddress;\n        bytes32 tokenMintAddress;\n        bytes32 tokenProgramAddress;\n        bytes32 associatedTokenProgramAddress;\n    }\n\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t\t\t\t\t\tEVENTS\n    ///////////////////////////////////////////////////////////////*/\n\n    event LatestAccountImplementationSet(address latestAccountImplementation);\n    event InitialProxyImplementationSet(address initialProxyImplementation);\n    event RevenuePoolSet(address revenuePool);\n    event USDCAddressSet(address USDC);\n    event CircleBridgeParamsSet(address circleBridge, address circleMinter, uint32 defaultDestinationCCTPDomain);\n    event WormholeCircleBridgeParamsSet(address wormholeCircleBridge, uint16 defaultDestinationWormholeChainId);\n    event LatestInfinexProtocolConfigBeaconSet(address latestInfinexProtocolConfigBeacon);\n    event WithdrawalFeeUSDCSet(uint256 withdrawalFee);\n    event FundsRecoveryStatusSet(bool status);\n    event MinimumUSDCBridgeAmountSet(uint256 amount);\n    event WormholeDestinationDomainSet(uint256 indexed chainId, uint16 destinationDomain);\n    event CircleDestinationDomainSet(uint256 indexed chainId, uint32 destinationDomain);\n    event TrustedRecoveryKeeperSet(address indexed trustedRecoveryKeeper, bool isTrusted);\n    event SupportedWormholeChainIdSet(uint16 wormholeChainId, bool status);\n    event SolanaCCTPDestinationDomainSet(uint32 solanaCCTPDestinationDomain);\n\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t\t\t\t\tVARIABLES\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Gets the timestamp the beacon was deployed\n     * @return The timestamp the beacon was deployed\n     */\n    function CREATED_AT() external view returns (uint256);\n\n    /**\n     * @notice Gets the trusted forwarder address\n     * @return The address of the trusted forwarder\n     */\n    function TRUSTED_FORWARDER() external view returns (address);\n\n    /**\n     * @notice A platform wide feature flag to enable or disable funds recovery, false by default\n     * @return True if funds recovery is active\n     */\n    function fundsRecoveryActive() external view returns (bool);\n\n    /**\n     * @notice Gets the revenue pool address\n     * @return The address of the revenue pool\n     */\n    function revenuePool() external view returns (address);\n\n    /**\n     * @notice Gets the USDC amount to charge as withdrawal fee\n     * @return The withdrawal fee in USDC's decimals\n     */\n    function withdrawalFeeUSDC() external view returns (uint256);\n\n    /**\n     * @notice Retrieves the USDC address.\n     * @return The address of the USDC token\n     */\n    function USDC() external view returns (address);\n\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t\t\t\tVIEW FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Retrieves supported wormhole chain ids.\n     * @param _wormholeChainId the chain id to check\n     * @return bool if the chain is supported or not.\n     */\n    function isSupportedWormholeChainId(uint16 _wormholeChainId) external view returns (bool);\n\n    /**\n     * @notice Retrieves the minimum USDC amount that can be bridged.\n     * @return The minimum USDC bridge amount.\n     */\n    function getMinimumUSDCBridgeAmount() external view returns (uint256);\n\n    /**\n     * @notice Retrieves the Circle Bridge parameters.\n     * @return circleBridge The address of the Circle Bridge contract.\n     * @return circleMinter The address of the TokenMinter contract.\n     * @return defaultDestinationCCTPDomain The CCTP domain of the default destination chain.\n     */\n    function getCircleBridgeParams()\n        external\n        view\n        returns (address circleBridge, address circleMinter, uint32 defaultDestinationCCTPDomain);\n\n    /**\n     * @notice Retrieves the Circle Bridge address.\n     * @return The address of the Circle Bridge contract.\n     */\n    function getCircleBridge() external view returns (address);\n\n    /**\n     * @notice Retrieves the Circle TokenMinter address.\n     * @return The address of the Circle TokenMinter contract.\n     */\n    function getCircleMinter() external view returns (address);\n\n    /**\n     * @notice Retrieves the CCTP domain of the destination chain.\n     * @return The CCTP domain of the default destination chain.\n     */\n    function getDefaultDestinationCCTPDomain() external view returns (uint32);\n\n    /**\n     * @notice Retrieves the parameters required for Wormhole bridging.\n     * @return The address of the Wormhole Circle Bridge contract.\n     * @return The default wormhole destination domain for the circle bridge contract.\n     */\n    function getWormholeCircleBridgeParams() external view returns (address, uint16);\n\n    /**\n     * @notice Retrieves the Wormhole Circle Bridge address.\n     * @return The address of the Wormhole Circle Bridge contract.\n     */\n    function getWormholeCircleBridge() external view returns (address);\n\n    /**\n     * @notice Retrieves the Wormhole chain id for Base, or Ethereum Mainnet if deployed on Base.\n     * @return The Wormhole chain id of the default destination chain.\n     */\n    function getDefaultDestinationWormholeChainId() external view returns (uint16);\n\n    /**\n     * @notice Retrieves the circle CCTP destination domain for solana.\n     * @return The CCTP destination domain for solana.\n     */\n    function getSolanaCCTPDestinationDomain() external view returns (uint32);\n\n    /**\n     * @notice Gets the latest account implementation address.\n     * @return The address of the latest account implementation.\n     */\n    function getLatestAccountImplementation() external view returns (address);\n\n    /**\n     * @notice Gets the initial proxy implementation address.\n     * @return The address of the initial proxy implementation.\n     */\n    function getInitialProxyImplementation() external view returns (address);\n\n    /**\n     * @notice The latest Infinex Protocol config beacon address, used for pointing account updates to the latest beacon.\n     * @return The address of the latest Infinex Protocol config beacon.\n     */\n    function getLatestInfinexProtocolConfigBeacon() external view returns (address);\n\n    /**\n     * @notice Checks if an address is a trusted recovery keeper.\n     * @param _address The address to check.\n     * @return True if the address is a trusted recovery keeper, false otherwise.\n     */\n    function isTrustedRecoveryKeeper(address _address) external view returns (bool);\n\n    /**\n     * @notice Returns the Solana configuration\n     * @param walletSeed The salt used to generate the Solana account (fixed seed \"wallet\")\n     * @param fixedPDASeed The salt used to generate the PDA (Program Derived Address)\n     * @param walletProgramAddress The Solana Wallet Program Address\n     * @param tokenMintAddress The Solana token mint address\n     * @param tokenProgramAddress The Solana token program address\n     * @param associatedTokenProgramAddress The Solana ATA program address\n     */\n    function getSolanaConfiguration()\n        external\n        view\n        returns (\n            bytes memory walletSeed,\n            bytes memory fixedPDASeed,\n            bytes32 walletProgramAddress,\n            bytes32 tokenMintAddress,\n            bytes32 tokenProgramAddress,\n            bytes32 associatedTokenProgramAddress\n        );\n\n    /*///////////////////////////////////////////////////////////////\n    \t \t\t\t\t\t\t\tMUTATIVE FUNCTIONS\n    ///////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Sets or unsets a supported wormhole chain id.\n     * @param _wormholeChainId the wormhole chain id to add or remove.\n     * @param _status the status of the chain id.\n     */\n    function setSupportedWormholeChainId(uint16 _wormholeChainId, bool _status) external;\n\n    /**\n     * @notice Sets the solana CCTP destination domain\n     * @param _solanaCCTPDestinationDomain the destination domain for circles CCTP USDC bridge.\n     */\n    function setSolanaCCTPDestinationDomain(uint32 _solanaCCTPDestinationDomain) external;\n\n    /**\n     * @notice Sets or unsets an address as a trusted recovery keeper.\n     * @param _address The address to set or unset.\n     * @param _isTrusted Boolean indicating whether to set or unset the address as a trusted recovery keeper.\n     */\n    function setTrustedRecoveryKeeper(address _address, bool _isTrusted) external;\n\n    /**\n     * @notice Sets the funds recovery flag to active.\n     * @dev Initially only the owner can call this. After 90 days, it can be activated by anyone.\n     */\n    function setFundsRecoveryActive() external;\n\n    /**\n     * @notice Sets the revenue pool address.\n     * @param _revenuePool The revenue pool address.\n     */\n    function setRevenuePool(address _revenuePool) external;\n\n    /**\n     * @notice Sets the USDC amount to charge as withdrawal fee.\n     * @param _withdrawalFeeUSDC The withdrawal fee in USDC's decimals.\n     */\n    function setWithdrawalFeeUSDC(uint256 _withdrawalFeeUSDC) external;\n\n    /**\n     * @notice Sets the address of the USDC token contract.\n     * @param _USDC The address of the USDC token contract.\n     * @dev Only the contract owner can call this function.\n     * @dev Throws an error if the provided address is the zero address.\n     */\n    function setUSDCAddress(address _USDC) external;\n\n    /**\n     * @notice Sets the minimum USDC amount that can be bridged, in 6 decimals.\n     * @param _amount The minimum USDC bridge amount.\n     */\n    function setMinimumUSDCBridgeAmount(uint256 _amount) external;\n\n    /**\n     * @notice Sets the parameters for Circle bridging.\n     * @param _circleBridge The address of the Circle Bridge contract.\n     * @param _circleMinter The address of the Circle TokenMinter contract.\n     * @param _defaultDestinationCCTPDomain The CCTP domain of the default destination chain.\n     * @dev Circle Destination Domain can be 0 - Ethereum.\n     */\n    function setCircleBridgeParams(address _circleBridge, address _circleMinter, uint32 _defaultDestinationCCTPDomain) external;\n\n    /**\n     * @notice Sets the parameters for Wormhole bridging.\n     * @param _wormholeCircleBridge The address of the Wormhole Circle Bridge contract.\n     * @param _defaultDestinationWormholeChainId The wormhole domain of the default destination chain.\n     */\n    function setWormholeCircleBridgeParams(address _wormholeCircleBridge, uint16 _defaultDestinationWormholeChainId) external;\n\n    /**\n     * @notice Sets the initial proxy implementation address.\n     * @param _initialProxyImplementation The initial proxy implementation address.\n     * @dev Throws an error if the provided address is the zero address.\n     */\n    function setInitialProxyImplementation(address _initialProxyImplementation) external;\n\n    /**\n     * @notice Sets the latest account implementation address.\n     * @param _latestAccountImplementation The latest account implementation address.\n     * @dev Throws an error if the provided address is the zero address.\n     */\n    function setLatestAccountImplementation(address _latestAccountImplementation) external;\n\n    /**\n     * @notice Sets the latest Infinex Protocol Config Beacon.\n     * @param _latestInfinexProtocolConfigBeacon The address of the Infinex Protocol Config Beacon.\n     * @dev Throws an error if the provided address is the zero address.\n     */\n    function setLatestInfinexProtocolConfigBeacon(address _latestInfinexProtocolConfigBeacon) external;\n}\n"
      },
      "src/interfaces/circle/ITokenMessenger.sol": {
        "content": "/*\n * ADAPTED FROM: https://github.com/circlefin/evm-cctp-contracts/blob/1ddc5057e2a686194d481d04239387cf095ec760/src/TokenMessenger.sol\n * Copyright (c) 2022, Circle Internet Financial Limited.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\ninterface ITokenMessenger {\n    // ============ Events ============\n    /**\n     * @notice Emitted when a DepositForBurn message is sent\n     * @param nonce unique nonce reserved by message\n     * @param burnToken address of token burnt on source domain\n     * @param amount deposit amount\n     * @param depositor address where deposit is transferred from\n     * @param mintRecipient address receiving minted tokens on destination domain as bytes32\n     * @param destinationDomain destination domain\n     * @param destinationTokenMessenger address of TokenMessenger on destination domain as bytes32\n     * @param destinationCaller authorized caller as bytes32 of receiveMessage() on destination domain, if not equal to bytes32(0).\n     * If equal to bytes32(0), any address can call receiveMessage().\n     */\n    event DepositForBurn(\n        uint64 indexed nonce,\n        address indexed burnToken,\n        uint256 amount,\n        address indexed depositor,\n        bytes32 mintRecipient,\n        uint32 destinationDomain,\n        bytes32 destinationTokenMessenger,\n        bytes32 destinationCaller\n    );\n\n    /**\n     * @notice Emitted when tokens are minted\n     * @param mintRecipient recipient address of minted tokens\n     * @param amount amount of minted tokens\n     * @param mintToken contract address of minted token\n     */\n    event MintAndWithdraw(address indexed mintRecipient, uint256 amount, address indexed mintToken);\n\n    // ============ External Functions  ============\n    /**\n     * @notice Deposits and burns tokens from sender to be minted on destination domain.\n     * Emits a `DepositForBurn` event.\n     * @dev reverts if:\n     * - given burnToken is not supported\n     * - given destinationDomain has no TokenMessenger registered\n     * - transferFrom() reverts. For example, if sender's burnToken balance or approved allowance\n     * to this contract is less than `amount`.\n     * - burn() reverts. For example, if `amount` is 0.\n     * - MessageTransmitter returns false or reverts.\n     * @param amount amount of tokens to burn\n     * @param destinationDomain destination domain\n     * @param mintRecipient address of mint recipient on destination domain\n     * @param burnToken address of contract to burn deposited tokens, on local domain\n     * @return _nonce unique nonce reserved by message\n     */\n    function depositForBurn(uint256 amount, uint32 destinationDomain, bytes32 mintRecipient, address burnToken)\n        external\n        returns (uint64 _nonce);\n\n    /**\n     * @notice Handles an incoming message received by the local MessageTransmitter,\n     * and takes the appropriate action. For a burn message, mints the\n     * associated token to the requested recipient on the local domain.\n     * @dev Validates the local sender is the local MessageTransmitter, and the\n     * remote sender is a registered remote TokenMessenger for `remoteDomain`.\n     * @param remoteDomain The domain where the message originated from.\n     * @param sender The sender of the message (remote TokenMessenger).\n     * @param messageBody The message body bytes.\n     * @return success Bool, true if successful.\n     */\n    function handleReceiveMessage(uint32 remoteDomain, bytes32 sender, bytes calldata messageBody) external returns (bool);\n}\n"
      },
      "src/interfaces/circle/ITokenMinter.sol": {
        "content": "// Adapted from the Circle interface https://github.com/circlefin/evm-cctp-contracts/blob/master/src/interfaces/ITokenMinter.sol\n\n/*\n * Copyright (c) 2022, Circle Internet Financial Limited.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npragma solidity ^0.8.21;\n\n/**\n * @title ITokenMinter\n * @notice interface for minter of tokens that are mintable, burnable, and interchangeable\n * across domains.\n */\ninterface ITokenMinter {\n    /**\n     * @notice Get the maximum burn amount per message for a specific local token.\n     * @notice this mapping is exposed in the TokenMinter contract, but is from https://github.com/circlefin/evm-cctp-contracts/blob/master/src/roles/TokenController.sol\n     * @param token The local token address.\n     * @return The maximum burn amount per message for the specified local token.\n     */\n    function burnLimitsPerMessage(address token) external view returns (uint256);\n\n    /**\n     * @notice Mints `amount` of local tokens corresponding to the\n     * given (`sourceDomain`, `burnToken`) pair, to `to` address.\n     * @dev reverts if the (`sourceDomain`, `burnToken`) pair does not\n     * map to a nonzero local token address. This mapping can be queried using\n     * getLocalToken().\n     * @param sourceDomain Source domain where `burnToken` was burned.\n     * @param burnToken Burned token address as bytes32.\n     * @param to Address to receive minted tokens, corresponding to `burnToken`,\n     * on this domain.\n     * @param amount Amount of tokens to mint. Must be less than or equal\n     * to the minterAllowance of this TokenMinter for given `_mintToken`.\n     * @return mintToken token minted.\n     */\n    function mint(uint32 sourceDomain, bytes32 burnToken, address to, uint256 amount) external returns (address mintToken);\n\n    /**\n     * @notice Burn tokens owned by this ITokenMinter.\n     * @param burnToken burnable token.\n     * @param amount amount of tokens to burn. Must be less than or equal to this ITokenMinter's\n     * account balance of the given `_burnToken`.\n     */\n    function burn(address burnToken, uint256 amount) external;\n\n    /**\n     * @notice Get the local token associated with the given remote domain and token.\n     * @param remoteDomain Remote domain\n     * @param remoteToken Remote token\n     * @return local token address\n     */\n    function getLocalToken(uint32 remoteDomain, bytes32 remoteToken) external view returns (address);\n\n    /**\n     * @notice Set the token controller of this ITokenMinter. Token controller\n     * is responsible for mapping local tokens to remote tokens, and managing\n     * token-specific limits\n     * @param newTokenController new token controller address\n     */\n    function setTokenController(address newTokenController) external;\n}\n"
      },
      "src/libraries/DecimalScaling.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// adapted from https://github.com/Synthetixio/synthetix-v3/markets/spot-market/contracts/storage/Price.sol#L93\npragma solidity ^0.8.21;\n\nimport { DecimalMath } from \"@synthetixio/core-contracts/contracts/utils/DecimalMath.sol\";\nimport { SafeCastI256 } from \"@synthetixio/core-contracts/contracts/utils/SafeCast.sol\";\n\nimport { Error } from \"src/libraries/Error.sol\";\n\nlibrary DecimalScaling {\n    using DecimalMath for uint256;\n    using DecimalMath for int256;\n    using SafeCastI256 for int256;\n\n    /**\n     * @dev Scales the amount to or from 18 decimal places depending on the input decimals.\n     * If specified decimals are greater than 18, it divides the amount by 10 raised to the power of the difference.\n     * If specified decimals are less than 18, it multiplies the amount by 10 raised to the power of the difference.\n     * @param amount The amount to be scaled.\n     * @param decimals The number of decimals of the amount.\n     * @return scaledAmount The amount scaled to 18 decimal places.\n     */\n    function scale(int256 amount, uint256 decimals) internal pure returns (int256 scaledAmount) {\n        return (decimals > 18 ? amount.downscale(decimals - 18) : amount.upscale(18 - decimals));\n    }\n\n    /**\n     * @dev Scales the amount from 18 decimal places to the specified number of decimals.\n     * If the specified decimals are greater than 18, it multiplies the amount by 10 raised to the power of the difference.\n     * If the specified decimals are less than 18, it divides the amount by 10 raised to the power of the difference.\n     * @param amount The amount to be scaled from 18 decimal places.\n     * @param decimals The target number of decimals.\n     * @return scaledAmount The amount scaled from 18 decimal places to the specified number of decimals.\n     */\n    function scaleTo(int256 amount, uint256 decimals) internal pure returns (int256 scaledAmount) {\n        return (decimals > 18 ? amount.upscale(decimals - 18) : amount.downscale(18 - decimals));\n    }\n\n    /**\n     * @dev Scales the amount to or from 18 decimal places depending on the input decimals.\n     * If specified decimals are greater than 18, it divides the amount by 10 raised to the power of the difference.\n     * If specified decimals are less than 18, it multiplies the amount by 10 raised to the power of the difference.\n     * @param amount The amount to be scaled.\n     * @param decimals The number of decimals of the amount.\n     * @return scaledAmount The amount scaled to 18 decimal places.\n     */\n    function scale(uint256 amount, uint256 decimals) internal pure returns (uint256 scaledAmount) {\n        return (decimals > 18 ? amount.downscale(decimals - 18) : amount.upscale(18 - decimals));\n    }\n\n    /**\n     * @dev Scales the amount from 18 decimal places to the specified number of decimals.\n     * If the specified decimals are greater than 18, it multiplies the amount by 10 raised to the power of the difference.\n     * If the specified decimals are less than 18, it divides the amount by 10 raised to the power of the difference.\n     * @param amount The amount to be scaled from 18 decimal places.\n     * @param decimals The target number of decimals.\n     * @return scaledAmount The amount scaled from 18 decimal places to the specified number of decimals.\n     */\n    function scaleTo(uint256 amount, uint256 decimals) internal pure returns (uint256 scaledAmount) {\n        return (decimals > 18 ? amount.upscale(decimals - 18) : amount.downscale(18 - decimals));\n    }\n\n    /**\n     * @notice Converts the given amount in 18 decimals to a decimal precision.\n     * @param amount The amount to be converted.\n     * @param decimals The number of decimals wanted for precision.\n     * @return preciseAmount The amount converted to a decimal precision\n     */\n    // slither-disable-start divide-before-multiply\n    function toPrecision(uint256 amount, uint256 decimals) internal pure returns (uint256 preciseAmount) {\n        if (decimals > 18) {\n            revert Error.DecimalsMoreThan18(decimals);\n        }\n        amount = amount / (10 ** (18 - decimals));\n        return amount * (10 ** (18 - decimals));\n    }\n    // slither-disable-end divide-before-multiply\n}\n"
      },
      "src/libraries/Error.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nlibrary Error {\n    /*///////////////////////////////////////////////////////////////\n                                            GENERIC\n    ///////////////////////////////////////////////////////////////*/\n\n    error AlreadyExists();\n\n    error DoesNotExist();\n\n    error Unauthorized();\n\n    error InvalidLength();\n\n    error NotOwner();\n\n    error InvalidWormholeChainId();\n\n    /*///////////////////////////////////////////////////////////////\n                                            ADDRESS\n    ///////////////////////////////////////////////////////////////*/\n\n    error ImplementationMismatch(address implementation, address latestImplementation);\n\n    error InvalidWithdrawalAddress(address to);\n\n    error NullAddress();\n\n    error SameAddress();\n\n    error InvalidSolanaAddress();\n\n    error AddressAlreadySet();\n\n    /*///////////////////////////////////////////////////////////////\n                                    AMOUNT / BALANCE\n    ///////////////////////////////////////////////////////////////*/\n\n    error InsufficientBalance();\n\n    error InsufficientWithdrawalAmount(uint256 amount);\n\n    error InsufficientBalanceForFee(uint256 balance, uint256 fee);\n\n    error InvalidNonce(bytes32 nonce);\n\n    error ZeroValue();\n\n    error AmountDeltaZeroValue();\n\n    error DecimalsMoreThan18(uint256 decimals);\n\n    error InsufficientBridgeAmount();\n\n    error BridgeMaxAmountExceeded();\n\n    /*///////////////////////////////////////////////////////////////\n                                            ACCOUNT\n    ///////////////////////////////////////////////////////////////*/\n\n    error CreateAccountDisabled();\n\n    error InvalidKeysForSalt();\n\n    error PredictAddressDisabled();\n\n    error FundsRecoveryActivationDeadlinePending();\n\n    /*///////////////////////////////////////////////////////////////\n                                        KEY MANAGEMENT\n    ///////////////////////////////////////////////////////////////*/\n\n    error InvalidRequest();\n\n    error InvalidKeySignature(address from);\n\n    error KeyAlreadyInvalid();\n\n    error KeyAlreadyValid();\n\n    error KeyNotFound();\n\n    error CannotRemoveLastKey();\n\n    /*///////////////////////////////////////////////////////////////\n                                     GAS FEE REBATE\n    ///////////////////////////////////////////////////////////////*/\n\n    error InvalidDeductGasFunction(bytes4 sig);\n\n    /*///////////////////////////////////////////////////////////////\n                                FEATURE FLAGS\n    ///////////////////////////////////////////////////////////////*/\n\n    error FundsRecoveryNotActive();\n}\n"
      },
      "src/libraries/SolanaUtils.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.21;\n\nlibrary SolanaUtils {\n    /**\n     * @notice Struct containing the Solana account related arguments\n     * @param account The Ethereum account\n     * @param solanaAccount The Solana account\n     * @param solanaWalletSeed The salt used to generate the Solana account (fixed seed \"wallet\")\n     * @param solanaFixedPDASeed The salt used to generate the PDA (Program Derived Address)\n     * @param solanaWalletProgramAddress The Solana Wallet Program Address\n     * @param accountBump A number used to ensure the derived address for the account is unique\n     */\n    struct AccountArgs {\n        address account;\n        bytes32 solanaAccount;\n        bytes solanaWalletSeed;\n        bytes solanaFixedPDASeed;\n        bytes32 solanaWalletProgramAddress;\n        uint8 accountBump;\n    }\n\n    /**\n     * @notice Struct containing the Solana token account related arguments\n     * @param solanaTokenAccount The Solana token account\n     * @param solanaTokenMintAddress The Solana token mint address\n     * @param solanaTokenProgramAddress The Solana token address\n     * @param solanaAssociatedTokenProgramAddress The Solana ATA program address\n     * @param tokenAccountBump A number used to ensure the derived for the token account address is unique\n     */\n    struct TokenAccountArgs {\n        bytes32 solanaTokenAccount;\n        bytes32 solanaTokenMintAddress;\n        bytes32 solanaTokenProgramAddress;\n        bytes32 solanaAssociatedTokenProgramAddress;\n        uint8 tokenAccountBump;\n    }\n    /**\n     * @dev Verifies if a Solana account address is valid or not\n     * @param _accountArgs Struct containing the Solana account related arguments\n     */\n\n    function isAccountValid(AccountArgs memory _accountArgs) internal pure returns (bool) {\n        return sha256(\n            abi.encodePacked(\n                _accountArgs.solanaWalletSeed,\n                _accountArgs.account,\n                uint8(0), // We always bridge funds to the 0 index/main account\n                _accountArgs.accountBump,\n                _accountArgs.solanaWalletProgramAddress,\n                _accountArgs.solanaFixedPDASeed\n            )\n        ) == _accountArgs.solanaAccount;\n    }\n\n    /**\n     * @dev Verifies if a Solana token account address is valid or not\n     * @param _accountArgs Struct containing the Solana account related arguments\n     * @param _tokenAccountArgs Struct containing the Solana token account related arguments\n     */\n    function isTokenAccountValid(AccountArgs memory _accountArgs, TokenAccountArgs memory _tokenAccountArgs)\n        internal\n        pure\n        returns (bool)\n    {\n        return isAccountValid(_accountArgs)\n            && sha256(\n                abi.encodePacked(\n                    _accountArgs.solanaAccount,\n                    _tokenAccountArgs.solanaTokenProgramAddress,\n                    _tokenAccountArgs.solanaTokenMintAddress,\n                    _tokenAccountArgs.tokenAccountBump,\n                    _tokenAccountArgs.solanaAssociatedTokenProgramAddress,\n                    _accountArgs.solanaFixedPDASeed\n                )\n            ) == _tokenAccountArgs.solanaTokenAccount;\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "paris",
      "remappings": [
        "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
        "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
        "@synthetixio/core-contracts/=node_modules/@synthetixio/core-contracts/",
        "@synthetixio/core-modules/=node_modules/@synthetixio/core-modules/",
        "@synthetixio/main/=node_modules/@synthetixio/main/",
        "@synthetixio/oracle-manager/=node_modules/@synthetixio/oracle-manager/",
        "@synthetixio/perps-market/=node_modules/@synthetixio/perps-market/",
        "@synthetixio/spot-market/=node_modules/@synthetixio/spot-market/",
        "cannon-std/=lib/cannon-std/src/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/",
        "src/=src/",
        "test/=test/",
        "wormhole-circle-integration/=lib/wormhole-circle-integration/evm/src/",
        "wormhole/=lib/wormhole-circle-integration/evm/src/"
      ],
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}