creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    /**\n     * @dev The caller account is not authorized to perform an operation.\n     */\n    error OwnableUnauthorizedAccount(address account);\n\n    /**\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\n     */\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n     */\n    constructor(address initialOwner) {\n        if (initialOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(initialOwner);\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        if (owner() != _msgSender()) {\n            revert OwnableUnauthorizedAccount(_msgSender());\n        }\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin/contracts/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"
      },
      "@openzeppelin/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"
      },
      "@openzeppelin/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"
      },
      "@openzeppelin/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"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"
      },
      "contracts/core/CoreSwapHandler/CoreSwapHandlerV1.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.20;\n\nimport {\n    InvalidExecutedOutputAmount,\n    InvalidMsgValue,\n    InvalidSwapInputAmount\n} from \"../libraries/DefinitiveErrors.sol\";\nimport { DefinitiveConstants } from \"../libraries/DefinitiveConstants.sol\";\nimport { DefinitiveAssets, IERC20 } from \"../libraries/DefinitiveAssets.sol\";\nimport { Context } from \"@openzeppelin/contracts/utils/Context.sol\";\nimport { ICoreSwapHandlerV1 } from \"./ICoreSwapHandlerV1.sol\";\nimport { ReentrancyGuard } from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\nabstract contract CoreSwapHandlerV1 is ICoreSwapHandlerV1, Context, ReentrancyGuard {\n    using DefinitiveAssets for IERC20;\n\n    function swapCall(SwapParams calldata params) external payable nonReentrant returns (uint256, address) {\n        return _swapCall(params, false /* enforceAllowedPools */);\n    }\n\n    function swapDelegate(SwapParams calldata params) external payable nonReentrant returns (uint256, address) {\n        return _swapDelegate(params, false /* enforceAllowedPools */);\n    }\n\n    function swapUsingValidatedPathCall(\n        SwapParams calldata params\n    ) external payable nonReentrant returns (uint256, address) {\n        return _swapCall(params, true /* enforceAllowedPools */);\n    }\n\n    function _swapCall(\n        SwapParams memory params,\n        bool enforceAllowedPools\n    ) private returns (uint256 amountOut, address) {\n        bool isInputAddressNativeAsset = params.inputAssetAddress == DefinitiveConstants.NATIVE_ASSET_ADDRESS;\n        uint256 rawInputAmount = params.inputAmount;\n\n        // Calls to swap native assets must provide a non-zero input amount\n        if (isInputAddressNativeAsset && rawInputAmount == 0) {\n            revert InvalidSwapInputAmount();\n        }\n\n        // Calls to swap native assets must match the input amount and msg.value\n        if (isInputAddressNativeAsset && rawInputAmount != msg.value) {\n            revert InvalidMsgValue();\n        }\n\n        // Calls to swap non-native assets must have msg.value equal to 0\n        if (!isInputAddressNativeAsset && msg.value != 0) {\n            revert InvalidMsgValue();\n        }\n\n        // Update SwapParams with parsed input amount\n        params.inputAmount = rawInputAmount > 0 ? rawInputAmount : _getTokenAllowance(params.inputAssetAddress);\n\n        if (params.inputAssetAddress != DefinitiveConstants.NATIVE_ASSET_ADDRESS) {\n            IERC20(params.inputAssetAddress).safeTransferFrom(_msgSender(), address(this), params.inputAmount);\n        }\n\n        _validateSwap(params);\n        _validatePools(params, enforceAllowedPools);\n\n        (amountOut, ) = _swap(params);\n\n        if (params.outputAssetAddress == DefinitiveConstants.NATIVE_ASSET_ADDRESS) {\n            DefinitiveAssets.safeTransferETH(payable(_msgSender()), amountOut);\n        } else {\n            IERC20(params.outputAssetAddress).safeTransfer(_msgSender(), amountOut);\n        }\n\n        return (amountOut, params.outputAssetAddress);\n    }\n\n    function _swapDelegate(SwapParams memory params, bool enforceAllowedPools) private returns (uint256, address) {\n        uint256 rawInputAmount = params.inputAmount;\n        uint256 parsedInputAmount = rawInputAmount > 0\n            ? rawInputAmount\n            : DefinitiveAssets.getBalance(params.inputAssetAddress);\n\n        if (parsedInputAmount == 0) {\n            revert InvalidSwapInputAmount();\n        }\n        // Update SwapParams with parsed input amount\n        params.inputAmount = parsedInputAmount;\n\n        _validateSwap(params);\n        _validatePools(params, enforceAllowedPools);\n\n        return _swap(params);\n    }\n\n    /**\n     * @notice This method holds the logic for performing the swap.\n     * @param params SwapParams\n     */\n    function _performSwap(SwapParams memory params) internal virtual;\n\n    /**\n     * @notice Method to confirm that the swap is using valid pools based on our criteria\n     * @param params SwapParams\n     * @param enforceAllowedPools boolean to determine if we should enforce allowed pools\n     */\n    function _validatePools(SwapParams memory params, bool enforceAllowedPools) internal virtual;\n\n    /**\n     * @notice Method to confirm that the swap parameters are valid for the third party\n     * @param params SwapParams\n     */\n    function _validateSwap(SwapParams memory params) internal virtual;\n\n    /**\n     * @notice When `rawInputAmount` is 0, `swapCall` will use the allowance as the input amount\n     * @param inputAssetAddress asset to swap from\n     */\n    function _getTokenAllowance(address inputAssetAddress) private view returns (uint256) {\n        uint256 allowance = IERC20(inputAssetAddress).allowance(_msgSender(), address(this));\n\n        if (allowance == 0) {\n            revert InvalidSwapInputAmount();\n        }\n\n        return allowance;\n    }\n\n    /**\n     * @notice Returns the address we need to approve in order to swap assets\n     * @param data included with the swap method invocation\n     */\n    function _getSpenderAddress(bytes memory data) internal virtual returns (address);\n\n    /**\n     * @notice Internal swap logic that performs the swap and validates the output amount\n     * @param params SwapParams\n     * @return output amount and output asset address\n     */\n    function _swap(SwapParams memory params) private returns (uint256, address) {\n        if (params.inputAssetAddress != DefinitiveConstants.NATIVE_ASSET_ADDRESS) {\n            IERC20(params.inputAssetAddress).resetAndSafeIncreaseAllowance(\n                address(this),\n                _getSpenderAddress(params.data),\n                params.inputAmount\n            );\n        }\n\n        uint256 outputAmountDelta = DefinitiveAssets.getBalance(params.outputAssetAddress);\n\n        _performSwap(params);\n\n        outputAmountDelta = DefinitiveAssets.getBalance(params.outputAssetAddress) - outputAmountDelta;\n\n        if (outputAmountDelta < params.minOutputAmount) {\n            revert InvalidExecutedOutputAmount();\n        }\n\n        emit Swap(\n            _msgSender(),\n            params.inputAssetAddress,\n            params.inputAmount,\n            params.outputAssetAddress,\n            outputAmountDelta\n        );\n\n        return (outputAmountDelta, params.outputAssetAddress);\n    }\n}\n"
      },
      "contracts/core/CoreSwapHandler/ICoreSwapHandlerV1.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.20;\n\ninterface ICoreSwapHandlerV1 {\n    event Swap(\n        address indexed actor,\n        address indexed inputToken,\n        uint256 inputAmount,\n        address indexed outputToken,\n        uint256 outputAmount\n    );\n\n    struct SwapParams {\n        address inputAssetAddress;\n        uint256 inputAmount;\n        address outputAssetAddress;\n        uint256 minOutputAmount;\n        bytes data;\n        bytes signature;\n    }\n\n    function swapCall(SwapParams calldata params) external payable returns (uint256 amountOut, address outputAsset);\n\n    function swapDelegate(SwapParams calldata params) external payable returns (uint256 amountOut, address outputAsset);\n\n    function swapUsingValidatedPathCall(\n        SwapParams calldata params\n    ) external payable returns (uint256 amountOut, address outputAsset);\n}\n"
      },
      "contracts/core/libraries/DefinitiveAssets.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.20;\n\nimport { IERC20, SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { SafeTransferLib } from \"solmate/src/utils/SafeTransferLib.sol\";\nimport { DefinitiveConstants } from \"./DefinitiveConstants.sol\";\n\nimport { InsufficientBalance, InvalidAmount, InvalidAmounts, InvalidERC20Address } from \"./DefinitiveErrors.sol\";\n\n/**\n * @notice Contains methods used throughout the Definitive contracts\n * @dev This file should only be used as an internal library.\n */\nlibrary DefinitiveAssets {\n    /**\n     * @dev Checks if an address is a valid ERC20 token\n     */\n    modifier onlyValidERC20(address erc20Token) {\n        if (address(erc20Token) == DefinitiveConstants.NATIVE_ASSET_ADDRESS) {\n            revert InvalidERC20Address();\n        }\n        _;\n    }\n\n    //////////////////////////////////////////////////\n    //////////////////////////////////////////////////\n    // ↓ ERC20 and Native Asset Methods ↓\n    //////////////////////////////////////////////////\n\n    /**\n     * @dev Gets the balance of an ERC20 token or native asset\n     */\n    function getBalance(address assetAddress) internal view returns (uint256) {\n        if (assetAddress == DefinitiveConstants.NATIVE_ASSET_ADDRESS) {\n            return address(this).balance;\n        } else {\n            return IERC20(assetAddress).balanceOf(address(this));\n        }\n    }\n\n    /**\n     * @dev internal function to validate balance is higher than a given amount for ERC20 and native assets\n     */\n    function validateBalance(address token, uint256 amount) internal view {\n        if (token == DefinitiveConstants.NATIVE_ASSET_ADDRESS) {\n            validateNativeBalance(amount);\n        } else {\n            validateERC20Balance(token, amount);\n        }\n    }\n\n    //////////////////////////////////////////////////\n    //////////////////////////////////////////////////\n    // ↓ Native Asset Methods ↓\n    //////////////////////////////////////////////////\n\n    /**\n     * @dev validates amount and balance, then uses SafeTransferLib to transfer native asset\n     */\n    function safeTransferETH(address recipient, uint256 amount) internal {\n        if (amount > 0) {\n            SafeTransferLib.safeTransferETH(payable(recipient), amount);\n        }\n    }\n\n    //////////////////////////////////////////////////\n    //////////////////////////////////////////////////\n    // ↓ ERC20 Methods ↓\n    //////////////////////////////////////////////////\n\n    /**\n     * @dev Resets and increases the allowance of a spender for an ERC20 token\n     */\n    function resetAndSafeIncreaseAllowance(\n        IERC20 token,\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal onlyValidERC20(address(token)) {\n        return SafeERC20.forceApprove(token, spender, amount);\n    }\n\n    function safeTransfer(IERC20 token, address to, uint256 amount) internal onlyValidERC20(address(token)) {\n        if (amount > 0) {\n            SafeERC20.safeTransfer(token, to, amount);\n        }\n    }\n\n    function safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 amount\n    ) internal onlyValidERC20(address(token)) {\n        if (amount > 0) {\n            //slither-disable-next-line arbitrary-send-erc20\n            SafeERC20.safeTransferFrom(token, from, to, amount);\n        }\n    }\n\n    //////////////////////////////////////////////////\n    //////////////////////////////////////////////////\n    // ↓ Asset Amount Helper Methods ↓\n    //////////////////////////////////////////////////\n\n    /**\n     * @dev internal function to validate that amounts contains a value greater than zero\n     */\n    function validateAmounts(uint256[] calldata amounts) internal pure {\n        bool hasValidAmounts;\n        uint256 amountsLength = amounts.length;\n        for (uint256 i; i < amountsLength; ) {\n            if (amounts[i] > 0) {\n                hasValidAmounts = true;\n                break;\n            }\n            unchecked {\n                ++i;\n            }\n        }\n\n        if (!hasValidAmounts) {\n            revert InvalidAmounts();\n        }\n    }\n\n    /**\n     * @dev internal function to validate if native asset balance is higher than the amount requested\n     */\n    function validateNativeBalance(uint256 amount) internal view {\n        if (getBalance(DefinitiveConstants.NATIVE_ASSET_ADDRESS) < amount) {\n            revert InsufficientBalance();\n        }\n    }\n\n    /**\n     * @dev internal function to validate balance is higher than the amount requested for a token\n     */\n    function validateERC20Balance(address token, uint256 amount) internal view onlyValidERC20(token) {\n        if (getBalance(token) < amount) {\n            revert InsufficientBalance();\n        }\n    }\n\n    function validateAmount(uint256 _amount) internal pure {\n        if (_amount == 0) {\n            revert InvalidAmount();\n        }\n    }\n}\n"
      },
      "contracts/core/libraries/DefinitiveConstants.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.20;\n\n/**\n * @notice Contains constants used throughout the Definitive contracts\n * @dev This file should only be used as an internal library.\n */\nlibrary DefinitiveConstants {\n    /**\n     * @notice Maximum fee percentage\n     */\n    uint256 internal constant MAX_FEE_PCT = 10000;\n\n    /**\n     * @notice Address to signify native assets\n     */\n    address internal constant NATIVE_ASSET_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n    /**\n     * @notice Maximum number of swaps allowed per block\n     */\n    uint8 internal constant MAX_SWAPS_PER_BLOCK = 25;\n\n    struct Assets {\n        uint256[] amounts;\n        address[] addresses;\n    }\n}\n"
      },
      "contracts/core/libraries/DefinitiveErrors.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.20;\n\n/**\n * @notice Contains all errors used throughout the Definitive contracts\n * @dev This file should only be used as an internal library.\n * @dev When adding a new error, add alphabetically\n */\n\nerror AccountMissingRole(address _account, bytes32 _role);\nerror AccountNotAdmin(address);\nerror AccountNotWhitelisted(address);\nerror AddLiquidityFailed();\nerror AlreadyDeployed();\nerror BytecodeEmpty();\nerror DeadlineExceeded();\nerror DeployInitFailed();\nerror DeployFailed();\nerror BorrowFailed(uint256 errorCode);\nerror DecollateralizeFailed(uint256 errorCode);\nerror DepositMoreThanMax();\nerror EmptyBytecode();\nerror EnterAllFailed();\nerror EnforcedSafeLTV(uint256 invalidLTV);\nerror ExceededMaxDelta();\nerror ExceededMaxLTV();\nerror ExceededShareToAssetRatioDeltaThreshold();\nerror ExitAllFailed();\nerror ExitOneCoinFailed();\nerror GlobalStopGuardianEnabled();\nerror InitializeMarketsFailed();\nerror InputGreaterThanStaked();\nerror InsufficientBalance();\nerror InsufficientSwapTokenBalance();\nerror InvalidAddress();\nerror InvalidAmount();\nerror InvalidAmounts();\nerror InvalidCalldata();\nerror InvalidDestinationSwapper();\nerror InvalidERC20Address();\nerror InvalidExecutedOutputAmount();\nerror InvalidFeePercent();\nerror InvalidHandler();\nerror InvalidInputs();\nerror InvalidMsgValue();\nerror InvalidSingleHopSwap();\nerror InvalidMultiHopSwap();\nerror InvalidOutputToken();\nerror InvalidRedemptionRecipient(); // Used in cross-chain redeptions\nerror InvalidReportedOutputAmount();\nerror InvalidRewardsClaim();\nerror InvalidSignature();\nerror InvalidSignatureLength();\nerror InvalidSwapHandler();\nerror InvalidSwapInputAmount();\nerror InvalidSwapOutputToken();\nerror InvalidSwapPath();\nerror InvalidSwapPayload();\nerror InvalidSwapToken();\nerror MintMoreThanMax();\nerror MismatchedChainId();\nerror NativeAssetWrapFailed(bool wrappingToNative);\nerror NoSignatureVerificationSignerSet();\nerror RedeemMoreThanMax();\nerror RemoveLiquidityFailed();\nerror RepayDebtFailed();\nerror SafeHarborModeEnabled();\nerror SafeHarborRedemptionDisabled();\nerror SlippageExceeded(uint256 _outputAmount, uint256 _outputAmountMin);\nerror StakeFailed();\nerror SupplyFailed();\nerror StopGuardianEnabled();\nerror TradingDisabled();\nerror SwapDeadlineExceeded();\nerror SwapLimitExceeded();\nerror SwapTokenIsOutputToken();\nerror TransfersLimitExceeded();\nerror UnstakeFailed();\nerror UnauthenticatedFlashloan();\nerror UntrustedFlashLoanSender(address);\nerror WithdrawMoreThanMax();\nerror WithdrawalsDisabled();\nerror ZeroShares();\n"
      },
      "contracts/handlers/MetaSwapHandler/IMetaSwapHandler.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.20;\n\nimport { ICoreSwapHandlerV1 } from \"../../core/CoreSwapHandler/ICoreSwapHandlerV1.sol\";\n\ninterface IMetaSwapHandler is ICoreSwapHandlerV1 {\n    struct MetaSwapParams {\n        uint256 deadline;\n        address underlyingSwapRouterAddress;\n        bytes swapData;\n    }\n\n    /// @dev Needed for core\n    function decodeParams(bytes memory data) external pure returns (MetaSwapParams memory);\n\n    function removeFromWhitelist(address[] memory swapContracts) external;\n\n    function addToWhitelist(address[] memory swapContracts) external;\n}\n"
      },
      "contracts/handlers/MetaSwapHandler/MetaSwapHandler.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.20;\n\nimport { CoreSwapHandlerV1 } from \"../../core/CoreSwapHandler/CoreSwapHandlerV1.sol\";\nimport { IMetaSwapHandler } from \"./IMetaSwapHandler.sol\";\nimport { SwapDeadlineExceeded, InvalidDestinationSwapper } from \"../../core/libraries/DefinitiveErrors.sol\";\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\n\n/**\n * @title MetaSwapHandler\n * @author WardenJakx\n * @notice Meta swap handler to swap anywhere\n */\ncontract MetaSwapHandler is CoreSwapHandlerV1, IMetaSwapHandler, Ownable {\n    address immutable _this;\n\n    receive() external payable {}\n\n    mapping(address => bool) public whitelistedSwapContracts;\n\n    /**\n     * @param owner we may not be using msgSender() so an owner address is specified to be the owner\n     * @param whitelistedContracts DEX routers to whitelist (eg 0x router)m\n     */\n    constructor(address owner, address[] memory whitelistedContracts) payable Ownable(owner) {\n        _updateWhitelist(whitelistedContracts, true);\n        _this = address(this);\n    }\n\n    function decodeParams(bytes memory data) public pure returns (MetaSwapParams memory metaSwapParams) {\n        metaSwapParams = abi.decode(data, (MetaSwapParams));\n    }\n\n    function removeFromWhitelist(address[] calldata contracts) external onlyOwner {\n        _updateWhitelist(contracts, false);\n    }\n\n    function addToWhitelist(address[] calldata contracts) external onlyOwner {\n        _updateWhitelist(contracts, true);\n    }\n\n    function _performSwap(SwapParams memory params) internal override {\n        MetaSwapParams memory swapParams = abi.decode(params.data, (MetaSwapParams));\n        Address.functionCallWithValue(swapParams.underlyingSwapRouterAddress, swapParams.swapData, msg.value);\n    }\n\n    function _getSpenderAddress(bytes memory data) internal pure override returns (address) {\n        MetaSwapParams memory swapParams = abi.decode(data, (MetaSwapParams));\n        return swapParams.underlyingSwapRouterAddress;\n    }\n\n    function _validatePools(SwapParams memory, bool) internal view override {}\n\n    function _validateSwap(SwapParams memory params) internal view override {\n        MetaSwapParams memory swapParams = abi.decode(params.data, (MetaSwapParams));\n        bool swapRouterIsWhitelisted = address(this) == _this\n            ? whitelistedSwapContracts[swapParams.underlyingSwapRouterAddress]\n            : MetaSwapHandler(payable(_this)).whitelistedSwapContracts(swapParams.underlyingSwapRouterAddress);\n\n        if (!swapRouterIsWhitelisted) {\n            revert InvalidDestinationSwapper();\n        }\n\n        if (swapParams.deadline < block.timestamp) {\n            revert SwapDeadlineExceeded();\n        }\n    }\n\n    function _updateWhitelist(address[] memory contracts, bool isWhitelisted) private {\n        uint256 contractsLength = contracts.length;\n        for (uint256 i; i < contractsLength; ) {\n            whitelistedSwapContracts[contracts[i]] = isWhitelisted;\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n}\n"
      },
      "solmate/src/tokens/ERC20.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\nabstract contract ERC20 {\n    /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    event Transfer(address indexed from, address indexed to, uint256 amount);\n\n    event Approval(address indexed owner, address indexed spender, uint256 amount);\n\n    /*//////////////////////////////////////////////////////////////\n                            METADATA STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    string public name;\n\n    string public symbol;\n\n    uint8 public immutable decimals;\n\n    /*//////////////////////////////////////////////////////////////\n                              ERC20 STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    uint256 public totalSupply;\n\n    mapping(address => uint256) public balanceOf;\n\n    mapping(address => mapping(address => uint256)) public allowance;\n\n    /*//////////////////////////////////////////////////////////////\n                            EIP-2612 STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    uint256 internal immutable INITIAL_CHAIN_ID;\n\n    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\n\n    mapping(address => uint256) public nonces;\n\n    /*//////////////////////////////////////////////////////////////\n                               CONSTRUCTOR\n    //////////////////////////////////////////////////////////////*/\n\n    constructor(\n        string memory _name,\n        string memory _symbol,\n        uint8 _decimals\n    ) {\n        name = _name;\n        symbol = _symbol;\n        decimals = _decimals;\n\n        INITIAL_CHAIN_ID = block.chainid;\n        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                               ERC20 LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function approve(address spender, uint256 amount) public virtual returns (bool) {\n        allowance[msg.sender][spender] = amount;\n\n        emit Approval(msg.sender, spender, amount);\n\n        return true;\n    }\n\n    function transfer(address to, uint256 amount) public virtual returns (bool) {\n        balanceOf[msg.sender] -= amount;\n\n        // Cannot overflow because the sum of all user\n        // balances can't exceed the max uint256 value.\n        unchecked {\n            balanceOf[to] += amount;\n        }\n\n        emit Transfer(msg.sender, to, amount);\n\n        return true;\n    }\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) public virtual returns (bool) {\n        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\n\n        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\n\n        balanceOf[from] -= amount;\n\n        // Cannot overflow because the sum of all user\n        // balances can't exceed the max uint256 value.\n        unchecked {\n            balanceOf[to] += amount;\n        }\n\n        emit Transfer(from, to, amount);\n\n        return true;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                             EIP-2612 LOGIC\n    //////////////////////////////////////////////////////////////*/\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    ) public virtual {\n        require(deadline >= block.timestamp, \"PERMIT_DEADLINE_EXPIRED\");\n\n        // Unchecked because the only math done is incrementing\n        // the owner's nonce which cannot realistically overflow.\n        unchecked {\n            address recoveredAddress = ecrecover(\n                keccak256(\n                    abi.encodePacked(\n                        \"\\x19\\x01\",\n                        DOMAIN_SEPARATOR(),\n                        keccak256(\n                            abi.encode(\n                                keccak256(\n                                    \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n                                ),\n                                owner,\n                                spender,\n                                value,\n                                nonces[owner]++,\n                                deadline\n                            )\n                        )\n                    )\n                ),\n                v,\n                r,\n                s\n            );\n\n            require(recoveredAddress != address(0) && recoveredAddress == owner, \"INVALID_SIGNER\");\n\n            allowance[recoveredAddress][spender] = value;\n        }\n\n        emit Approval(owner, spender, value);\n    }\n\n    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\n        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\n    }\n\n    function computeDomainSeparator() internal view virtual returns (bytes32) {\n        return\n            keccak256(\n                abi.encode(\n                    keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n                    keccak256(bytes(name)),\n                    keccak256(\"1\"),\n                    block.chainid,\n                    address(this)\n                )\n            );\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        INTERNAL MINT/BURN LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function _mint(address to, uint256 amount) internal virtual {\n        totalSupply += amount;\n\n        // Cannot overflow because the sum of all user\n        // balances can't exceed the max uint256 value.\n        unchecked {\n            balanceOf[to] += amount;\n        }\n\n        emit Transfer(address(0), to, amount);\n    }\n\n    function _burn(address from, uint256 amount) internal virtual {\n        balanceOf[from] -= amount;\n\n        // Cannot underflow because a user's balance\n        // will never be larger than the total supply.\n        unchecked {\n            totalSupply -= amount;\n        }\n\n        emit Transfer(from, address(0), amount);\n    }\n}\n"
      },
      "solmate/src/utils/SafeTransferLib.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20} from \"../tokens/ERC20.sol\";\n\n/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)\n/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.\n/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.\nlibrary SafeTransferLib {\n    /*//////////////////////////////////////////////////////////////\n                             ETH OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    function safeTransferETH(address to, uint256 amount) internal {\n        bool success;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Transfer the ETH and store if it succeeded or not.\n            success := call(gas(), to, amount, 0, 0, 0, 0)\n        }\n\n        require(success, \"ETH_TRANSFER_FAILED\");\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                            ERC20 OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    function safeTransferFrom(\n        ERC20 token,\n        address from,\n        address to,\n        uint256 amount\n    ) internal {\n        bool success;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Get a pointer to some free memory.\n            let freeMemoryPointer := mload(0x40)\n\n            // Write the abi-encoded calldata into memory, beginning with the function selector.\n            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n            mstore(add(freeMemoryPointer, 4), from) // Append the \"from\" argument.\n            mstore(add(freeMemoryPointer, 36), to) // Append the \"to\" argument.\n            mstore(add(freeMemoryPointer, 68), amount) // Append the \"amount\" argument.\n\n            success := and(\n                // Set success to whether the call reverted, if not we check it either\n                // returned exactly 1 (can't just be non-zero data), or had no return data.\n                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\n                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n                // Counterintuitively, this call must be positioned second to the or() call in the\n                // surrounding and() call or else returndatasize() will be zero during the computation.\n                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)\n            )\n        }\n\n        require(success, \"TRANSFER_FROM_FAILED\");\n    }\n\n    function safeTransfer(\n        ERC20 token,\n        address to,\n        uint256 amount\n    ) internal {\n        bool success;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Get a pointer to some free memory.\n            let freeMemoryPointer := mload(0x40)\n\n            // Write the abi-encoded calldata into memory, beginning with the function selector.\n            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n            mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n            mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n            success := and(\n                // Set success to whether the call reverted, if not we check it either\n                // returned exactly 1 (can't just be non-zero data), or had no return data.\n                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n                // Counterintuitively, this call must be positioned second to the or() call in the\n                // surrounding and() call or else returndatasize() will be zero during the computation.\n                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n            )\n        }\n\n        require(success, \"TRANSFER_FAILED\");\n    }\n\n    function safeApprove(\n        ERC20 token,\n        address to,\n        uint256 amount\n    ) internal {\n        bool success;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Get a pointer to some free memory.\n            let freeMemoryPointer := mload(0x40)\n\n            // Write the abi-encoded calldata into memory, beginning with the function selector.\n            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)\n            mstore(add(freeMemoryPointer, 4), to) // Append the \"to\" argument.\n            mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument.\n\n            success := and(\n                // Set success to whether the call reverted, if not we check it either\n                // returned exactly 1 (can't just be non-zero data), or had no return data.\n                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n                // Counterintuitively, this call must be positioned second to the or() call in the\n                // surrounding and() call or else returndatasize() will be zero during the computation.\n                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)\n            )\n        }\n\n        require(success, \"APPROVE_FAILED\");\n    }\n}\n"
      }
    },
    "settings": {
      "evmVersion": "paris",
      "metadata": {
        "bytecodeHash": "none"
      },
      "optimizer": {
        "enabled": true,
        "runs": 500
      },
      "viaIR": false,
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}