{
  "language": "Solidity",
  "sources": {
    "contracts/AutoCompounder.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport {IPeronio} from \"./IPeronio.sol\";\nimport {Ownable} from \"@openzeppelin/contracts_latest/access/Ownable.sol\";\n\ncontract AutoCompounder is Ownable {\n    IPeronio internal peronio;\n\n    uint256 public constant MINIMUM_PERIOD = 12 * 60 * 60;\n\n    uint256 public lastExecuted;\n\n    constructor(address _peronio) {\n        peronio = IPeronio(_peronio);\n    }\n\n    function autoCompound() public onlyOwner {\n        require(MINIMUM_PERIOD < block.timestamp - lastExecuted, \"autoCompound: Time not elapsed\");\n\n        lastExecuted = block.timestamp;\n        peronio.compoundRewards();\n    }\n}\n"
    },
    "contracts/IPeronio.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * Type representing an USDC token quantity\n *\n */\ntype UsdcQuantity is uint256;\n\n/**\n * Type representing a MAI token quantity\n *\n */\ntype MaiQuantity is uint256;\n\n/**\n * Type representing an LP USDC/MAI token quantity\n *\n */\ntype LpQuantity is uint256;\n\n/**\n * Type representing a PE token quantity\n *\n */\ntype PeQuantity is uint256;\n\n/**\n * Type representing a QI token quantity\n *\n */\ntype QiQuantity is uint256;\n\n/**\n * Type representing a ratio of PE/USD tokens (always represented using `DECIMALS` decimals)\n *\n */\ntype PePerUsdcQuantity is uint256;\n\n/**\n * Type representing a ratio of USD/PE tokens (always represented using `DECIMALS` decimals)\n *\n */\ntype UsdcPerPeQuantity is uint256;\n\n/**\n * Type representing an adimensional ratio, expressed with 6 decimals\n *\n */\ntype RatioWith6Decimals is uint256;\n\n/**\n * Type representing a role ID\n *\n */\ntype RoleId is bytes32;\n\ninterface IPeronio {\n    // --- Events ---------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Emitted upon initialization of the Peronio contract\n     *\n     * @param owner  The address initializing the contract\n     * @param collateral  The number of USDC tokens used as collateral\n     * @param startingRatio  The number of PE tokens per USDC token the vault is initialized with\n     */\n    event Initialized(address owner, UsdcQuantity collateral, PePerUsdcQuantity startingRatio);\n\n    /**\n     * Emitted upon minting PE tokens\n     *\n     * @param to  The address where minted PE tokens get transferred to\n     * @param collateralAmount  The number of USDC tokens used as collateral in this minting\n     * @param tokenAmount  Amount of PE tokens minted\n     */\n    event Minted(address indexed to, UsdcQuantity collateralAmount, PeQuantity tokenAmount);\n\n    /**\n     * Emitted upon collateral withdrawal\n     *\n     * @param to  Address where the USDC token withdrawal is directed\n     * @param collateralAmount  The number of USDC tokens withdrawn\n     * @param tokenAmount  The number of PE tokens burnt\n     */\n    event Withdrawal(address indexed to, UsdcQuantity collateralAmount, PeQuantity tokenAmount);\n\n    /**\n     * Emitted upon liquidity withdrawal\n     *\n     * @param to  Address where the USDC token withdrawal is directed\n     * @param lpAmount  The number of LP USDC/MAI tokens withdrawn\n     * @param tokenAmount  The number of PE tokens burnt\n     */\n    event LiquidityWithdrawal(address indexed to, LpQuantity lpAmount, PeQuantity tokenAmount);\n\n    /**\n     * Emitted upon the markup fee being updated\n     *\n     * @param operator  Address of the one updating the markup fee\n     * @param markupFee  New markup fee\n     */\n    event MarkupFeeUpdated(address operator, RatioWith6Decimals markupFee);\n\n    /**\n     * Emitted upon compounding rewards from QiDao's Farm back into the vault\n     *\n     * @param qi  Number of awarded QI tokens\n     * @param usdc  Equivalent number of USDC tokens\n     * @param lp  Number of LP USDC/MAI tokens re-invested\n     */\n    event CompoundRewards(QiQuantity qi, UsdcQuantity usdc, LpQuantity lp);\n\n    // --- Roles - Automatic ----------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the hash identifying the role responsible for updating the markup fee\n     *\n     * @return roleId  The role hash in question\n     */\n    function MARKUP_ROLE() external view returns (RoleId roleId); // solhint-disable-line func-name-mixedcase\n\n    /**\n     * Return the hash identifying the role responsible for compounding rewards\n     *\n     * @return roleId  The role hash in question\n     */\n    function REWARDS_ROLE() external view returns (RoleId roleId); // solhint-disable-line func-name-mixedcase\n\n    /**\n     * Return the hash identifying the role responsible for migrating between versions\n     *\n     * @return roleId  The role hash in question\n     */\n    function MIGRATOR_ROLE() external view returns (RoleId roleId); // solhint-disable-line func-name-mixedcase\n\n    // --- Addresses - Automatic ------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the address used for the USDC tokens in vault\n     *\n     * @return  The address in question\n     */\n    function usdcAddress() external view returns (address);\n\n    /**\n     * Return the address used for the MAI tokens in vault\n     *\n     * @return  The address in question\n     */\n    function maiAddress() external view returns (address);\n\n    /**\n     * Return the address used for the LP USDC/MAI tokens in vault\n     *\n     * @return  The address in question\n     */\n    function lpAddress() external view returns (address);\n\n    /**\n     * Return the address used for the QI tokens in vault\n     *\n     * @return  The address in question\n     */\n    function qiAddress() external view returns (address);\n\n    /**\n     * Return the address of the QuickSwap Router to talk to\n     *\n     * @return  The address in question\n     */\n    function quickSwapRouterAddress() external view returns (address);\n\n    /**\n     * Return the address of the QiDao Farm to use\n     *\n     * @return  The address in question\n     */\n    function qiDaoFarmAddress() external view returns (address);\n\n    /**\n     * Return the pool ID within the QiDao Farm\n     *\n     * @return  The pool ID in question\n     */\n    function qiDaoPoolId() external view returns (uint256);\n\n    // --- Fees - Automatic -----------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the markup fee the use, using `_decimals()` decimals implicitly\n     *\n     * @return  The markup fee to use\n     */\n    function markupFee() external view returns (RatioWith6Decimals);\n\n    /**\n     * Return the swap fee the use, using `_decimals()` decimals implicitly\n     *\n     * @return  The swap fee to use\n     */\n    function swapFee() external view returns (RatioWith6Decimals);\n\n    // --- Status - Automatic ---------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return wether the Peronio contract has been initialized yet\n     *\n     * @return  True whenever the contract has already been initialized, false otherwise\n     */\n    function initialized() external view returns (bool);\n\n    // --- Decimals -------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the number of decimals the PE token will work with\n     *\n     * @return decimals_  This will always be 6\n     */\n    function decimals() external view returns (uint8);\n\n    // --- Markup fee change ----------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Set the markup fee to the given value (take into account that this will use `_decimals` decimals implicitly)\n     *\n     * @param newMarkupFee  New markup fee value\n     * @return prevMarkupFee  Previous markup fee value\n     * @custom:emit  MarkupFeeUpdated\n     */\n    function setMarkupFee(RatioWith6Decimals newMarkupFee) external returns (RatioWith6Decimals prevMarkupFee);\n\n    // --- Initialization -------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Initialize the PE token by providing collateral USDC tokens - initial conversion rate will be set at the given starting ratio\n     *\n     * @param usdcAmount  Number of collateral USDC tokens\n     * @param startingRatio  Initial minting ratio in PE tokens per USDC tokens minted\n     * @custom:emit  Initialized\n     */\n    function initialize(UsdcQuantity usdcAmount, PePerUsdcQuantity startingRatio) external;\n\n    // --- State views ----------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the USDC and MAI token reserves present in QuickSwap\n     *\n     * @return usdcReserves  Number of USDC tokens in reserve\n     * @return maiReserves  Number of MAI tokens in reserve\n     */\n    function getLpReserves() external view returns (UsdcQuantity usdcReserves, MaiQuantity maiReserves);\n\n    /**\n     * Return the number of LP USDC/MAI tokens on stake at QiDao's Farm\n     *\n     * @return lpAmount  Number of LP USDC/MAI token on stake\n     */\n    function stakedBalance() external view returns (LpQuantity lpAmount);\n\n    /**\n     * Return the number of USDC and MAI tokens on stake at QiDao's Farm\n     *\n     * @return usdcAmount  Number of USDC tokens on stake\n     * @return maiAmount  Number of MAI tokens on stake\n     */\n    function stakedTokens() external view returns (UsdcQuantity usdcAmount, MaiQuantity maiAmount);\n\n    /**\n     * Return the equivalent number of USDC tokens on stake at QiDao's Farm\n     *\n     * @return usdcAmount  Total equivalent number of USDC token on stake\n     */\n    function stakedValue() external view returns (UsdcQuantity usdcAmount);\n\n    /**\n     * Return the _collateralized_ price in USDC tokens per PE token\n     *\n     * @return price  Collateralized price in USDC tokens per PE token\n     */\n    function usdcPrice() external view returns (PePerUsdcQuantity price);\n\n    /**\n     * Return the effective _minting_ price in USDC tokens per PE token\n     *\n     * @return price  Minting price in USDC tokens per PE token\n     */\n    function buyingPrice() external view returns (UsdcPerPeQuantity price);\n\n    /**\n     * Return the ratio of total number of USDC tokens per PE token\n     *\n     * @return ratio  Ratio of USDC tokens per PE token, with `_decimal` decimals\n     */\n    function collateralRatio() external view returns (UsdcPerPeQuantity ratio);\n\n    // --- State changers -------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Mint PE tokens using the provided USDC tokens as collateral --- used by the migrators in order not to incur normal fees\n     *\n     * @param to  The address to transfer the minted PE tokens to\n     * @param usdcAmount  Number of USDC tokens to use as collateral\n     * @param minReceive  The minimum number of PE tokens to mint\n     * @return peAmount  The number of PE tokens actually minted\n     * @custom:emit  Minted\n     */\n    function mintForMigration(\n        address to,\n        UsdcQuantity usdcAmount,\n        PeQuantity minReceive\n    ) external returns (PeQuantity peAmount);\n\n    /**\n     * Mint PE tokens using the provided USDC tokens as collateral\n     *\n     * @param to  The address to transfer the minted PE tokens to\n     * @param usdcAmount  Number of USDC tokens to use as collateral\n     * @param minReceive  The minimum number of PE tokens to mint\n     * @return peAmount  The number of PE tokens actually minted\n     * @custom:emit  Minted\n     */\n    function mint(\n        address to,\n        UsdcQuantity usdcAmount,\n        PeQuantity minReceive\n    ) external returns (PeQuantity peAmount);\n\n    /**\n     * Extract the given number of PE tokens as USDC tokens\n     *\n     * @param to  Address to deposit extracted USDC tokens into\n     * @param peAmount  Number of PE tokens to withdraw\n     * @return usdcTotal  Number of USDC tokens extracted\n     * @custom:emit  Withdrawal\n     */\n    function withdraw(address to, PeQuantity peAmount) external returns (UsdcQuantity usdcTotal);\n\n    /**\n     * Extract the given number of PE tokens as LP USDC/MAI tokens\n     *\n     * @param to  Address to deposit extracted LP USDC/MAI tokens into\n     * @param peAmount  Number of PE tokens to withdraw liquidity for\n     * @return lpAmount  Number of LP USDC/MAI tokens extracted\n     * @custom:emit LiquidityWithdrawal\n     */\n    function withdrawLiquidity(address to, PeQuantity peAmount) external returns (LpQuantity lpAmount);\n\n    // --- Rewards --------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the rewards accrued by staking LP USDC/MAI tokens in QiDao's Farm (in QI tokens)\n     *\n     * @return qiAmount  Number of QI tokens accrued\n     */\n    function getPendingRewardsAmount() external view returns (QiQuantity qiAmount);\n\n    /**\n     * Claim QiDao's QI token rewards, and re-invest them in the QuickSwap liquidity pool and QiDao's Farm\n     *\n     * @return usdcAmount  The number of USDC tokens being re-invested\n     * @return lpAmount  The number of LP USDC/MAI tokens being put on stake\n     * @custom:emit CompoundRewards\n     */\n    function compoundRewards() external returns (UsdcQuantity usdcAmount, LpQuantity lpAmount);\n\n    // --- Quotes ---------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Retrieve the expected number of PE tokens corresponding to the given number of USDC tokens for minting.\n     *\n     * @param usdc  Number of USDC tokens to quote for\n     * @return pe  Number of PE tokens quoted for the given number of USDC tokens\n     */\n    function quoteIn(UsdcQuantity usdc) external view returns (PeQuantity pe);\n\n    /**\n     * Retrieve the expected number of USDC tokens corresponding to the given number of PE tokens for withdrawal.\n     *\n     * @param pe  Number of PE tokens to quote for\n     * @return usdc  Number of USDC tokens quoted for the given number of PE tokens\n     */\n    function quoteOut(PeQuantity pe) external view returns (UsdcQuantity usdc);\n}\n"
    },
    "@openzeppelin/contracts_latest/access/Ownable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/Context.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/token/ERC20/extensions/ERC20Burnable.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n    /**\n     * @dev Destroys `amount` tokens from the caller.\n     *\n     * See {ERC20-_burn}.\n     */\n    function burn(uint256 amount) public virtual {\n        _burn(_msgSender(), amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n     * allowance.\n     *\n     * See {ERC20-_burn} and {ERC20-allowance}.\n     *\n     * Requirements:\n     *\n     * - the caller must have allowance for ``accounts``'s tokens of at least\n     * `amount`.\n     */\n    function burnFrom(address account, uint256 amount) public virtual {\n        _spendAllowance(account, _msgSender(), amount);\n        _burn(account, amount);\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/token/ERC20/ERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * The default value of {decimals} is 18. To select a different value for\n     * {decimals} you should overload it.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the value {ERC20} uses, unless this function is\n     * overridden;\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address to, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, allowance(owner, spender) + addedValue);\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = allowance(owner, spender);\n        require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev Moves `amount` of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     */\n    function _transfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n        unchecked {\n            _balances[from] = fromBalance - amount;\n        }\n        _balances[to] += amount;\n\n        emit Transfer(from, to, amount);\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        _balances[account] += amount;\n        emit Transfer(address(0), account, amount);\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n        }\n        _totalSupply -= amount;\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * will be transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * has been transferred to `to`.\n     * - when `from` is zero, `amount` tokens have been minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {}\n}\n"
    },
    "@openzeppelin/contracts_latest/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\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 amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` 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 amount) 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 `amount` as the allowance of `spender` over the 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 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` 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(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
    },
    "@openzeppelin/contracts_latest/token/ERC20/extensions/IERC20Metadata.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\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"
    },
    "@openzeppelin/contracts_latest/token/ERC20/extensions/draft-ERC20Permit.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/draft-EIP712.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation 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 * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n    using Counters for Counters.Counter;\n\n    mapping(address => Counters.Counter) private _nonces;\n\n    // solhint-disable-next-line var-name-mixedcase\n    bytes32 private constant _PERMIT_TYPEHASH =\n        keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n    /**\n     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n     * However, to ensure consistency with the upgradeable transpiler, we will continue\n     * to reserve a slot.\n     * @custom:oz-renamed-from _PERMIT_TYPEHASH\n     */\n    // solhint-disable-next-line var-name-mixedcase\n    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n    /**\n     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n     *\n     * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n     */\n    constructor(string memory name) EIP712(name, \"1\") {}\n\n    /**\n     * @dev See {IERC20Permit-permit}.\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 override {\n        require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n        bytes32 hash = _hashTypedDataV4(structHash);\n\n        address signer = ECDSA.recover(hash, v, r, s);\n        require(signer == owner, \"ERC20Permit: invalid signature\");\n\n        _approve(owner, spender, value);\n    }\n\n    /**\n     * @dev See {IERC20Permit-nonces}.\n     */\n    function nonces(address owner) public view virtual override returns (uint256) {\n        return _nonces[owner].current();\n    }\n\n    /**\n     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n        return _domainSeparatorV4();\n    }\n\n    /**\n     * @dev \"Consume a nonce\": return the current value and increment.\n     *\n     * _Available since v4.1._\n     */\n    function _useNonce(address owner) internal virtual returns (uint256 current) {\n        Counters.Counter storage nonce = _nonces[owner];\n        current = nonce.current();\n        nonce.increment();\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/cryptography/draft-EIP712.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n    /* solhint-disable var-name-mixedcase */\n    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n    // invalidate the cached domain separator if the chain id changes.\n    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n    uint256 private immutable _CACHED_CHAIN_ID;\n    address private immutable _CACHED_THIS;\n\n    bytes32 private immutable _HASHED_NAME;\n    bytes32 private immutable _HASHED_VERSION;\n    bytes32 private immutable _TYPE_HASH;\n\n    /* solhint-enable var-name-mixedcase */\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    constructor(string memory name, string memory version) {\n        bytes32 hashedName = keccak256(bytes(name));\n        bytes32 hashedVersion = keccak256(bytes(version));\n        bytes32 typeHash = keccak256(\n            \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n        );\n        _HASHED_NAME = hashedName;\n        _HASHED_VERSION = hashedVersion;\n        _CACHED_CHAIN_ID = block.chainid;\n        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n        _CACHED_THIS = address(this);\n        _TYPE_HASH = typeHash;\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n            return _CACHED_DOMAIN_SEPARATOR;\n        } else {\n            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n        }\n    }\n\n    function _buildDomainSeparator(\n        bytes32 typeHash,\n        bytes32 nameHash,\n        bytes32 versionHash\n    ) private view returns (bytes32) {\n        return keccak256(abi.encode(typeHash, nameHash, versionHash, 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 virtual returns (bytes32) {\n        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/Counters.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n    struct Counter {\n        // This variable should never be directly accessed by users of the library: interactions must be restricted to\n        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n        // this feature: see https://github.com/ethereum/solidity/issues/4637\n        uint256 _value; // default: 0\n    }\n\n    function current(Counter storage counter) internal view returns (uint256) {\n        return counter._value;\n    }\n\n    function increment(Counter storage counter) internal {\n        unchecked {\n            counter._value += 1;\n        }\n    }\n\n    function decrement(Counter storage counter) internal {\n        uint256 value = counter._value;\n        require(value > 0, \"Counter: decrement overflow\");\n        unchecked {\n            counter._value = value - 1;\n        }\n    }\n\n    function reset(Counter storage counter) internal {\n        counter._value = 0;\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/cryptography/ECDSA.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS,\n        InvalidSignatureV\n    }\n\n    function _throwError(RecoverError error) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert(\"ECDSA: invalid signature\");\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert(\"ECDSA: invalid signature length\");\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert(\"ECDSA: invalid signature 's' value\");\n        } else if (error == RecoverError.InvalidSignatureV) {\n            revert(\"ECDSA: invalid signature 'v' value\");\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature` or error string. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n        // Check the signature length\n        // - case 65: r,s,v signature (standard)\n        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\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 if (signature.length == 64) {\n            bytes32 r;\n            bytes32 vs;\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                vs := mload(add(signature, 0x40))\n            }\n            return tryRecover(hash, r, vs);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength);\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, signature);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address, RecoverError) {\n        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n        uint8 v = uint8((uint256(vs) >> 255) + 27);\n        return tryRecover(hash, v, r, s);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     *\n     * _Available since v4.2._\n     */\n    function recover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address, RecoverError) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS);\n        }\n        if (v != 27 && v != 28) {\n            return (address(0), RecoverError.InvalidSignatureV);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature);\n        }\n\n        return (signer, RecoverError.NoError);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n        // 32 is the length in bytes of hash,\n        // enforced by the type signature above\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from `s`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Typed Data, created from a\n     * `domainSeparator` and a `structHash`. This produces hash corresponding\n     * to the one signed with the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n     * JSON-RPC method as part of EIP-712.\n     *\n     * See {recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/token/ERC20/extensions/draft-IERC20Permit.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\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    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_latest/utils/Strings.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        // Inspired by OraclizeAPI's implementation - MIT licence\n        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n        if (value == 0) {\n            return \"0\";\n        }\n        uint256 temp = value;\n        uint256 digits;\n        while (temp != 0) {\n            digits++;\n            temp /= 10;\n        }\n        bytes memory buffer = new bytes(digits);\n        while (value != 0) {\n            digits -= 1;\n            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n            value /= 10;\n        }\n        return string(buffer);\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        if (value == 0) {\n            return \"0x00\";\n        }\n        uint256 temp = value;\n        uint256 length = 0;\n        while (temp != 0) {\n            length++;\n            temp >>= 8;\n        }\n        return toHexString(value, length);\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _HEX_SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/token/ERC20/utils/SafeERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../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    function safeTransfer(\n        IERC20 token,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    function safeIncreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        uint256 newAllowance = token.allowance(address(this), spender) + value;\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    function safeDecreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            uint256 newAllowance = oldAllowance - value;\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n        }\n    }\n\n    function safePermit(\n        IERC20Permit token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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, \"SafeERC20: low-level call failed\");\n        if (returndata.length > 0) {\n            // Return data is optional\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/Address.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(isContract(target), \"Address: delegate call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n                /// @solidity memory-safe-assembly\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/cryptography/SignatureChecker.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.1) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../Address.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n    /**\n     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     */\n    function isValidSignatureNow(\n        address signer,\n        bytes32 hash,\n        bytes memory signature\n    ) internal view returns (bool) {\n        (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n        if (error == ECDSA.RecoverError.NoError && recovered == signer) {\n            return true;\n        }\n\n        (bool success, bytes memory result) = signer.staticcall(\n            abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n        );\n        return (success &&\n            result.length == 32 &&\n            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/interfaces/IERC1271.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n    /**\n     * @dev Should return whether the signature provided is valid for the provided data\n     * @param hash      Hash of the data to be signed\n     * @param signature Signature byte array associated with _data\n     */\n    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n"
    },
    "@openzeppelin/contracts_latest/access/AccessControl.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n    struct RoleData {\n        mapping(address => bool) members;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Modifier that checks that an account has a specific role. Reverts\n     * with a standardized message including the required role.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     *\n     * _Available since v4.1._\n     */\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role);\n        _;\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n        return _roles[role].members[account];\n    }\n\n    /**\n     * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n     * Overriding this function changes the behavior of the {onlyRole} modifier.\n     *\n     * Format of the revert message is described in {_checkRole}.\n     *\n     * _Available since v4.6._\n     */\n    function _checkRole(bytes32 role) internal view virtual {\n        _checkRole(role, _msgSender());\n    }\n\n    /**\n     * @dev Revert with a standard message if `account` is missing `role`.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"AccessControl: account \",\n                        Strings.toHexString(uint160(account), 20),\n                        \" is missing role \",\n                        Strings.toHexString(uint256(role), 32)\n                    )\n                )\n            );\n        }\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function renounceRole(bytes32 role, address account) public virtual override {\n        require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event. Note that unlike {grantRole}, this function doesn't perform any\n     * checks on the calling account.\n     *\n     * May emit a {RoleGranted} event.\n     *\n     * [WARNING]\n     * ====\n     * This function should only be called from the constructor when setting\n     * up the initial roles for the system.\n     *\n     * Using this function in any other way is effectively circumventing the admin\n     * system imposed by {AccessControl}.\n     * ====\n     *\n     * NOTE: This function is deprecated in favor of {_grantRole}.\n     */\n    function _setupRole(bytes32 role, address account) internal virtual {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual {\n        if (!hasRole(role, account)) {\n            _roles[role].members[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n        }\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual {\n        if (hasRole(role, account)) {\n            _roles[role].members[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n        }\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/access/IAccessControl.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) external;\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/introspection/ERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/introspection/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
    },
    "contracts/Peronio.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n// OpenZeppelin imports\nimport {AccessControl} from \"@openzeppelin/contracts_latest/access/AccessControl.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts_latest/security/ReentrancyGuard.sol\";\nimport {ERC20} from \"@openzeppelin/contracts_latest/token/ERC20/ERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts_latest/token/ERC20/IERC20.sol\";\nimport {ERC20Permit} from \"@openzeppelin/contracts_latest/token/ERC20/extensions/draft-ERC20Permit.sol\";\nimport {ERC20Burnable} from \"@openzeppelin/contracts_latest/token/ERC20/extensions/ERC20Burnable.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts_latest/token/ERC20/utils/SafeERC20.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\n// QiDao\nimport {IFarm} from \"./qidao/IFarm.sol\";\n\n// UniSwap\nimport {IERC20Uniswap} from \"./uniswap/interfaces/IERC20Uniswap.sol\";\nimport {IUniswapV2Pair} from \"./uniswap/interfaces/IUniswapV2Pair.sol\";\nimport {IUniswapV2Router02} from \"./uniswap/interfaces/IUniswapV2Router02.sol\";\n\n// Interface & support\nimport \"./PeronioSupport.sol\";\n\nstring constant NAME = \"Peronio\";\nstring constant SYMBOL = \"PE\";\n\ncontract Peronio is IPeronio, ERC20, ERC20Burnable, ERC20Permit, ERC165, AccessControl, ReentrancyGuard {\n    using SafeERC20 for IERC20;\n\n    // Roles\n    RoleId public constant override MARKUP_ROLE = RoleId.wrap(keccak256(\"MARKUP_ROLE\"));\n    RoleId public constant override REWARDS_ROLE = RoleId.wrap(keccak256(\"REWARDS_ROLE\"));\n    RoleId public constant override MIGRATOR_ROLE = RoleId.wrap(keccak256(\"MIGRATOR_ROLE\"));\n\n    // USDC Token Address\n    address public immutable override usdcAddress;\n    // MAI Token Address\n    address public immutable override maiAddress;\n    // LP USDC/MAI Address from QuickSwap\n    address public immutable override lpAddress;\n    // QI Token Address\n    address public immutable override qiAddress;\n\n    // QuickSwap Router Address\n    address public immutable override quickSwapRouterAddress;\n\n    // QiDao Farm Address\n    address public immutable override qiDaoFarmAddress;\n    // QiDao Pool ID\n    uint256 public immutable override qiDaoPoolId;\n\n    // Constant number of significant decimals\n    uint8 private constant DECIMALS = 6;\n\n    // One-hour constant\n    uint256 private constant ONE_HOUR = 60 * 60; /* 60 minutes * 60 seconds */\n\n    // Rational constant one\n    RatioWith6Decimals private constant ONE = RatioWith6Decimals.wrap(10**DECIMALS);\n\n    // Fees\n    RatioWith6Decimals public override markupFee = RatioWith6Decimals.wrap(50000); // 5.00%\n    RatioWith6Decimals public override swapFee = RatioWith6Decimals.wrap(1500); // 0.15%\n\n    // Initialization can only be run once\n    bool public override initialized;\n\n    /**\n     * Allow execution by the default admin only\n     *\n     */\n    modifier onlyAdminRole() {\n        _checkRole(DEFAULT_ADMIN_ROLE);\n        _;\n    }\n\n    /**\n     * Allow execution by the markup-setter only\n     *\n     */\n    modifier onlyMarkupRole() {\n        _checkRole(RoleId.unwrap(MARKUP_ROLE));\n        _;\n    }\n\n    /**\n     * Allow execution by the rewards-reaper only\n     *\n     */\n    modifier onlyRewardsRole() {\n        _checkRole(RoleId.unwrap(REWARDS_ROLE));\n        _;\n    }\n\n    /**\n     * Allow execution by the migrator only\n     *\n     */\n    modifier onlyMigratorRole() {\n        _checkRole(RoleId.unwrap(MIGRATOR_ROLE));\n        _;\n    }\n\n    // --------------------------------------------------------------------------------------------------------------------------------------------------------\n    // --- Public Interface -----------------------------------------------------------------------------------------------------------------------------------\n    // --------------------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Construct a new Peronio contract\n     *\n     * @param _usdcAddress  Address used for the USDC tokens in vault\n     * @param _maiAddress  Address used for the MAI tokens in vault\n     * @param _lpAddress  LP Address for MAI/USDC\n     * @param _qiAddress  Address used for the QI tokens in vault\n     * @param _quickSwapRouterAddress  Address of the QuickSwap Router to talk to\n     * @param _qiDaoFarmAddress  Address of the QiDao Farm to use\n     * @param _qiDaoPoolId  Pool ID within the QiDao Farm\n     */\n    constructor(\n        address _usdcAddress,\n        address _maiAddress,\n        address _lpAddress,\n        address _qiAddress,\n        address _quickSwapRouterAddress,\n        address _qiDaoFarmAddress,\n        uint256 _qiDaoPoolId\n    ) ERC20(NAME, SYMBOL) ERC20Permit(NAME) {\n        // --- Gas Saving -------------------------------------------------------------------------\n        address sender = _msgSender();\n\n        // Stablecoin Addresses\n        usdcAddress = _usdcAddress;\n        maiAddress = _maiAddress;\n\n        // LP USDC/MAI Address\n        lpAddress = _lpAddress;\n\n        // Router Address\n        quickSwapRouterAddress = _quickSwapRouterAddress;\n\n        // QiDao Data\n        qiDaoFarmAddress = _qiDaoFarmAddress;\n        qiDaoPoolId = _qiDaoPoolId;\n        qiAddress = _qiAddress;\n\n        // Grant roles\n        _setupRole(DEFAULT_ADMIN_ROLE, sender);\n        _setupRole(RoleId.unwrap(MARKUP_ROLE), sender);\n        _setupRole(RoleId.unwrap(REWARDS_ROLE), sender);\n        _setupRole(RoleId.unwrap(MIGRATOR_ROLE), sender);\n    }\n\n    /**\n     * Implementation of the IERC165 interface\n     *\n     * @param interfaceId  Interface ID to check against\n     * @return  Whether the provided interface ID is supported\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, ERC165) returns (bool) {\n        return interfaceId == type(IPeronio).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    // --- Decimals -------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the number of decimals the PE token will work with\n     *\n     * @return decimals_  This will always be 6\n     */\n    function decimals() public view virtual override(ERC20, IPeronio) returns (uint8 decimals_) {\n        decimals_ = DECIMALS;\n    }\n\n    // --- Markup fee change ----------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Set the markup fee to the given value (take into account that this will use `DECIMALS` decimals implicitly)\n     *\n     * @param newMarkupFee  New markup fee value\n     * @return prevMarkupFee  Previous markup fee value\n     * @custom:emit  MarkupFeeUpdated\n     */\n    function setMarkupFee(RatioWith6Decimals newMarkupFee) external override onlyMarkupRole returns (RatioWith6Decimals prevMarkupFee) {\n        (prevMarkupFee, markupFee) = (markupFee, newMarkupFee);\n\n        emit MarkupFeeUpdated(_msgSender(), newMarkupFee);\n    }\n\n    // --- Initialization -------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Initialize the PE token by providing collateral USDC tokens - initial conversion rate will be set at the given starting ratio\n     *\n     * @param usdcAmount  Number of collateral USDC tokens\n     * @param startingRatio  Initial minting ratio in PE tokens per USDC tokens minted (including DECIMALS)\n     * @custom:emit  Initialized\n     */\n    function initialize(UsdcQuantity usdcAmount, PePerUsdcQuantity startingRatio) external override onlyAdminRole {\n        // Prevent double initialization\n        require(!initialized, \"Contract already initialized\");\n        initialized = true;\n\n        // --- Gas Saving -------------------------------------------------------------------------\n        IERC20 maiERC20 = IERC20(maiAddress);\n        IERC20 usdcERC20 = IERC20(usdcAddress);\n        IERC20 lpERC20 = IERC20(lpAddress);\n        IERC20 qiERC20 = IERC20(qiAddress);\n        address sender = _msgSender();\n        address _quickSwapRouterAddress = quickSwapRouterAddress;\n        uint256 maxVal = type(uint256).max;\n\n        // Transfer initial USDC amount from user to current contract\n        usdcERC20.safeTransferFrom(sender, address(this), UsdcQuantity.unwrap(usdcAmount));\n\n        // Unlimited ERC20 approval for Router\n        maiERC20.approve(_quickSwapRouterAddress, maxVal);\n        usdcERC20.approve(_quickSwapRouterAddress, maxVal);\n        lpERC20.approve(_quickSwapRouterAddress, maxVal);\n        qiERC20.approve(_quickSwapRouterAddress, maxVal);\n\n        // Commit the complete initial USDC amount\n        _zapIn(usdcAmount);\n        usdcAmount = _stakedValue();\n\n        // Mints exactly startingRatio for each collateral USDC token\n        _mint(sender, PeQuantity.unwrap(mulDiv(usdcAmount, startingRatio, ONE)));\n\n        emit Initialized(sender, usdcAmount, startingRatio);\n    }\n\n    // --- State views ----------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the USDC and MAI token reserves present in QuickSwap\n     *\n     * @return usdcReserves  Number of USDC tokens in reserve\n     * @return maiReserves  Number of MAI tokens in reserve\n     */\n    function getLpReserves() external view override returns (UsdcQuantity usdcReserves, MaiQuantity maiReserves) {\n        (usdcReserves, maiReserves) = _getLpReserves();\n    }\n\n    /**\n     * Return the number of LP USDC/MAI tokens on stake at QiDao's Farm\n     *\n     * @return lpAmount  Number of LP USDC/MAI token on stake\n     */\n    function stakedBalance() external view override returns (LpQuantity lpAmount) {\n        lpAmount = _stakedBalance();\n    }\n\n    /**\n     * Return the number of USDC and MAI tokens on stake at QiDao's Farm\n     *\n     * @return usdcAmount  Number of USDC tokens on stake\n     * @return maiAmount  Number of MAI tokens on stake\n     */\n    function stakedTokens() external view override returns (UsdcQuantity usdcAmount, MaiQuantity maiAmount) {\n        (usdcAmount, maiAmount) = _stakedTokens();\n    }\n\n    /**\n     * Return the equivalent number of USDC tokens on stake at QiDao's Farm\n     *\n     * @return usdcAmount  Total equivalent number of USDC token on stake\n     */\n    function stakedValue() external view override returns (UsdcQuantity usdcAmount) {\n        usdcAmount = _stakedValue();\n    }\n\n    /**\n     * Return the _collateralized_ price in USDC tokens per PE token\n     *\n     * @return price  Collateralized price in USDC tokens per PE token\n     */\n    function usdcPrice() external view override returns (PePerUsdcQuantity price) {\n        price = mulDiv(ONE, _totalSupply(), _stakedValue());\n    }\n\n    /**\n     * Return the effective _minting_ price in USDC tokens per PE token\n     *\n     * @return price  Minting price in USDC tokens per PE token\n     */\n    function buyingPrice() external view override returns (UsdcPerPeQuantity price) {\n        price = mulDiv(_collateralRatio(), add(ONE, markupFee), ONE);\n    }\n\n    /**\n     * Return the ratio of total number of USDC tokens per PE token\n     *\n     * @return ratio  Ratio of USDC tokens per PE token, with `_decimal` decimals\n     */\n    function collateralRatio() external view override returns (UsdcPerPeQuantity ratio) {\n        ratio = _collateralRatio();\n    }\n\n    // --- State changers -------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Mint PE tokens using the provided USDC tokens as collateral\n     *\n     * @param to  The address to transfer the minted PE tokens to\n     * @param usdcAmount  Number of USDC tokens to use as collateral\n     * @param minReceive  The minimum number of PE tokens to mint\n     * @return peAmount  The number of PE tokens actually minted\n     * @custom:emit  Minted\n     */\n    function mint(\n        address to,\n        UsdcQuantity usdcAmount,\n        PeQuantity minReceive\n    ) external override nonReentrant returns (PeQuantity peAmount) {\n        peAmount = _mintPe(to, usdcAmount, minReceive, markupFee);\n    }\n\n    /**\n     * Mint PE tokens using the provided USDC tokens as collateral --- used by the migrators in order not to incur normal fees\n     *\n     * @param to  The address to transfer the minted PE tokens to\n     * @param usdcAmount  Number of USDC tokens to use as collateral\n     * @param minReceive  The minimum number of PE tokens to mint\n     * @return peAmount  The number of PE tokens actually minted\n     * @custom:emit  Minted\n     */\n    function mintForMigration(\n        address to,\n        UsdcQuantity usdcAmount,\n        PeQuantity minReceive\n    ) external override nonReentrant onlyMigratorRole returns (PeQuantity peAmount) {\n        peAmount = _mintPe(to, usdcAmount, minReceive, RatioWith6Decimals.wrap(0));\n    }\n\n    /**\n     * Extract the given number of PE tokens as USDC tokens\n     *\n     * @param to  Address to deposit extracted USDC tokens into\n     * @param peAmount  Number of PE tokens to withdraw\n     * @return usdcTotal  Number of USDC tokens extracted\n     * @custom:emit  Withdrawal\n     */\n    function withdraw(address to, PeQuantity peAmount) external override nonReentrant returns (UsdcQuantity usdcTotal) {\n        // --- Gas Saving -------------------------------------------------------------------------\n        address sender = _msgSender();\n\n        // Calculate equivalent number of LP USDC/MAI tokens for the given burnt PE tokens\n        LpQuantity lpAmount = mulDiv(peAmount, _stakedBalance(), _totalSupply());\n\n        // Extract the given number of LP USDC/MAI tokens as USDC tokens\n        usdcTotal = _zapOut(lpAmount);\n\n        // Transfer USDC tokens the the given address\n        IERC20(usdcAddress).safeTransfer(to, UsdcQuantity.unwrap(usdcTotal));\n\n        // Burn the given number of PE tokens\n        _burn(sender, PeQuantity.unwrap(peAmount));\n\n        emit Withdrawal(sender, usdcTotal, peAmount);\n    }\n\n    /**\n     * Extract the given number of PE tokens as LP USDC/MAI tokens\n     *\n     * @param to  Address to deposit extracted LP USDC/MAI tokens into\n     * @param peAmount  Number of PE tokens to withdraw liquidity for\n     * @return lpAmount  Number of LP USDC/MAI tokens extracted\n     * @custom:emit LiquidityWithdrawal\n     */\n    function withdrawLiquidity(address to, PeQuantity peAmount) external override nonReentrant returns (LpQuantity lpAmount) {\n        // --- Gas Saving -------------------------------------------------------------------------\n        address sender = _msgSender();\n\n        // Calculate equivalent number of LP USDC/MAI tokens for the given burnt PE tokens\n        lpAmount = mulDiv(peAmount, _stakedBalance(), _totalSupply());\n\n        // Get LP USDC/MAI tokens out of QiDao's Farm\n        _unstakeLP(lpAmount);\n\n        // Transfer LP USDC/MAI tokens to the given address\n        IERC20(lpAddress).safeTransfer(to, LpQuantity.unwrap(lpAmount));\n\n        // Burn the given number of PE tokens\n        _burn(sender, PeQuantity.unwrap(peAmount));\n\n        emit LiquidityWithdrawal(sender, lpAmount, peAmount);\n    }\n\n    // --- Rewards --------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the rewards accrued by staking LP USDC/MAI tokens in QiDao's Farm (in QI tokens)\n     *\n     * @return qiAmount  Number of QI tokens accrued\n     */\n    function getPendingRewardsAmount() external view override returns (QiQuantity qiAmount) {\n        qiAmount = _getPendingRewardsAmount();\n    }\n\n    /**\n     * Claim QiDao's QI token rewards, and re-invest them in the QuickSwap liquidity pool and QiDao's Farm\n     *\n     * @return usdcAmount  The number of USDC tokens being re-invested\n     * @return lpAmount  The number of LP USDC/MAI tokens being put on stake\n     * @custom:emit CompoundRewards\n     */\n    function compoundRewards() external override onlyRewardsRole returns (UsdcQuantity usdcAmount, LpQuantity lpAmount) {\n        // Claim rewards from QiDao's Farm\n        IFarm(qiDaoFarmAddress).deposit(qiDaoPoolId, 0);\n\n        // Retrieve the number of QI tokens rewarded and swap them to USDC tokens\n        QiQuantity amount = QiQuantity.wrap(IERC20(qiAddress).balanceOf(address(this)));\n        _swapTokens(amount);\n\n        // Commit all USDC tokens so converted to the QuickSwap liquidity pool\n        usdcAmount = UsdcQuantity.wrap(IERC20(usdcAddress).balanceOf(address(this)));\n        lpAmount = _zapIn(usdcAmount);\n\n        emit CompoundRewards(amount, usdcAmount, lpAmount);\n    }\n\n    // --- Quotes ---------------------------------------------------------------------------------------------------------------------------------------------\n    //\n    // Quotes are created by inlining the calls to mint (for quoteIn) and withdraw (for quoteOut), and discarding state-changing statements\n    //\n\n    /**\n     * Retrieve the expected number of PE tokens corresponding to the given number of USDC tokens for minting.\n     *\n     * @dev This method was obtained by _inlining_ the call to mint() across contracts, and cleaning up the result.\n     *\n     * @param usdc  Number of USDC tokens to quote for\n     * @return pe  Number of PE tokens quoted for the given number of USDC tokens\n     */\n    function quoteIn(UsdcQuantity usdc) external view override returns (PeQuantity pe) {\n        // --- Gas Saving -------------------------------------------------------------------------\n        address _lpAddress = lpAddress;\n\n        // retrieve LP state (simulations will modify these)\n        (UsdcQuantity usdcReserves, MaiQuantity maiReserves) = _getLpReserves();\n        LpQuantity lpTotalSupply = LpQuantity.wrap(IERC20(_lpAddress).totalSupply());\n\n        // -- SPLIT -------------------------------------------------------------------------------\n        UsdcQuantity usdcAmount = _calculateSwapInAmount(usdcReserves, usdc);\n        MaiQuantity maiAmount = _getAmountOut(usdcAmount, usdcReserves, maiReserves);\n\n        // simulate LP state update\n        usdcReserves = add(usdcReserves, usdcAmount);\n        maiReserves = sub(maiReserves, maiAmount);\n\n        // -- SWAP --------------------------------------------------------------------------------\n\n        // calculate actual values swapped\n        {\n            MaiQuantity amountMaiOptimal = mulDiv(sub(usdc, usdcAmount), maiReserves, usdcReserves);\n            if (lte(amountMaiOptimal, maiAmount)) {\n                (usdcAmount, maiAmount) = (sub(usdc, usdcAmount), amountMaiOptimal);\n            } else {\n                UsdcQuantity amountUsdcOptimal = mulDiv(maiAmount, usdcReserves, maiReserves);\n                (usdcAmount, maiAmount) = (amountUsdcOptimal, maiAmount);\n            }\n        }\n\n        // deal with LP minting when changing its K\n        {\n            UniSwapRootKQuantity rootK = sqrt(mul(usdcReserves, maiReserves));\n            UniSwapRootKQuantity rootKLast = sqrt(UniSwapKQuantity.wrap(IUniswapV2Pair(_lpAddress).kLast()));\n            if (lt(rootKLast, rootK)) {\n                lpTotalSupply = add(lpTotalSupply, mulDiv(lpTotalSupply, sub(rootK, rootKLast), add(mul(rootK, 5), rootKLast)));\n            }\n        }\n\n        // calculate LP values actually provided\n        LpQuantity zapInLps;\n        {\n            LpQuantity maiCandidate = mulDiv(maiAmount, lpTotalSupply, maiReserves);\n            LpQuantity usdcCandidate = mulDiv(usdcAmount, lpTotalSupply, usdcReserves);\n            zapInLps = min(maiCandidate, usdcCandidate);\n        }\n\n        // -- PERONIO -----------------------------------------------------------------------------\n        LpQuantity lpAmount = mulDiv(zapInLps, sub(ONE, _totalMintFee(markupFee)), ONE);\n        pe = mulDiv(lpAmount, _totalSupply(), _stakedBalance());\n    }\n\n    /**\n     * Retrieve the expected number of USDC tokens corresponding to the given number of PE tokens for withdrawal.\n     *\n     * @dev This method was obtained by _inlining_ the call to withdraw() across contracts, and cleaning up the result.\n     *\n     * @param pe  Number of PE tokens to quote for\n     * @return usdc  Number of USDC tokens quoted for the given number of PE tokens\n     */\n    function quoteOut(PeQuantity pe) external view override returns (UsdcQuantity usdc) {\n        // --- Gas Saving -------------------------------------------------------------------------\n        address _lpAddress = lpAddress;\n\n        (UsdcQuantity usdcReserves, MaiQuantity maiReserves) = _getLpReserves();\n        LpQuantity lpTotalSupply = LpQuantity.wrap(IERC20(_lpAddress).totalSupply());\n\n        // deal with LP minting when changing its K\n        {\n            UniSwapRootKQuantity rootK = sqrt(mul(usdcReserves, maiReserves));\n            UniSwapRootKQuantity rootKLast = sqrt(UniSwapKQuantity.wrap(IUniswapV2Pair(_lpAddress).kLast()));\n            if (lt(rootKLast, rootK)) {\n                lpTotalSupply = add(lpTotalSupply, mulDiv(lpTotalSupply, sub(rootK, rootKLast), add(mul(rootK, 5), rootKLast)));\n            }\n        }\n\n        // calculate LP values actually withdrawn\n        LpQuantity lpAmount = add(LpQuantity.wrap(IERC20Uniswap(_lpAddress).balanceOf(_lpAddress)), mulDiv(pe, _stakedBalance(), _totalSupply()));\n\n        UsdcQuantity usdcAmount = mulDiv(usdcReserves, lpAmount, lpTotalSupply);\n        MaiQuantity maiAmount = mulDiv(maiReserves, lpAmount, lpTotalSupply);\n\n        usdc = add(usdcAmount, _getAmountOut(maiAmount, sub(maiReserves, maiAmount), sub(usdcReserves, usdcAmount)));\n    }\n\n    // --------------------------------------------------------------------------------------------------------------------------------------------------------\n    // --- Private Interface ----------------------------------------------------------------------------------------------------------------------------------\n    // --------------------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Return the number of PE tokens in existence\n     *\n     * @return peAmount  Number of PE tokens in existence\n     */\n    function _totalSupply() internal view returns (PeQuantity peAmount) {\n        peAmount = PeQuantity.wrap(totalSupply());\n    }\n\n    /**\n     * Return the USDC and MAI token reserves present in QuickSwap\n     *\n     * @return usdcReserves  Number of USDC tokens in reserve\n     * @return maiReserves  Number of MAI tokens in reserve\n     */\n    function _getLpReserves() internal view returns (UsdcQuantity usdcReserves, MaiQuantity maiReserves) {\n        (uint112 reserve0, uint112 reserve1, ) = IUniswapV2Pair(lpAddress).getReserves();\n        (usdcReserves, maiReserves) = usdcAddress < maiAddress\n            ? (UsdcQuantity.wrap(reserve0), MaiQuantity.wrap(reserve1))\n            : (UsdcQuantity.wrap(reserve1), MaiQuantity.wrap(reserve0));\n    }\n\n    /**\n     * Return the number of LP USDC/MAI tokens on stake at QiDao's Farm\n     *\n     * @return lpAmount  Number of LP USDC/MAI token on stake\n     */\n    function _stakedBalance() internal view returns (LpQuantity lpAmount) {\n        lpAmount = LpQuantity.wrap(IFarm(qiDaoFarmAddress).deposited(qiDaoPoolId, address(this)));\n    }\n\n    /**\n     * Return the number of USDC and MAI tokens on stake at QiDao's Farm\n     *\n     * @return usdcAmount  Number of USDC tokens on stake\n     * @return maiAmount  Number of MAI tokens on stake\n     */\n    function _stakedTokens() internal view returns (UsdcQuantity usdcAmount, MaiQuantity maiAmount) {\n        LpQuantity lpAmount = _stakedBalance();\n        LpQuantity lpTotalSupply = LpQuantity.wrap(IERC20(lpAddress).totalSupply());\n\n        (UsdcQuantity usdcReserves, MaiQuantity maiReserves) = _getLpReserves();\n\n        usdcAmount = mulDiv(lpAmount, usdcReserves, lpTotalSupply);\n        maiAmount = mulDiv(lpAmount, maiReserves, lpTotalSupply);\n    }\n\n    /**\n     * Return the equivalent number of USDC tokens on stake at QiDao's Farm\n     *\n     * This method will return the equivalent number of USDC tokens for the number of USDC and MAI tokens on stake.\n     *\n     * @return totalUSDC  Total equivalent number of USDC token on stake\n     */\n    function _stakedValue() internal view returns (UsdcQuantity totalUSDC) {\n        (UsdcQuantity usdcReserves, MaiQuantity maiReserves) = _getLpReserves();\n        (UsdcQuantity usdcAmount, MaiQuantity maiAmount) = _stakedTokens();\n\n        // Simulate Swap\n        totalUSDC = add(usdcAmount, _getAmountOut(maiAmount, maiReserves, usdcReserves));\n    }\n\n    /**\n     * Return the ratio of total number of USDC tokens per PE token\n     *\n     * @return ratio  Ratio of USDC tokens per PE token, with `_decimal` decimals\n     */\n    function _collateralRatio() internal view returns (UsdcPerPeQuantity ratio) {\n        ratio = mulDiv(ONE, _stakedValue(), _totalSupply());\n    }\n\n    /**\n     * Return the total minting fee to apply\n     *\n     * @return totalFee  The total fee to apply on minting\n     */\n    function _totalMintFee(RatioWith6Decimals _markupFee) internal view returns (RatioWith6Decimals totalFee) {\n        // Retrieve the deposit fee from QiDao's Farm (this is always expressed with 4 decimals, as \"basic points\")\n        // Convert these \"basic points\" to `DECIMALS` precision\n        (, , , , uint16 depositFeeBP) = IFarm(qiDaoFarmAddress).poolInfo(qiDaoPoolId);\n        RatioWith6Decimals depositFee = ratio4to6(RatioWith4Decimals.wrap(depositFeeBP));\n\n        // Calculate total fee to apply\n        // (ie. the swapFee and the depositFee are included in the total markup fee, thus, we don't double charge for both the markup fee itself\n        // and the swap and deposit fees)\n        totalFee = max(_markupFee, add(swapFee, depositFee));\n    }\n\n    /**\n     * Actually mint PE tokens using the provided USDC tokens as collateral, applying the given markup fee\n     *\n     * @param to  The address to transfer the minted PE tokens to\n     * @param usdcAmount  Number of USDC tokens to use as collateral\n     * @param minReceive  The minimum number of PE tokens to mint\n     * @param _markupFee  The markup fee to apply\n     * @return peAmount  The number of PE tokens actually minted\n     * @custom:emit  Minted\n     */\n    function _mintPe(\n        address to,\n        UsdcQuantity usdcAmount,\n        PeQuantity minReceive,\n        RatioWith6Decimals _markupFee\n    ) internal returns (PeQuantity peAmount) {\n        // --- Gas Saving -------------------------------------------------------------------------\n        address sender = _msgSender();\n\n        // Transfer USDC tokens as collateral to this contract\n        IERC20(usdcAddress).safeTransferFrom(sender, address(this), UsdcQuantity.unwrap(usdcAmount));\n\n        // Remember the previously staked balance\n        LpQuantity stakedAmount = _stakedBalance();\n\n        // Commit USDC tokens, and discount fees totalling the markup fee\n        LpQuantity lpAmount = mulDiv(_zapIn(usdcAmount), sub(ONE, _totalMintFee(_markupFee)), ONE);\n\n        // Calculate the number of PE tokens as the proportion of liquidity provided\n        peAmount = mulDiv(lpAmount, _totalSupply(), stakedAmount);\n\n        require(lte(minReceive, peAmount), \"Minimum required not met\");\n\n        // Actually mint the PE tokens\n        _mint(to, PeQuantity.unwrap(peAmount));\n\n        emit Minted(sender, usdcAmount, peAmount);\n    }\n\n    /**\n     * Commit the given number of USDC tokens\n     *\n     * This method will:\n     *   1. split the given USDC amount into USDC/MAI amounts so as to provide balanced liquidity,\n     *   2. add the given amounts of USDC and MAI tokens to the liquidity pool, and obtain LP USDC/MAI tokens in return, and\n     *   3. stake the given LP USDC/MAI tokens in QiDao's Farm so as to accrue rewards therein.\n     *\n     * @param usdcAmount  Number of USDC tokens to commit\n     * @return lpAmount  Number of LP USDC/MAI tokens committed\n     */\n    function _zapIn(UsdcQuantity usdcAmount) internal returns (LpQuantity lpAmount) {\n        MaiQuantity maiAmount;\n\n        (usdcAmount, maiAmount) = _splitUSDC(usdcAmount);\n        lpAmount = _addLiquidity(usdcAmount, maiAmount);\n        _stakeLP(lpAmount);\n    }\n\n    /**\n     * Extract the given number of LP USDC/MAI tokens\n     *\n     * This method will:\n     *   1. unstake the given number of LP USDC/MAI tokens from QuiDao's Farm,\n     *   2. remove the liquidity provided by the given number of LP USDC/MAI tokens from the liquidity pool, and\n     *   3. convert the MAI tokens back into USDC tokens.\n     *\n     * @param lpAmount  Number of LP USDC/MAI tokens to extract\n     * @return usdcAmount  Number of extracted USDC tokens\n     */\n    function _zapOut(LpQuantity lpAmount) internal returns (UsdcQuantity usdcAmount) {\n        MaiQuantity maiAmount;\n\n        _unstakeLP(lpAmount);\n        (usdcAmount, maiAmount) = _removeLiquidity(lpAmount);\n        usdcAmount = _unsplitUSDC(usdcAmount, maiAmount);\n    }\n\n    /**\n     * Given a USDC token amount, split a portion of it into MAI tokens so as to provide balanced liquidity\n     *\n     * @param amount  Number of USDC tokens to split\n     * @return usdcAmount  Number of resulting USDC tokens\n     * @return maiAmount  Number of resulting MAI tokens\n     */\n    function _splitUSDC(UsdcQuantity amount) internal returns (UsdcQuantity usdcAmount, MaiQuantity maiAmount) {\n        (UsdcQuantity usdcReserves, ) = _getLpReserves();\n        UsdcQuantity amountToSwap = _calculateSwapInAmount(usdcReserves, amount);\n\n        require(lt(UsdcQuantity.wrap(0), amountToSwap), \"Nothing to swap\");\n\n        maiAmount = _swapTokens(amountToSwap);\n        usdcAmount = sub(amount, amountToSwap);\n    }\n\n    /**\n     * Given a USDC token amount and a MAI token amount, swap MAIs into USDCs and consolidate\n     *\n     * @param amount  Number of USDC tokens to consolidate with\n     * @param maiAmount  Number of MAI tokens to consolidate in\n     * @return usdcAmount  Consolidated USDC amount\n     */\n    function _unsplitUSDC(UsdcQuantity amount, MaiQuantity maiAmount) internal returns (UsdcQuantity usdcAmount) {\n        usdcAmount = add(amount, _swapTokens(maiAmount));\n    }\n\n    /**\n     * Add liquidity to the QuickSwap Liquidity Pool, as much as indicated by the given pair od USDC/MAI amounts\n     *\n     * @param usdcAmount  Number of USDC tokens to add\n     * @param maiAmount  Number of MAI tokens to add\n     * @return lpAmount  Number of LP USDC/MAI tokens obtained\n     */\n    function _addLiquidity(UsdcQuantity usdcAmount, MaiQuantity maiAmount) internal returns (LpQuantity lpAmount) {\n        (, , uint256 _lpAmount) = IUniswapV2Router02(quickSwapRouterAddress).addLiquidity(\n            usdcAddress,\n            maiAddress,\n            UsdcQuantity.unwrap(usdcAmount),\n            MaiQuantity.unwrap(maiAmount),\n            1,\n            1,\n            address(this),\n            block.timestamp + ONE_HOUR\n        );\n        lpAmount = LpQuantity.wrap(_lpAmount);\n    }\n\n    /**\n     * Remove liquidity from the QuickSwap Liquidity Pool, as much as indicated by the given amount of LP tokens\n     *\n     * @param lpAmount  Number of LP USDC/MAI tokens to withdraw\n     * @return usdcAmount  Number of USDC tokens withdrawn\n     * @return maiAmount  Number of MAI tokens withdrawn\n     */\n    function _removeLiquidity(LpQuantity lpAmount) internal returns (UsdcQuantity usdcAmount, MaiQuantity maiAmount) {\n        (uint256 _usdcAmount, uint256 _maiAmount) = IUniswapV2Router02(quickSwapRouterAddress).removeLiquidity(\n            usdcAddress,\n            maiAddress,\n            LpQuantity.unwrap(lpAmount),\n            1,\n            1,\n            address(this),\n            block.timestamp + ONE_HOUR\n        );\n        (usdcAmount, maiAmount) = (UsdcQuantity.wrap(_usdcAmount), MaiQuantity.wrap(_maiAmount));\n    }\n\n    /**\n     * Deposit the given number of LP tokens into QiDao's Farm\n     *\n     * @param lpAmount  Number of LP USDC/MAI tokens to deposit into QiDao's Farm\n     */\n    function _stakeLP(LpQuantity lpAmount) internal {\n        // --- Gas Saving -------------------------------------------------------------------------\n        address _qiDaoFarmAddress = qiDaoFarmAddress;\n\n        IERC20(lpAddress).approve(_qiDaoFarmAddress, LpQuantity.unwrap(lpAmount));\n        IFarm(_qiDaoFarmAddress).deposit(qiDaoPoolId, LpQuantity.unwrap(lpAmount));\n    }\n\n    /**\n     * Remove the given number of LP tokens from QiDao's Farm\n     *\n     * @param lpAmount  Number of LP USDC/MAI tokens to remove from QiDao's Farm\n     */\n    function _unstakeLP(LpQuantity lpAmount) internal {\n        IFarm(qiDaoFarmAddress).withdraw(qiDaoPoolId, LpQuantity.unwrap(lpAmount));\n    }\n\n    /**\n     * Return the rewards accrued by staking LP USDC/MAI tokens in QiDao's Farm (in QI tokens)\n     *\n     * @return qiAmount  Number of QI tokens accrued\n     */\n    function _getPendingRewardsAmount() internal view returns (QiQuantity qiAmount) {\n        // Get rewards on Farm\n        qiAmount = QiQuantity.wrap(IFarm(qiDaoFarmAddress).pending(qiDaoPoolId, address(this)));\n    }\n\n    /**\n     * Swap the given number of MAI tokens to USDC\n     *\n     * @param maiAmount  Number of MAI tokens to swap\n     * @return usdcAmount  Number of USDC tokens obtained\n     */\n    function _swapTokens(MaiQuantity maiAmount) internal returns (UsdcQuantity usdcAmount) {\n        usdcAmount = UsdcQuantity.wrap(_swapTokens(maiAddress, usdcAddress, MaiQuantity.unwrap(maiAmount)));\n    }\n\n    /**\n     * Swap the given number of USDC tokens to MAI\n     *\n     * @param usdcAmount  Number of USDC tokens to swap\n     * @return maiAmount  Number of MAI tokens obtained\n     */\n    function _swapTokens(UsdcQuantity usdcAmount) internal returns (MaiQuantity maiAmount) {\n        maiAmount = MaiQuantity.wrap(_swapTokens(usdcAddress, maiAddress, UsdcQuantity.unwrap(usdcAmount)));\n    }\n\n    /**\n     * Swap the given number of QI tokens to USDC\n     *\n     * @param qiAmount  Number of QI tokens to swap\n     * @return usdcAmount  Number of USDC tokens obtained\n     */\n    function _swapTokens(QiQuantity qiAmount) internal returns (UsdcQuantity usdcAmount) {\n        usdcAmount = UsdcQuantity.wrap(_swapTokens(qiAddress, usdcAddress, QiQuantity.unwrap(qiAmount)));\n    }\n\n    /**\n     * Swap the given amount of tokens from the given \"from\" address to the given \"to\" address via QuickSwap, and return the amount of \"to\" tokens swapped\n     *\n     * @param fromAddress  Address to get swap tokens from\n     * @param toAddress  Address to get swap tokens to\n     * @param amount  Amount of tokens to swap (from)\n     * @return swappedAmount  Amount of tokens deposited in addressTo\n     */\n    function _swapTokens(\n        address fromAddress,\n        address toAddress,\n        uint256 amount\n    ) internal returns (uint256 swappedAmount) {\n        address[] memory path = new address[](2);\n        (path[0], path[1]) = (fromAddress, toAddress);\n\n        swappedAmount = IUniswapV2Router02(quickSwapRouterAddress).swapExactTokensForTokens(amount, 1, path, address(this), block.timestamp + ONE_HOUR)[1];\n    }\n\n    // --------------------------------------------------------------------------------------------------------------------------------------------------------\n    // --- UniSwap Simulation ---------------------------------------------------------------------------------------------------------------------------------\n    // --------------------------------------------------------------------------------------------------------------------------------------------------------\n\n    function _calculateSwapInAmount(UsdcQuantity reserveIn, UsdcQuantity userIn) internal pure returns (UsdcQuantity amount) {\n        amount = sub(sqrt(mulDiv(add(mul(3988009, reserveIn), mul(3988000, userIn)), reserveIn, 3976036)), mulDiv(reserveIn, 1997, 1994));\n    }\n\n    function _getAmountOut(\n        uint256 amountIn,\n        uint256 reserveIn,\n        uint256 reserveOut\n    ) internal pure returns (uint256 amountOut) {\n        uint256 amountInWithFee = amountIn * 997;\n        amountOut = Math.mulDiv(amountInWithFee, reserveOut, reserveIn * 1000 + amountInWithFee);\n    }\n\n    function _getAmountOut(\n        MaiQuantity amountIn,\n        MaiQuantity reserveIn,\n        UsdcQuantity reserveOut\n    ) internal pure returns (UsdcQuantity) {\n        return UsdcQuantity.wrap(_getAmountOut(MaiQuantity.unwrap(amountIn), MaiQuantity.unwrap(reserveIn), UsdcQuantity.unwrap(reserveOut)));\n    }\n\n    function _getAmountOut(\n        UsdcQuantity amountIn,\n        UsdcQuantity reserveIn,\n        MaiQuantity reserveOut\n    ) internal pure returns (MaiQuantity amountOut) {\n        return MaiQuantity.wrap(_getAmountOut(UsdcQuantity.unwrap(amountIn), UsdcQuantity.unwrap(reserveIn), MaiQuantity.unwrap(reserveOut)));\n    }\n}\n"
    },
    "contracts/qidao/IFarm.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IFarm {\n    function add(\n        uint256 _allocPoint,\n        address _lpToken,\n        bool _withUpdate,\n        uint16 _depositFeeBP\n    ) external;\n\n    function deposit(uint256 _pid, uint256 _amount) external;\n\n    function deposited(uint256 _pid, address _user) external view returns (uint256);\n\n    function emergencyWithdraw(uint256 _pid) external;\n\n    function endBlock() external view returns (uint256);\n\n    function erc20() external view returns (address);\n\n    function feeAddress() external view returns (address);\n\n    function fund(uint256 _amount) external;\n\n    function massUpdatePools() external;\n\n    function owner() external view returns (address);\n\n    function paidOut() external view returns (uint256);\n\n    function pending(uint256 _pid, address _user) external view returns (uint256);\n\n    function poolInfo(uint256)\n        external\n        view\n        returns (\n            address lpToken,\n            uint256 allocPoint,\n            uint256 lastRewardBlock,\n            uint256 accERC20PerShare,\n            uint16 depositFeeBP\n        );\n\n    function poolLength() external view returns (uint256);\n\n    function renounceOwnership() external;\n\n    function rewardPerBlock() external view returns (uint256);\n\n    function set(\n        uint256 _pid,\n        uint256 _allocPoint,\n        bool _withUpdate\n    ) external;\n\n    function setFeeAddress(address _feeAddress) external;\n\n    function startBlock() external view returns (uint256);\n\n    function totalAllocPoint() external view returns (uint256);\n\n    function totalPending() external view returns (uint256);\n\n    function transferOwnership(address newOwner) external;\n\n    function updatePool(uint256 _pid) external;\n\n    function userInfo(uint256, address) external view returns (uint256 amount, uint256 rewardDebt);\n\n    function withdraw(uint256 _pid, uint256 _amount) external;\n}\n"
    },
    "contracts/uniswap/interfaces/IERC20Uniswap.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IERC20Uniswap {\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    function name() external view returns (string memory);\n\n    function symbol() external view returns (string memory);\n\n    function decimals() external view returns (uint8);\n\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address owner) external view returns (uint256);\n\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    function approve(address spender, uint256 value) external returns (bool);\n\n    function transfer(address to, uint256 value) external returns (bool);\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 value\n    ) external returns (bool);\n}\n"
    },
    "contracts/uniswap/interfaces/IUniswapV2Pair.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IUniswapV2Pair {\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    function NAME() external pure returns (string memory);\n\n    function SYMBOL() external pure returns (string memory);\n\n    function DECIMALS() external pure returns (uint8);\n\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address owner) external view returns (uint256);\n\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    function approve(address spender, uint256 value) external returns (bool);\n\n    function transfer(address to, uint256 value) external returns (bool);\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 value\n    ) external returns (bool);\n\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n    function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n    function nonces(address owner) external view returns (uint256);\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    event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n    event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);\n    event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to);\n    event Sync(uint112 reserve0, uint112 reserve1);\n\n    function MINIMUM_LIQUIDITY() external pure returns (uint256);\n\n    function factory() external view returns (address);\n\n    function token0() external view returns (address);\n\n    function token1() external view returns (address);\n\n    function getReserves()\n        external\n        view\n        returns (\n            uint112 reserve0,\n            uint112 reserve1,\n            uint32 blockTimestampLast\n        );\n\n    function price0CumulativeLast() external view returns (uint256);\n\n    function price1CumulativeLast() external view returns (uint256);\n\n    function kLast() external view returns (uint256);\n\n    function mint(address to) external returns (uint256 liquidity);\n\n    function burn(address to) external returns (uint256 amount0, uint256 amount1);\n\n    function swap(\n        uint256 amount0Out,\n        uint256 amount1Out,\n        address to,\n        bytes calldata data\n    ) external;\n\n    function skim(address to) external;\n\n    function sync() external;\n\n    function initialize(address, address) external;\n}\n"
    },
    "contracts/uniswap/interfaces/IUniswapV2Router02.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IUniswapV2Router01.sol\";\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n    function removeLiquidityETHSupportingFeeOnTransferTokens(\n        address token,\n        uint256 liquidity,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline\n    ) external returns (uint256 amountETH);\n\n    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n        address token,\n        uint256 liquidity,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline,\n        bool approveMax,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external returns (uint256 amountETH);\n\n    function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external;\n\n    function swapExactETHForTokensSupportingFeeOnTransferTokens(\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external payable;\n\n    function swapExactTokensForETHSupportingFeeOnTransferTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external;\n}\n"
    },
    "contracts/PeronioSupport.sol": {
      "content": "pragma solidity ^0.8.17;\n\n// SPDX-License-Identifier: MIT\n\nimport \"./IPeronioSupport.sol\";\n\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n// --- Implementation-side user defined value types -----------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n\ntype UniSwapKQuantity is uint256;\ntype UniSwapRootKQuantity is uint256;\ntype UsdcSqQuantity is uint256;\ntype RatioWith4Decimals is uint256;\n\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n// --- Standard Numeric Types ---------------------------------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n//\n// Standard Numeric Types (SNTs) can be operated with in the same manner as \"normal\" numeric types can.\n// This means that SNTs can:\n//   - be added together,\n//   - be subtracted from each other,\n//   - be multiplied by a scalar value (only uint256 in this implementation) - both on the left and on the right,\n//   - the minimum be calculated among them,\n//   - the maximum be calculated among them,\n//   - the \"==\", \"!=\", \"<=\", \"<\", \">\", and \">=\" relations established between them, and\n// The mulDiv() interactions will be taken care of later.\n//\n\n// --- UniSwap K ----------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(UniSwapKQuantity.unwrap(left) + UniSwapKQuantity.unwrap(right));\n}\n\nfunction sub(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(UniSwapKQuantity.unwrap(left) - UniSwapKQuantity.unwrap(right));\n}\n\nfunction mul(UniSwapKQuantity val, uint256 x) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(UniSwapKQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, UniSwapKQuantity val) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(x * UniSwapKQuantity.unwrap(val));\n}\n\nfunction min(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.min(UniSwapKQuantity.unwrap(left), UniSwapKQuantity.unwrap(right)));\n}\n\nfunction max(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.max(UniSwapKQuantity.unwrap(left), UniSwapKQuantity.unwrap(right)));\n}\n\nfunction eq(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (bool) {\n    return UniSwapKQuantity.unwrap(left) == UniSwapKQuantity.unwrap(right);\n}\n\nfunction neq(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (bool) {\n    return UniSwapKQuantity.unwrap(left) != UniSwapKQuantity.unwrap(right);\n}\n\nfunction lt(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (bool) {\n    return UniSwapKQuantity.unwrap(left) < UniSwapKQuantity.unwrap(right);\n}\n\nfunction gt(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (bool) {\n    return UniSwapKQuantity.unwrap(left) > UniSwapKQuantity.unwrap(right);\n}\n\nfunction lte(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (bool) {\n    return UniSwapKQuantity.unwrap(left) <= UniSwapKQuantity.unwrap(right);\n}\n\nfunction gte(UniSwapKQuantity left, UniSwapKQuantity right) pure returns (bool) {\n    return UniSwapKQuantity.unwrap(left) >= UniSwapKQuantity.unwrap(right);\n}\n\n// --- UniSwap rootK ------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(UniSwapRootKQuantity.unwrap(left) + UniSwapRootKQuantity.unwrap(right));\n}\n\nfunction sub(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(UniSwapRootKQuantity.unwrap(left) - UniSwapRootKQuantity.unwrap(right));\n}\n\nfunction mul(UniSwapRootKQuantity val, uint256 x) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(UniSwapRootKQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, UniSwapRootKQuantity val) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(x * UniSwapRootKQuantity.unwrap(val));\n}\n\nfunction min(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.min(UniSwapRootKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right)));\n}\n\nfunction max(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.max(UniSwapRootKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right)));\n}\n\nfunction eq(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (bool) {\n    return UniSwapRootKQuantity.unwrap(left) == UniSwapRootKQuantity.unwrap(right);\n}\n\nfunction neq(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (bool) {\n    return UniSwapRootKQuantity.unwrap(left) != UniSwapRootKQuantity.unwrap(right);\n}\n\nfunction lt(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (bool) {\n    return UniSwapRootKQuantity.unwrap(left) < UniSwapRootKQuantity.unwrap(right);\n}\n\nfunction gt(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (bool) {\n    return UniSwapRootKQuantity.unwrap(left) > UniSwapRootKQuantity.unwrap(right);\n}\n\nfunction lte(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (bool) {\n    return UniSwapRootKQuantity.unwrap(left) <= UniSwapRootKQuantity.unwrap(right);\n}\n\nfunction gte(UniSwapRootKQuantity left, UniSwapRootKQuantity right) pure returns (bool) {\n    return UniSwapRootKQuantity.unwrap(left) >= UniSwapRootKQuantity.unwrap(right);\n}\n\n// --- USDC-squared -------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(UsdcSqQuantity.unwrap(left) + UsdcSqQuantity.unwrap(right));\n}\n\nfunction sub(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(UsdcSqQuantity.unwrap(left) - UsdcSqQuantity.unwrap(right));\n}\n\nfunction mul(UsdcSqQuantity val, uint256 x) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(UsdcSqQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, UsdcSqQuantity val) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(x * UsdcSqQuantity.unwrap(val));\n}\n\nfunction min(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.min(UsdcSqQuantity.unwrap(left), UsdcSqQuantity.unwrap(right)));\n}\n\nfunction max(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.max(UsdcSqQuantity.unwrap(left), UsdcSqQuantity.unwrap(right)));\n}\n\nfunction eq(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (bool) {\n    return UsdcSqQuantity.unwrap(left) == UsdcSqQuantity.unwrap(right);\n}\n\nfunction neq(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (bool) {\n    return UsdcSqQuantity.unwrap(left) != UsdcSqQuantity.unwrap(right);\n}\n\nfunction lt(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (bool) {\n    return UsdcSqQuantity.unwrap(left) < UsdcSqQuantity.unwrap(right);\n}\n\nfunction gt(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (bool) {\n    return UsdcSqQuantity.unwrap(left) > UsdcSqQuantity.unwrap(right);\n}\n\nfunction lte(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (bool) {\n    return UsdcSqQuantity.unwrap(left) <= UsdcSqQuantity.unwrap(right);\n}\n\nfunction gte(UsdcSqQuantity left, UsdcSqQuantity right) pure returns (bool) {\n    return UsdcSqQuantity.unwrap(left) >= UsdcSqQuantity.unwrap(right);\n}\n\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n// --- USDC-squared quantities --------------------------------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nfunction sqrt(UsdcSqQuantity x) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.sqrt(UsdcSqQuantity.unwrap(x)));\n}\n\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n// --- UniSwap K-values ---------------------------------------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nfunction mul(UsdcQuantity left, MaiQuantity right) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(UsdcQuantity.unwrap(left) * MaiQuantity.unwrap(right));\n}\n\nfunction sqrt(UniSwapKQuantity x) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.sqrt(UniSwapKQuantity.unwrap(x)));\n}\n\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n// --- Ratio conversion ---------------------------------------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nfunction ratio4to6(RatioWith4Decimals x) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(RatioWith4Decimals.unwrap(x) * 10**2);\n}\n\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n// --- MulDiv Interactions ------------------------------------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nfunction mulDiv(\n    LpQuantity left,\n    RatioWith4Decimals right,\n    LpQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(LpQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UniSwapKQuantity right,\n    LpQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UniSwapRootKQuantity right,\n    LpQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UsdcSqQuantity right,\n    LpQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    RatioWith4Decimals right,\n    MaiQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(MaiQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UniSwapKQuantity right,\n    MaiQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UniSwapRootKQuantity right,\n    MaiQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcQuantity right,\n    UniSwapKQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(MaiQuantity.unwrap(left), UsdcQuantity.unwrap(right), UniSwapKQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcQuantity right,\n    uint256 div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcSqQuantity right,\n    MaiQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcSqQuantity right,\n    UniSwapKQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcSqQuantity right,\n    UsdcQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    RatioWith4Decimals right,\n    PePerUsdcQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UniSwapKQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UniSwapRootKQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcSqQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    RatioWith4Decimals right,\n    PeQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(PeQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UniSwapKQuantity right,\n    PeQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UniSwapRootKQuantity right,\n    PeQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UsdcSqQuantity right,\n    PeQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    RatioWith4Decimals right,\n    QiQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(QiQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UniSwapKQuantity right,\n    QiQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UniSwapRootKQuantity right,\n    QiQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UsdcSqQuantity right,\n    QiQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    LpQuantity right,\n    RatioWith4Decimals div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), LpQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    MaiQuantity right,\n    RatioWith4Decimals div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), MaiQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    PePerUsdcQuantity right,\n    RatioWith4Decimals div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), PePerUsdcQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    PeQuantity right,\n    RatioWith4Decimals div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), PeQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    QiQuantity right,\n    RatioWith4Decimals div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), QiQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    RatioWith6Decimals right,\n    RatioWith4Decimals div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UniSwapKQuantity right,\n    RatioWith4Decimals div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UniSwapKQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UniSwapRootKQuantity right,\n    RatioWith4Decimals div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UniSwapRootKQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UsdcPerPeQuantity right,\n    RatioWith4Decimals div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UsdcPerPeQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UsdcQuantity right,\n    RatioWith4Decimals div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UsdcQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UsdcSqQuantity right,\n    RatioWith4Decimals div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UsdcSqQuantity.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    uint256 right,\n    RatioWith4Decimals div\n) pure returns (uint256) {\n    return Math.mulDiv(RatioWith4Decimals.unwrap(left), right, RatioWith4Decimals.unwrap(div));\n}\n\nfunction mulDiv(\n    RatioWith4Decimals left,\n    uint256 right,\n    uint256 div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith4Decimals.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    RatioWith4Decimals right,\n    RatioWith6Decimals div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UniSwapKQuantity right,\n    RatioWith6Decimals div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UniSwapKQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UniSwapRootKQuantity right,\n    RatioWith6Decimals div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UniSwapRootKQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UsdcSqQuantity right,\n    RatioWith6Decimals div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UsdcSqQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    LpQuantity right,\n    UniSwapKQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), LpQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    MaiQuantity right,\n    UniSwapKQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), MaiQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    PePerUsdcQuantity right,\n    UniSwapKQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    PeQuantity right,\n    UniSwapKQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), PeQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    QiQuantity right,\n    UniSwapKQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), QiQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    RatioWith4Decimals right,\n    UniSwapKQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    RatioWith6Decimals right,\n    UniSwapKQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapKQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UsdcPerPeQuantity right,\n    UniSwapKQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UsdcQuantity right,\n    MaiQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UsdcQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UsdcQuantity right,\n    UniSwapKQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UsdcQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UsdcQuantity right,\n    UsdcSqQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UsdcSqQuantity right,\n    UniSwapKQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    uint256 right,\n    MaiQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), right, MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    uint256 right,\n    UniSwapKQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(UniSwapKQuantity.unwrap(left), right, UniSwapKQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    uint256 right,\n    UniSwapRootKQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), right, UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    uint256 right,\n    UsdcQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), right, UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapKQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapKQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    LpQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), LpQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    MaiQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), MaiQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    PePerUsdcQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    PeQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), PeQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    QiQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), QiQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    RatioWith4Decimals right,\n    UniSwapRootKQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    RatioWith6Decimals right,\n    UniSwapRootKQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UniSwapKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UniSwapRootKQuantity right,\n    MaiQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapKQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UniSwapRootKQuantity right,\n    UsdcQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UniSwapRootKQuantity right,\n    uint256 div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UsdcPerPeQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UsdcQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UsdcQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UsdcSqQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    uint256 right,\n    UniSwapRootKQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(UniSwapRootKQuantity.unwrap(left), right, UniSwapRootKQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    UniSwapRootKQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UniSwapRootKQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    RatioWith4Decimals right,\n    UsdcPerPeQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UniSwapKQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UniSwapRootKQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UsdcSqQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    MaiQuantity right,\n    UniSwapKQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(UsdcQuantity.unwrap(left), MaiQuantity.unwrap(right), UniSwapKQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    MaiQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), MaiQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    MaiQuantity right,\n    uint256 div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), MaiQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    RatioWith4Decimals right,\n    UsdcQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UniSwapKQuantity right,\n    MaiQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UniSwapKQuantity right,\n    UsdcQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UniSwapKQuantity right,\n    UsdcSqQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UniSwapRootKQuantity right,\n    UsdcQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UsdcQuantity right,\n    UsdcSqQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(UsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcSqQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UsdcQuantity right,\n    uint256 div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UsdcSqQuantity right,\n    UsdcQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    LpQuantity right,\n    UsdcSqQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), LpQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    MaiQuantity right,\n    UniSwapKQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), MaiQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    MaiQuantity right,\n    UsdcQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), MaiQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    MaiQuantity right,\n    UsdcSqQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), MaiQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    PePerUsdcQuantity right,\n    UsdcSqQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    PeQuantity right,\n    UsdcSqQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), PeQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    QiQuantity right,\n    UsdcSqQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), QiQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    RatioWith4Decimals right,\n    UsdcSqQuantity div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), RatioWith4Decimals.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    RatioWith6Decimals right,\n    UsdcSqQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UniSwapKQuantity right,\n    UsdcSqQuantity div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UniSwapKQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UniSwapRootKQuantity right,\n    UsdcSqQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UniSwapRootKQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcSqQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UsdcQuantity right,\n    UsdcSqQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    uint256 right,\n    UsdcQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), right, UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    uint256 right,\n    UsdcSqQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(UsdcSqQuantity.unwrap(left), right, UsdcSqQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    UsdcSqQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(UsdcSqQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    RatioWith4Decimals right,\n    RatioWith4Decimals div\n) pure returns (uint256) {\n    return Math.mulDiv(left, RatioWith4Decimals.unwrap(right), RatioWith4Decimals.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    RatioWith4Decimals right,\n    uint256 div\n) pure returns (RatioWith4Decimals) {\n    return RatioWith4Decimals.wrap(Math.mulDiv(left, RatioWith4Decimals.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UniSwapKQuantity right,\n    MaiQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(left, UniSwapKQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UniSwapKQuantity right,\n    UniSwapKQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, UniSwapKQuantity.unwrap(right), UniSwapKQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UniSwapKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(left, UniSwapKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UniSwapKQuantity right,\n    UsdcQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(left, UniSwapKQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UniSwapKQuantity right,\n    uint256 div\n) pure returns (UniSwapKQuantity) {\n    return UniSwapKQuantity.wrap(Math.mulDiv(left, UniSwapKQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UniSwapRootKQuantity right,\n    UniSwapRootKQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, UniSwapRootKQuantity.unwrap(right), UniSwapRootKQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UniSwapRootKQuantity right,\n    uint256 div\n) pure returns (UniSwapRootKQuantity) {\n    return UniSwapRootKQuantity.wrap(Math.mulDiv(left, UniSwapRootKQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UsdcSqQuantity right,\n    UsdcQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(left, UsdcSqQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UsdcSqQuantity right,\n    UsdcSqQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, UsdcSqQuantity.unwrap(right), UsdcSqQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UsdcSqQuantity right,\n    uint256 div\n) pure returns (UsdcSqQuantity) {\n    return UsdcSqQuantity.wrap(Math.mulDiv(left, UsdcSqQuantity.unwrap(right), div));\n}\n"
    },
    "@openzeppelin/contracts_latest/security/ReentrancyGuard.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        // On the first call to nonReentrant, _notEntered will be true\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n\n        _;\n\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"
    },
    "@openzeppelin/contracts/utils/introspection/ERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
    },
    "contracts/uniswap/interfaces/IUniswapV2Router01.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IUniswapV2Router01 {\n    function factory() external view returns (address);\n\n    function WETH() external view returns (address);\n\n    function addLiquidity(\n        address tokenA,\n        address tokenB,\n        uint256 amountADesired,\n        uint256 amountBDesired,\n        uint256 amountAMin,\n        uint256 amountBMin,\n        address to,\n        uint256 deadline\n    )\n        external\n        returns (\n            uint256 amountA,\n            uint256 amountB,\n            uint256 liquidity\n        );\n\n    function addLiquidityETH(\n        address token,\n        uint256 amountTokenDesired,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline\n    )\n        external\n        payable\n        returns (\n            uint256 amountToken,\n            uint256 amountETH,\n            uint256 liquidity\n        );\n\n    function removeLiquidity(\n        address tokenA,\n        address tokenB,\n        uint256 liquidity,\n        uint256 amountAMin,\n        uint256 amountBMin,\n        address to,\n        uint256 deadline\n    ) external returns (uint256 amountA, uint256 amountB);\n\n    function removeLiquidityETH(\n        address token,\n        uint256 liquidity,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline\n    ) external returns (uint256 amountToken, uint256 amountETH);\n\n    function removeLiquidityWithPermit(\n        address tokenA,\n        address tokenB,\n        uint256 liquidity,\n        uint256 amountAMin,\n        uint256 amountBMin,\n        address to,\n        uint256 deadline,\n        bool approveMax,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external returns (uint256 amountA, uint256 amountB);\n\n    function removeLiquidityETHWithPermit(\n        address token,\n        uint256 liquidity,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline,\n        bool approveMax,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external returns (uint256 amountToken, uint256 amountETH);\n\n    function swapExactTokensForTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external returns (uint256[] memory amounts);\n\n    function swapTokensForExactTokens(\n        uint256 amountOut,\n        uint256 amountInMax,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external returns (uint256[] memory amounts);\n\n    function swapExactETHForTokens(\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external payable returns (uint256[] memory amounts);\n\n    function swapTokensForExactETH(\n        uint256 amountOut,\n        uint256 amountInMax,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external returns (uint256[] memory amounts);\n\n    function swapExactTokensForETH(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external returns (uint256[] memory amounts);\n\n    function swapETHForExactTokens(\n        uint256 amountOut,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external payable returns (uint256[] memory amounts);\n\n    function quote(\n        uint256 amountA,\n        uint256 reserveA,\n        uint256 reserveB\n    ) external pure returns (uint256 amountB);\n\n    function getAmountOut(\n        uint256 amountIn,\n        uint256 reserveIn,\n        uint256 reserveOut\n    ) external pure returns (uint256 amountOut);\n\n    function getAmountIn(\n        uint256 amountOut,\n        uint256 reserveIn,\n        uint256 reserveOut\n    ) external pure returns (uint256 amountIn);\n\n    function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n    function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);\n}\n"
    },
    "contracts/IPeronioSupport.sol": {
      "content": "pragma solidity ^0.8.17;\n\n// SPDX-License-Identifier: MIT\n\nimport \"./IPeronio.sol\";\n\nimport {Math} from \"@openzeppelin/contracts_latest/utils/math/Math.sol\";\n\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n// --- Standard Numeric Types ---------------------------------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n//\n// Standard Numeric Types (SNTs) can be operated with in the same manner as \"normal\" numeric types can.\n// This means that SNTs can:\n//   - be added together,\n//   - be subtracted from each other,\n//   - be multiplied by a scalar value (only uint256 in this implementation) - both on the left and on the right,\n//   - the minimum be calculated among them,\n//   - the maximum be calculated among them,\n//   - the \"==\", \"!=\", \"<=\", \"<\", \">\", and \">=\" relations established between them, and\n// The mulDiv() interactions will be taken care of later.\n//\n\n// --- USDC ---------------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(UsdcQuantity left, UsdcQuantity right) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(UsdcQuantity.unwrap(left) + UsdcQuantity.unwrap(right));\n}\n\nfunction sub(UsdcQuantity left, UsdcQuantity right) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(UsdcQuantity.unwrap(left) - UsdcQuantity.unwrap(right));\n}\n\nfunction mul(UsdcQuantity val, uint256 x) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(UsdcQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, UsdcQuantity val) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(x * UsdcQuantity.unwrap(val));\n}\n\nfunction min(UsdcQuantity left, UsdcQuantity right) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.min(UsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right)));\n}\n\nfunction max(UsdcQuantity left, UsdcQuantity right) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.max(UsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right)));\n}\n\nfunction eq(UsdcQuantity left, UsdcQuantity right) pure returns (bool) {\n    return UsdcQuantity.unwrap(left) == UsdcQuantity.unwrap(right);\n}\n\nfunction neq(UsdcQuantity left, UsdcQuantity right) pure returns (bool) {\n    return UsdcQuantity.unwrap(left) != UsdcQuantity.unwrap(right);\n}\n\nfunction lt(UsdcQuantity left, UsdcQuantity right) pure returns (bool) {\n    return UsdcQuantity.unwrap(left) < UsdcQuantity.unwrap(right);\n}\n\nfunction gt(UsdcQuantity left, UsdcQuantity right) pure returns (bool) {\n    return UsdcQuantity.unwrap(left) > UsdcQuantity.unwrap(right);\n}\n\nfunction lte(UsdcQuantity left, UsdcQuantity right) pure returns (bool) {\n    return UsdcQuantity.unwrap(left) <= UsdcQuantity.unwrap(right);\n}\n\nfunction gte(UsdcQuantity left, UsdcQuantity right) pure returns (bool) {\n    return UsdcQuantity.unwrap(left) >= UsdcQuantity.unwrap(right);\n}\n\n// --- MAI ----------------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(MaiQuantity left, MaiQuantity right) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(MaiQuantity.unwrap(left) + MaiQuantity.unwrap(right));\n}\n\nfunction sub(MaiQuantity left, MaiQuantity right) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(MaiQuantity.unwrap(left) - MaiQuantity.unwrap(right));\n}\n\nfunction mul(MaiQuantity val, uint256 x) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(MaiQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, MaiQuantity val) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(x * MaiQuantity.unwrap(val));\n}\n\nfunction min(MaiQuantity left, MaiQuantity right) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.min(MaiQuantity.unwrap(left), MaiQuantity.unwrap(right)));\n}\n\nfunction max(MaiQuantity left, MaiQuantity right) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.max(MaiQuantity.unwrap(left), MaiQuantity.unwrap(right)));\n}\n\nfunction eq(MaiQuantity left, MaiQuantity right) pure returns (bool) {\n    return MaiQuantity.unwrap(left) == MaiQuantity.unwrap(right);\n}\n\nfunction neq(MaiQuantity left, MaiQuantity right) pure returns (bool) {\n    return MaiQuantity.unwrap(left) != MaiQuantity.unwrap(right);\n}\n\nfunction lt(MaiQuantity left, MaiQuantity right) pure returns (bool) {\n    return MaiQuantity.unwrap(left) < MaiQuantity.unwrap(right);\n}\n\nfunction gt(MaiQuantity left, MaiQuantity right) pure returns (bool) {\n    return MaiQuantity.unwrap(left) > MaiQuantity.unwrap(right);\n}\n\nfunction lte(MaiQuantity left, MaiQuantity right) pure returns (bool) {\n    return MaiQuantity.unwrap(left) <= MaiQuantity.unwrap(right);\n}\n\nfunction gte(MaiQuantity left, MaiQuantity right) pure returns (bool) {\n    return MaiQuantity.unwrap(left) >= MaiQuantity.unwrap(right);\n}\n\n// --- LP USDC/MAI --------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(LpQuantity left, LpQuantity right) pure returns (LpQuantity) {\n    return LpQuantity.wrap(LpQuantity.unwrap(left) + LpQuantity.unwrap(right));\n}\n\nfunction sub(LpQuantity left, LpQuantity right) pure returns (LpQuantity) {\n    return LpQuantity.wrap(LpQuantity.unwrap(left) - LpQuantity.unwrap(right));\n}\n\nfunction mul(LpQuantity val, uint256 x) pure returns (LpQuantity) {\n    return LpQuantity.wrap(LpQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, LpQuantity val) pure returns (LpQuantity) {\n    return LpQuantity.wrap(x * LpQuantity.unwrap(val));\n}\n\nfunction min(LpQuantity left, LpQuantity right) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.min(LpQuantity.unwrap(left), LpQuantity.unwrap(right)));\n}\n\nfunction max(LpQuantity left, LpQuantity right) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.max(LpQuantity.unwrap(left), LpQuantity.unwrap(right)));\n}\n\nfunction eq(LpQuantity left, LpQuantity right) pure returns (bool) {\n    return LpQuantity.unwrap(left) == LpQuantity.unwrap(right);\n}\n\nfunction neq(LpQuantity left, LpQuantity right) pure returns (bool) {\n    return LpQuantity.unwrap(left) != LpQuantity.unwrap(right);\n}\n\nfunction lt(LpQuantity left, LpQuantity right) pure returns (bool) {\n    return LpQuantity.unwrap(left) < LpQuantity.unwrap(right);\n}\n\nfunction gt(LpQuantity left, LpQuantity right) pure returns (bool) {\n    return LpQuantity.unwrap(left) > LpQuantity.unwrap(right);\n}\n\nfunction lte(LpQuantity left, LpQuantity right) pure returns (bool) {\n    return LpQuantity.unwrap(left) <= LpQuantity.unwrap(right);\n}\n\nfunction gte(LpQuantity left, LpQuantity right) pure returns (bool) {\n    return LpQuantity.unwrap(left) >= LpQuantity.unwrap(right);\n}\n\n// --- PE -----------------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(PeQuantity left, PeQuantity right) pure returns (PeQuantity) {\n    return PeQuantity.wrap(PeQuantity.unwrap(left) + PeQuantity.unwrap(right));\n}\n\nfunction sub(PeQuantity left, PeQuantity right) pure returns (PeQuantity) {\n    return PeQuantity.wrap(PeQuantity.unwrap(left) - PeQuantity.unwrap(right));\n}\n\nfunction mul(PeQuantity val, uint256 x) pure returns (PeQuantity) {\n    return PeQuantity.wrap(PeQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, PeQuantity val) pure returns (PeQuantity) {\n    return PeQuantity.wrap(x * PeQuantity.unwrap(val));\n}\n\nfunction min(PeQuantity left, PeQuantity right) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.min(PeQuantity.unwrap(left), PeQuantity.unwrap(right)));\n}\n\nfunction max(PeQuantity left, PeQuantity right) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.max(PeQuantity.unwrap(left), PeQuantity.unwrap(right)));\n}\n\nfunction eq(PeQuantity left, PeQuantity right) pure returns (bool) {\n    return PeQuantity.unwrap(left) == PeQuantity.unwrap(right);\n}\n\nfunction neq(PeQuantity left, PeQuantity right) pure returns (bool) {\n    return PeQuantity.unwrap(left) != PeQuantity.unwrap(right);\n}\n\nfunction lt(PeQuantity left, PeQuantity right) pure returns (bool) {\n    return PeQuantity.unwrap(left) < PeQuantity.unwrap(right);\n}\n\nfunction gt(PeQuantity left, PeQuantity right) pure returns (bool) {\n    return PeQuantity.unwrap(left) > PeQuantity.unwrap(right);\n}\n\nfunction lte(PeQuantity left, PeQuantity right) pure returns (bool) {\n    return PeQuantity.unwrap(left) <= PeQuantity.unwrap(right);\n}\n\nfunction gte(PeQuantity left, PeQuantity right) pure returns (bool) {\n    return PeQuantity.unwrap(left) >= PeQuantity.unwrap(right);\n}\n\n// --- QI -----------------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(QiQuantity left, QiQuantity right) pure returns (QiQuantity) {\n    return QiQuantity.wrap(QiQuantity.unwrap(left) + QiQuantity.unwrap(right));\n}\n\nfunction sub(QiQuantity left, QiQuantity right) pure returns (QiQuantity) {\n    return QiQuantity.wrap(QiQuantity.unwrap(left) - QiQuantity.unwrap(right));\n}\n\nfunction mul(QiQuantity val, uint256 x) pure returns (QiQuantity) {\n    return QiQuantity.wrap(QiQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, QiQuantity val) pure returns (QiQuantity) {\n    return QiQuantity.wrap(x * QiQuantity.unwrap(val));\n}\n\nfunction min(QiQuantity left, QiQuantity right) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.min(QiQuantity.unwrap(left), QiQuantity.unwrap(right)));\n}\n\nfunction max(QiQuantity left, QiQuantity right) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.max(QiQuantity.unwrap(left), QiQuantity.unwrap(right)));\n}\n\nfunction eq(QiQuantity left, QiQuantity right) pure returns (bool) {\n    return QiQuantity.unwrap(left) == QiQuantity.unwrap(right);\n}\n\nfunction neq(QiQuantity left, QiQuantity right) pure returns (bool) {\n    return QiQuantity.unwrap(left) != QiQuantity.unwrap(right);\n}\n\nfunction lt(QiQuantity left, QiQuantity right) pure returns (bool) {\n    return QiQuantity.unwrap(left) < QiQuantity.unwrap(right);\n}\n\nfunction gt(QiQuantity left, QiQuantity right) pure returns (bool) {\n    return QiQuantity.unwrap(left) > QiQuantity.unwrap(right);\n}\n\nfunction lte(QiQuantity left, QiQuantity right) pure returns (bool) {\n    return QiQuantity.unwrap(left) <= QiQuantity.unwrap(right);\n}\n\nfunction gte(QiQuantity left, QiQuantity right) pure returns (bool) {\n    return QiQuantity.unwrap(left) >= QiQuantity.unwrap(right);\n}\n\n// --- PE/USDC ------------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(PePerUsdcQuantity.unwrap(left) + PePerUsdcQuantity.unwrap(right));\n}\n\nfunction sub(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(PePerUsdcQuantity.unwrap(left) - PePerUsdcQuantity.unwrap(right));\n}\n\nfunction mul(PePerUsdcQuantity val, uint256 x) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(PePerUsdcQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, PePerUsdcQuantity val) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(x * PePerUsdcQuantity.unwrap(val));\n}\n\nfunction min(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.min(PePerUsdcQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right)));\n}\n\nfunction max(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.max(PePerUsdcQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right)));\n}\n\nfunction eq(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (bool) {\n    return PePerUsdcQuantity.unwrap(left) == PePerUsdcQuantity.unwrap(right);\n}\n\nfunction neq(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (bool) {\n    return PePerUsdcQuantity.unwrap(left) != PePerUsdcQuantity.unwrap(right);\n}\n\nfunction lt(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (bool) {\n    return PePerUsdcQuantity.unwrap(left) < PePerUsdcQuantity.unwrap(right);\n}\n\nfunction gt(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (bool) {\n    return PePerUsdcQuantity.unwrap(left) > PePerUsdcQuantity.unwrap(right);\n}\n\nfunction lte(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (bool) {\n    return PePerUsdcQuantity.unwrap(left) <= PePerUsdcQuantity.unwrap(right);\n}\n\nfunction gte(PePerUsdcQuantity left, PePerUsdcQuantity right) pure returns (bool) {\n    return PePerUsdcQuantity.unwrap(left) >= PePerUsdcQuantity.unwrap(right);\n}\n\n// --- USDC/PE ------------------------------------------------------------------------------------------------------------------------------------------------\nfunction add(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(UsdcPerPeQuantity.unwrap(left) + UsdcPerPeQuantity.unwrap(right));\n}\n\nfunction sub(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(UsdcPerPeQuantity.unwrap(left) - UsdcPerPeQuantity.unwrap(right));\n}\n\nfunction mul(UsdcPerPeQuantity val, uint256 x) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(UsdcPerPeQuantity.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, UsdcPerPeQuantity val) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(x * UsdcPerPeQuantity.unwrap(val));\n}\n\nfunction min(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.min(UsdcPerPeQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right)));\n}\n\nfunction max(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.max(UsdcPerPeQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right)));\n}\n\nfunction eq(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (bool) {\n    return UsdcPerPeQuantity.unwrap(left) == UsdcPerPeQuantity.unwrap(right);\n}\n\nfunction neq(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (bool) {\n    return UsdcPerPeQuantity.unwrap(left) != UsdcPerPeQuantity.unwrap(right);\n}\n\nfunction lt(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (bool) {\n    return UsdcPerPeQuantity.unwrap(left) < UsdcPerPeQuantity.unwrap(right);\n}\n\nfunction gt(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (bool) {\n    return UsdcPerPeQuantity.unwrap(left) > UsdcPerPeQuantity.unwrap(right);\n}\n\nfunction lte(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (bool) {\n    return UsdcPerPeQuantity.unwrap(left) <= UsdcPerPeQuantity.unwrap(right);\n}\n\nfunction gte(UsdcPerPeQuantity left, UsdcPerPeQuantity right) pure returns (bool) {\n    return UsdcPerPeQuantity.unwrap(left) >= UsdcPerPeQuantity.unwrap(right);\n}\n\n// --- 6-decimals ratio ---------------------------------------------------------------------------------------------------------------------------------------\nfunction add(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(RatioWith6Decimals.unwrap(left) + RatioWith6Decimals.unwrap(right));\n}\n\nfunction sub(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(RatioWith6Decimals.unwrap(left) - RatioWith6Decimals.unwrap(right));\n}\n\nfunction mul(RatioWith6Decimals val, uint256 x) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(RatioWith6Decimals.unwrap(val) * x);\n}\n\nfunction mul(uint256 x, RatioWith6Decimals val) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(x * RatioWith6Decimals.unwrap(val));\n}\n\nfunction min(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.min(RatioWith6Decimals.unwrap(left), RatioWith6Decimals.unwrap(right)));\n}\n\nfunction max(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.max(RatioWith6Decimals.unwrap(left), RatioWith6Decimals.unwrap(right)));\n}\n\nfunction eq(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (bool) {\n    return RatioWith6Decimals.unwrap(left) == RatioWith6Decimals.unwrap(right);\n}\n\nfunction neq(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (bool) {\n    return RatioWith6Decimals.unwrap(left) != RatioWith6Decimals.unwrap(right);\n}\n\nfunction lt(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (bool) {\n    return RatioWith6Decimals.unwrap(left) < RatioWith6Decimals.unwrap(right);\n}\n\nfunction gt(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (bool) {\n    return RatioWith6Decimals.unwrap(left) > RatioWith6Decimals.unwrap(right);\n}\n\nfunction lte(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (bool) {\n    return RatioWith6Decimals.unwrap(left) <= RatioWith6Decimals.unwrap(right);\n}\n\nfunction gte(RatioWith6Decimals left, RatioWith6Decimals right) pure returns (bool) {\n    return RatioWith6Decimals.unwrap(left) >= RatioWith6Decimals.unwrap(right);\n}\n\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n// --- MulDiv Interactions ------------------------------------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nfunction mulDiv(\n    LpQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    MaiQuantity right,\n    LpQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), MaiQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    PePerUsdcQuantity right,\n    LpQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    PeQuantity right,\n    LpQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), PeQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    QiQuantity right,\n    LpQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), QiQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    RatioWith6Decimals right,\n    LpQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(LpQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UsdcPerPeQuantity right,\n    LpQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UsdcQuantity right,\n    LpQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UsdcQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    uint256 right,\n    LpQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(LpQuantity.unwrap(left), right, LpQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    LpQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(LpQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    LpQuantity right,\n    MaiQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), LpQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    PePerUsdcQuantity right,\n    MaiQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    PeQuantity right,\n    MaiQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), PeQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    QiQuantity right,\n    MaiQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), QiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    RatioWith6Decimals right,\n    MaiQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(MaiQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcPerPeQuantity right,\n    MaiQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcQuantity right,\n    MaiQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    uint256 right,\n    MaiQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(MaiQuantity.unwrap(left), right, MaiQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    MaiQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(MaiQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    LpQuantity right,\n    PePerUsdcQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), LpQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    MaiQuantity right,\n    PePerUsdcQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), MaiQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    PeQuantity right,\n    PePerUsdcQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), PeQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    QiQuantity right,\n    PePerUsdcQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), QiQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    RatioWith6Decimals right,\n    PePerUsdcQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcPerPeQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcPerPeQuantity right,\n    RatioWith6Decimals div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcQuantity right,\n    PeQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcQuantity right,\n    RatioWith6Decimals div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    uint256 right,\n    PePerUsdcQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(PePerUsdcQuantity.unwrap(left), right, PePerUsdcQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    PePerUsdcQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PePerUsdcQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    LpQuantity right,\n    PeQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), LpQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    MaiQuantity right,\n    PeQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), MaiQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    PePerUsdcQuantity right,\n    PeQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    QiQuantity right,\n    PeQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), QiQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    RatioWith6Decimals right,\n    PePerUsdcQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    RatioWith6Decimals right,\n    PeQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(PeQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    RatioWith6Decimals right,\n    UsdcQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UsdcPerPeQuantity right,\n    PeQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UsdcPerPeQuantity right,\n    RatioWith6Decimals div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(PeQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UsdcQuantity right,\n    PeQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UsdcQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    uint256 right,\n    PeQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(PeQuantity.unwrap(left), right, PeQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    PeQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(PeQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    LpQuantity right,\n    QiQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), LpQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    MaiQuantity right,\n    QiQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), MaiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    PePerUsdcQuantity right,\n    QiQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    PeQuantity right,\n    QiQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), PeQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    RatioWith6Decimals right,\n    QiQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(QiQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UsdcPerPeQuantity right,\n    QiQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UsdcQuantity right,\n    QiQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UsdcQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    uint256 right,\n    QiQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(QiQuantity.unwrap(left), right, QiQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    QiQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(QiQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    LpQuantity right,\n    RatioWith6Decimals div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), LpQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    MaiQuantity right,\n    RatioWith6Decimals div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), MaiQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    PePerUsdcQuantity right,\n    RatioWith6Decimals div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), PePerUsdcQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    PeQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), PeQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    PeQuantity right,\n    RatioWith6Decimals div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), PeQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    PeQuantity right,\n    UsdcQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), PeQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    QiQuantity right,\n    RatioWith6Decimals div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), QiQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    RatioWith6Decimals right,\n    PePerUsdcQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), RatioWith6Decimals.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    RatioWith6Decimals right,\n    UsdcPerPeQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), RatioWith6Decimals.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UsdcPerPeQuantity right,\n    RatioWith6Decimals div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UsdcPerPeQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UsdcQuantity right,\n    PeQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UsdcQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UsdcQuantity right,\n    RatioWith6Decimals div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UsdcQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UsdcQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UsdcQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    uint256 right,\n    RatioWith6Decimals div\n) pure returns (uint256) {\n    return Math.mulDiv(RatioWith6Decimals.unwrap(left), right, RatioWith6Decimals.unwrap(div));\n}\n\nfunction mulDiv(\n    RatioWith6Decimals left,\n    uint256 right,\n    uint256 div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(RatioWith6Decimals.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    LpQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), LpQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    MaiQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), MaiQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    PePerUsdcQuantity right,\n    RatioWith6Decimals div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    PePerUsdcQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    PeQuantity right,\n    RatioWith6Decimals div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), PeQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    PeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), PeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    PeQuantity right,\n    UsdcQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), PeQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    QiQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), QiQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    RatioWith6Decimals right,\n    UsdcPerPeQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UsdcQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    uint256 right,\n    UsdcPerPeQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(UsdcPerPeQuantity.unwrap(left), right, UsdcPerPeQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    UsdcPerPeQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcPerPeQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), LpQuantity.unwrap(right), LpQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    LpQuantity right,\n    UsdcQuantity div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), LpQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), MaiQuantity.unwrap(right), MaiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    MaiQuantity right,\n    UsdcQuantity div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), MaiQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    PePerUsdcQuantity right,\n    PeQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    PePerUsdcQuantity right,\n    RatioWith6Decimals div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    PePerUsdcQuantity right,\n    UsdcQuantity div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), PePerUsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), PeQuantity.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    PeQuantity right,\n    UsdcQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), PeQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), QiQuantity.unwrap(right), QiQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    QiQuantity right,\n    UsdcQuantity div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), QiQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    RatioWith6Decimals right,\n    PeQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), PeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    RatioWith6Decimals right,\n    UsdcPerPeQuantity div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    RatioWith6Decimals right,\n    UsdcQuantity div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), RatioWith6Decimals.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UsdcPerPeQuantity right,\n    UsdcQuantity div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UsdcPerPeQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div)));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    uint256 right,\n    UsdcQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(UsdcQuantity.unwrap(left), right, UsdcQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    UsdcQuantity left,\n    uint256 right,\n    uint256 div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(UsdcQuantity.unwrap(left), right, div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    LpQuantity right,\n    LpQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, LpQuantity.unwrap(right), LpQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    LpQuantity right,\n    uint256 div\n) pure returns (LpQuantity) {\n    return LpQuantity.wrap(Math.mulDiv(left, LpQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    MaiQuantity right,\n    MaiQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, MaiQuantity.unwrap(right), MaiQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    MaiQuantity right,\n    uint256 div\n) pure returns (MaiQuantity) {\n    return MaiQuantity.wrap(Math.mulDiv(left, MaiQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    PePerUsdcQuantity right,\n    PePerUsdcQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, PePerUsdcQuantity.unwrap(right), PePerUsdcQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    PePerUsdcQuantity right,\n    uint256 div\n) pure returns (PePerUsdcQuantity) {\n    return PePerUsdcQuantity.wrap(Math.mulDiv(left, PePerUsdcQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    PeQuantity right,\n    PeQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, PeQuantity.unwrap(right), PeQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    PeQuantity right,\n    uint256 div\n) pure returns (PeQuantity) {\n    return PeQuantity.wrap(Math.mulDiv(left, PeQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    QiQuantity right,\n    QiQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, QiQuantity.unwrap(right), QiQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    QiQuantity right,\n    uint256 div\n) pure returns (QiQuantity) {\n    return QiQuantity.wrap(Math.mulDiv(left, QiQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    RatioWith6Decimals right,\n    RatioWith6Decimals div\n) pure returns (uint256) {\n    return Math.mulDiv(left, RatioWith6Decimals.unwrap(right), RatioWith6Decimals.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    RatioWith6Decimals right,\n    uint256 div\n) pure returns (RatioWith6Decimals) {\n    return RatioWith6Decimals.wrap(Math.mulDiv(left, RatioWith6Decimals.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UsdcPerPeQuantity right,\n    UsdcPerPeQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, UsdcPerPeQuantity.unwrap(right), UsdcPerPeQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UsdcPerPeQuantity right,\n    uint256 div\n) pure returns (UsdcPerPeQuantity) {\n    return UsdcPerPeQuantity.wrap(Math.mulDiv(left, UsdcPerPeQuantity.unwrap(right), div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UsdcQuantity right,\n    UsdcQuantity div\n) pure returns (uint256) {\n    return Math.mulDiv(left, UsdcQuantity.unwrap(right), UsdcQuantity.unwrap(div));\n}\n\nfunction mulDiv(\n    uint256 left,\n    UsdcQuantity right,\n    uint256 div\n) pure returns (UsdcQuantity) {\n    return UsdcQuantity.wrap(Math.mulDiv(left, UsdcQuantity.unwrap(right), div));\n}\n"
    },
    "@openzeppelin/contracts_latest/utils/math/Math.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a >= b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1);\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator,\n        Rounding rounding\n    ) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        // 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)`.\n        // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n        // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n        // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n        // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1;\n        uint256 x = a;\n        if (x >> 128 > 0) {\n            x >>= 128;\n            result <<= 64;\n        }\n        if (x >> 64 > 0) {\n            x >>= 64;\n            result <<= 32;\n        }\n        if (x >> 32 > 0) {\n            x >>= 32;\n            result <<= 16;\n        }\n        if (x >> 16 > 0) {\n            x >>= 16;\n            result <<= 8;\n        }\n        if (x >> 8 > 0) {\n            x >>= 8;\n            result <<= 4;\n        }\n        if (x >> 4 > 0) {\n            x >>= 4;\n            result <<= 2;\n        }\n        if (x >> 2 > 0) {\n            result <<= 1;\n        }\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        uint256 result = sqrt(a);\n        if (rounding == Rounding.Up && result * result < a) {\n            result += 1;\n        }\n        return result;\n    }\n}\n"
    },
    "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
    },
    "contracts/migrations/Migrator.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport {PeronioV1Wrapper} from \"./old/PeronioV1Wrapper.sol\";\nimport {IPeronioV1} from \"./old/IPeronioV1.sol\";\nimport \"../IPeronio.sol\";\n\nimport {Math} from \"@openzeppelin/contracts_latest/utils/math/Math.sol\";\nimport {IUniswapV2Pair} from \"../uniswap/interfaces/IUniswapV2Pair.sol\";\nimport {IFarm} from \"../qidao/IFarm.sol\";\n\nimport {IERC20} from \"@openzeppelin/contracts_latest/token/ERC20/IERC20.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\n\n// Interface\nimport {IMigrator} from \"./IMigrator.sol\";\n\ncontract Migrator is IMigrator, ERC165 {\n    using PeronioV1Wrapper for IPeronioV1;\n\n    // Peronio V1 Address\n    address public immutable peronioV1Address;\n\n    // Peronio V2 Address\n    address public immutable peronioV2Address;\n\n    /**\n     * Construct a new Peronio migrator\n     *\n     * @param _peronioV1Address  The address of the old PE contract\n     * @param _peronioV2Address  The address of the new PE contract\n     */\n    constructor(address _peronioV1Address, address _peronioV2Address) {\n        // Peronio Addresses\n        peronioV1Address = _peronioV1Address;\n        peronioV2Address = _peronioV2Address;\n\n        // Unlimited USDC Approve to Peronio V2 contract\n        IERC20(IPeronioV1(_peronioV1Address).USDC_ADDRESS()).approve(_peronioV2Address, type(uint256).max);\n    }\n\n    /**\n     * Implementation of the IERC165 interface\n     *\n     * @param interfaceId  Interface ID to check against\n     * @return  Whether the provided interface ID is supported\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IMigrator).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    // --- Migration Proper -----------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Migrate the given number of PE tokens from the old contract to the new one\n     *\n     * @param amount  The number of PE tokens to withdraw from the old contract\n     * @return usdc  The number of USDC tokens withdrawn from the old contract\n     * @return pe  The number of PE tokens minted on the new contract\n     * @custom:emit  Migrated\n     */\n    function migrate(uint256 amount) external override returns (uint256 usdc, uint256 pe) {\n        // Peronio V1 Contract Wrapper\n        IPeronioV1 peronioV1 = IPeronioV1(peronioV1Address);\n        // Peronio V2 Contract\n        IPeronio peronioV2 = IPeronio(peronioV2Address);\n\n        // Transfer PE V1 to this contract\n        IERC20(peronioV1Address).transferFrom(msg.sender, address(this), amount);\n\n        // Calculate USDC to be received by Peronio V1\n        usdc = peronioV1.withdrawV2(address(this), amount);\n        // Calculate PE to be minted by Peronio V2\n        pe = PeQuantity.unwrap(peronioV2.mintForMigration(msg.sender, UsdcQuantity.wrap(usdc), PeQuantity.wrap(1)));\n\n        // Emit Migrated event\n        emit Migrated(block.timestamp, amount, usdc, pe);\n    }\n\n    // --- Quote ----------------------------------------------------------------------------------------------------------------------------------------------\n    //\n    // Quote is created by inlining the call to migrate, and discarding state-changing statements\n    //\n\n    /**\n     * Retrieve the number of USDC tokens to withdraw from the old contract, and the number of OE tokens to mint on the new one\n     *\n     * @param amount  The number of PE tokens to withdraw from the old contract\n     * @return usdc  The number of USDC tokens to withdraw from the old contract\n     * @return pe  The number of PE tokens to mint on the new contract\n     */\n    function quote(uint256 amount) external view override returns (uint256 usdc, uint256 pe) {\n        uint256 usdcReserves;\n        uint256 maiReserves;\n        {\n            (uint112 _usdcReserves, uint112 _maiReserves) = IPeronioV1(peronioV1Address).getLpReserves();\n            (usdcReserves, maiReserves) = (uint256(_usdcReserves), uint256(_maiReserves));\n        }\n\n        uint256 lpTotalSupply = IERC20(IPeronioV1(peronioV1Address).LP_ADDRESS()).totalSupply();\n        uint256 kLast = IUniswapV2Pair(IPeronioV1(peronioV1Address).LP_ADDRESS()).kLast();\n\n        {\n            uint256 rootKLast = Math.sqrt(kLast);\n            uint256 rootK = Math.sqrt(usdcReserves * maiReserves);\n            if (rootKLast < rootK) {\n                lpTotalSupply += (lpTotalSupply * (rootK - rootKLast)) / (5 * rootK + rootKLast);\n            }\n        }\n\n        {\n            uint256 usdcAmount;\n            uint256 maiAmount;\n            {\n                uint256 newLpBalance = IERC20(IPeronioV1(peronioV1Address).LP_ADDRESS()).balanceOf(IPeronioV1(peronioV1Address).LP_ADDRESS()) +\n                    (((amount * 10e8) / IERC20(peronioV1Address).totalSupply()) *\n                        IFarm(IPeronioV1(peronioV1Address).QIDAO_FARM_ADDRESS()).deposited(IPeronioV1(peronioV1Address).QIDAO_POOL_ID(), peronioV1Address)) /\n                    10e8;\n                usdcAmount = Math.mulDiv(newLpBalance, usdcReserves, lpTotalSupply);\n                maiAmount = Math.mulDiv(newLpBalance, maiReserves, lpTotalSupply);\n                lpTotalSupply -= newLpBalance;\n            }\n\n            usdcReserves -= usdcAmount;\n            maiReserves -= maiAmount;\n            kLast = usdcReserves * maiReserves;\n\n            {\n                uint256 usdcAmountOut = Math.mulDiv(997 * maiAmount, usdcReserves, 997 * maiAmount + 1000 * maiReserves);\n                usdc = usdcAmount + usdcAmountOut;\n                usdcReserves -= usdcAmountOut;\n            }\n        }\n\n        uint256 lpAmountMint;\n        {\n            uint256 usdcAmount;\n            uint256 maiAmount;\n            {\n                uint256 usdcAmountToSwap = Math.sqrt(Math.mulDiv(3988009 * usdcReserves + 3988000 * usdc, usdcReserves, 3976036)) -\n                    Math.mulDiv(usdcReserves, 1997, 1994);\n                uint256 maiAmountOut = Math.mulDiv(997 * usdcAmountToSwap, maiReserves, 997 * usdcAmountToSwap + 1000 * usdcReserves);\n\n                usdcReserves += usdcAmountToSwap;\n                maiReserves -= maiAmountOut;\n\n                {\n                    uint256 amountMaiOptimal = Math.mulDiv(usdc, maiReserves, usdcReserves);\n                    if (amountMaiOptimal <= maiAmountOut) {\n                        (usdcAmount, maiAmount) = (usdc, amountMaiOptimal);\n                    } else {\n                        uint256 amountUsdcOptimal = (maiAmountOut * usdcReserves) / maiReserves;\n                        (usdcAmount, maiAmount) = (amountUsdcOptimal, maiAmountOut);\n                    }\n                }\n\n                {\n                    uint256 rootK = Math.sqrt(usdcReserves * maiReserves);\n                    uint256 rootKLast = Math.sqrt(kLast);\n                    if (rootKLast < rootK) {\n                        lpTotalSupply += (lpTotalSupply * (rootK - rootKLast)) / (5 * rootK + rootKLast);\n                    }\n                }\n            }\n\n            uint8 decimals = IPeronio(peronioV2Address).decimals();\n            uint256 totalMintFee;\n            {\n                (, , , , uint16 depositFeeBP) = IFarm(IPeronio(peronioV2Address).qiDaoFarmAddress()).poolInfo(IPeronio(peronioV2Address).qiDaoPoolId());\n                totalMintFee = RatioWith6Decimals.unwrap(IPeronio(peronioV2Address).swapFee()) + uint256(depositFeeBP) * 10**(decimals - 4);\n            }\n\n            lpAmountMint = Math.mulDiv(\n                Math.min(Math.mulDiv(usdcAmount, lpTotalSupply, usdcReserves), Math.mulDiv(maiAmount, lpTotalSupply, maiReserves)),\n                10**decimals - totalMintFee,\n                10**decimals\n            );\n        }\n\n        uint256 stakedAmount = IFarm(IPeronio(peronioV2Address).qiDaoFarmAddress()).deposited(IPeronio(peronioV2Address).qiDaoPoolId(), peronioV2Address);\n\n        pe = Math.mulDiv(lpAmountMint, IERC20(peronioV2Address).totalSupply(), stakedAmount);\n    }\n}\n"
    },
    "contracts/migrations/old/PeronioV1Wrapper.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n// Peronio V1 Interface\nimport {IPeronioV1} from \"./IPeronioV1.sol\";\n\n// ERC20 Interface\nimport {IERC20} from \"@openzeppelin/contracts_latest/token/ERC20/IERC20.sol\";\n\n// QiDao\nimport {IFarm} from \"../../qidao/IFarm.sol\";\n\n// UniSwap\nimport {IUniswapV2Pair} from \"../../uniswap/interfaces/IUniswapV2Pair.sol\";\nimport {IERC20Uniswap} from \"../../uniswap/interfaces/IERC20Uniswap.sol\";\n\nimport {Math} from \"@openzeppelin/contracts_latest/utils/math/Math.sol\";\n\nlibrary PeronioV1Wrapper {\n    /**\n     * Retrieve the expected number of USDC tokens corresponding to the given number of PE tokens for withdrawal.\n     *\n     * @param peronioContract  Peronio contract interface\n     * @param pe  Number of PE tokens to quote for\n     * @return usdc  Number of USDC tokens quoted for the given number of PE tokens\n     */\n    function quoteOut(IPeronioV1 peronioContract, uint256 pe) internal view returns (uint256 usdc) {\n        // --- Gas Saving -------------------------------------------------------------------------\n        address _lpAddress = peronioContract.LP_ADDRESS();\n\n        (uint256 usdcReserves, uint256 maiReserves) = peronioContract.getLpReserves();\n        uint256 lpTotalSupply = IERC20(_lpAddress).totalSupply();\n\n        // deal with LP minting when changing its K\n        {\n            uint256 rootK = Math.sqrt(usdcReserves * maiReserves);\n            uint256 rootKLast = Math.sqrt(IUniswapV2Pair(_lpAddress).kLast());\n            if (rootKLast < rootK) {\n                lpTotalSupply += Math.mulDiv(lpTotalSupply, rootK - rootKLast, (rootK * 5) + rootKLast);\n            }\n        }\n\n        // calculate LP values actually withdrawn\n        uint256 lpAmount = IERC20Uniswap(_lpAddress).balanceOf(_lpAddress) +\n            Math.mulDiv(pe, peronioContract.stakedBalance(), IERC20(address(peronioContract)).totalSupply());\n\n        uint256 usdcAmount = Math.mulDiv(usdcReserves, lpAmount, lpTotalSupply);\n        uint256 maiAmount = Math.mulDiv(maiReserves, lpAmount, lpTotalSupply);\n\n        usdc = usdcAmount + _getAmountOut(maiAmount, maiReserves - maiAmount, usdcReserves - usdcAmount);\n    }\n\n    /**\n     * Extract the given number of PE tokens as USDC tokens\n     *\n     * @param peronioContract  Peronio contract interface\n     * @param to  Address to deposit extracted USDC tokens into\n     * @param peAmount  Number of PE tokens to withdraw\n     * @return usdcTotal  Number of USDC tokens extracted\n     * @custom:emit  Withdrawal\n     */\n    function withdrawV2(\n        IPeronioV1 peronioContract,\n        address to,\n        uint256 peAmount\n    ) internal returns (uint256 usdcTotal) {\n        address usdcAddress = peronioContract.USDC_ADDRESS();\n        uint256 oldUsdcBalance = IERC20(usdcAddress).balanceOf(to);\n\n        peronioContract.withdraw(to, peAmount);\n\n        usdcTotal = IERC20(usdcAddress).balanceOf(to) - oldUsdcBalance;\n    }\n\n    function _getAmountOut(\n        uint256 amountIn,\n        uint256 reserveIn,\n        uint256 reserveOut\n    ) internal pure returns (uint256 amountOut) {\n        uint256 amountInWithFee = amountIn * 997;\n        amountOut = Math.mulDiv(amountInWithFee, reserveOut, reserveIn * 1000 + amountInWithFee);\n    }\n}\n"
    },
    "contracts/migrations/old/IPeronioV1.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IPeronioV1 {\n    function USDC_ADDRESS() external view returns (address);\n\n    function MAI_ADDRESS() external view returns (address);\n\n    function LP_ADDRESS() external view returns (address);\n\n    function QUICKSWAP_ROUTER_ADDRESS() external view returns (address);\n\n    function QIDAO_FARM_ADDRESS() external view returns (address);\n\n    function QI_ADDRESS() external view returns (address);\n\n    function QIDAO_POOL_ID() external view returns (uint256);\n\n    // Markup\n    function MARKUP_DECIMALS() external view returns (uint8);\n\n    function markup() external view returns (uint256);\n\n    function swapFee() external view returns (uint256);\n\n    // Initialization can only be run once\n    function initialized() external view returns (bool);\n\n    // Roles\n    function MARKUP_ROLE() external view returns (bytes32);\n\n    function REWARDS_ROLE() external view returns (bytes32);\n\n    // Events\n    event Initialized(address owner, uint256 collateral, uint256 startingRatio);\n    event Minted(address indexed to, uint256 collateralAmount, uint256 tokenAmount);\n    event Withdrawal(address indexed to, uint256 collateralAmount, uint256 tokenAmount);\n    event MarkupUpdated(address operator, uint256 markup);\n    event CompoundRewards(uint256 qi, uint256 usdc, uint256 lp);\n    event HarvestedMatic(uint256 wmatic, uint256 collateral);\n\n    function decimals() external view returns (uint8);\n\n    function initialize(uint256 usdcAmount, uint256 startingRatio) external;\n\n    function setMarkup(uint256 markup_) external;\n\n    function mint(\n        address to,\n        uint256 usdcAmount,\n        uint256 minReceive\n    ) external returns (uint256 peAmount);\n\n    function withdraw(address to, uint256 peAmount) external;\n\n    function claimRewards() external;\n\n    function compoundRewards() external returns (uint256 usdcAmount, uint256 lpAmount);\n\n    function stakedBalance() external view returns (uint256);\n\n    function stakedValue() external view returns (uint256 totalUSDC);\n\n    function usdcPrice() external view returns (uint256);\n\n    function buyingPrice() external view returns (uint256);\n\n    function collateralRatio() external view returns (uint256);\n\n    function getPendingRewardsAmount() external view returns (uint256 amount);\n\n    function getLpReserves() external view returns (uint112 usdcReserves, uint112 maiReserves);\n}\n"
    },
    "contracts/migrations/IMigrator.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface IMigrator {\n    // --- Events ---------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Emitted upon migration\n     *\n     * @param timestamp  The moment in time when migration took place\n     * @param oldPe  The number of old PE tokens withdraw from the previous version\n     * @param usdc  The number of USDC tokens converted from the previous version and into the new version\n     * @param newPe  The number of new PE tokens migrated to the new version\n     */\n    event Migrated(uint256 timestamp, uint256 oldPe, uint256 usdc, uint256 newPe);\n\n    // --- Addresses - Automatic ------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Retrieve the old version's address\n     *\n     * @return The address in question\n     */\n    function peronioV1Address() external view returns (address);\n\n    /**\n     * Retrieve the new version's address\n     *\n     * @return The address in question\n     */\n    function peronioV2Address() external view returns (address);\n\n    // --- Migration Proper -----------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Migrate the given number of PE tokens from the old contract to the new one\n     *\n     * @param amount  The number of PE tokens to withdraw from the old contract\n     * @return usdc  The number of USDC tokens withdrawn from the old contract\n     * @return pe  The number of PE tokens minted on the new contract\n     * @custom:emit  Migrated\n     */\n    function migrate(uint256 amount) external returns (uint256 usdc, uint256 pe);\n\n    // --- Quote ----------------------------------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Retrieve the number of USDC tokens to withdraw from the old contract, and the number of OE tokens to mint on the new one\n     *\n     * @param amount  The number of PE tokens to withdraw from the old contract\n     * @return usdc  The number of USDC tokens to withdraw from the old contract\n     * @return pe  The number of PE tokens to mint on the new contract\n     */\n    function quote(uint256 amount) external view returns (uint256 usdc, uint256 pe);\n}\n"
    },
    "contracts/gateway/Gateway.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport \"./IGateway.sol\";\n\nimport {Context} from \"@openzeppelin/contracts_latest/utils/Context.sol\";\nimport {IERC20} from \"@openzeppelin/contracts_latest/token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts_latest/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {EIP712} from \"@openzeppelin/contracts_latest/utils/cryptography/draft-EIP712.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IERC20Permit} from \"@openzeppelin/contracts_latest/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport {SignatureChecker} from \"@openzeppelin/contracts_latest/utils/cryptography/SignatureChecker.sol\";\n\nstring constant NAME = \"Gateway-\";\nstring constant VERSION = \"1\";\n\n/**\n * Feeless payment gateway\n *\n */\ncontract Gateway is Context, EIP712, ERC165, IGateway {\n\n    /**\n     * Typehash to use for signing permit executions\n     *\n     */\n    bytes32 private constant _EXECUTE_PERMIT_TYPEHASH =\n        keccak256(bytes(\"execute(PermitVoucher{address,uint256,uint256,uint256,uint256,uint256,uint256,uint256})\"));\n\n    /**\n     * Typehash to use for signing transfer executions\n     *\n     */\n    bytes32 private constant _EXECUTE_TRANSFER_TYPEHASH =\n        keccak256(bytes(\"execute(TransferVoucher{address,address,uint256,uint256,uint256,uint256})\"));\n\n    /**\n     * Typehash to use for signing permit-and-transfer executions\n     *\n     */\n    bytes32 private constant _EXECUTE_PERMIT_AND_TRANSFER_TYPEHASH =\n        keccak256(bytes(\"execute(PermitAndTransferVoucher{address,address,uint256,uint256,uint256,uint256,uint256,uint256,uint256})\"));\n\n    /**\n     * Mapping, from transaction hash to true/false, set upon a transaction being executed\n     *\n     */\n    mapping(bytes32 => bool) public transactionDone;\n\n    /**\n     * The address of the token being acted upon\n     *\n     */\n    address public token;\n\n    /**\n     * Construct the EIP712 component\n     *\n     */\n    constructor(address _token) EIP712(string.concat(NAME, IERC20Metadata(_token).name()), VERSION) {\n        token = _token;\n    }\n\n    /**\n     * Implementation of the IERC165 interface\n     *\n     * @param interfaceId  Interface ID to check against\n     * @return  Whether the provided interface ID is supported\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IGateway).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * Return the hash of the permit voucher used by execute()\n     *\n     * @param permitVoucher  The permit voucher with the transaction details\n     * @return transactionHash  The hash of the permit voucher used by execute()\n     */\n    function getTransactionHash(PermitVoucher memory permitVoucher) external view returns (bytes32 transactionHash) {\n        transactionHash = _getTransactionHash(permitVoucher);\n    }\n\n    /**\n     * Return the hash of the transfer voucher used by execute()\n     *\n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @return transactionHash  The hash of the transfer voucher used by execute()\n     */\n    function getTransactionHash(TransferVoucher memory transferVoucher) external view returns (bytes32 transactionHash) {\n        transactionHash = _getTransactionHash(transferVoucher);\n    }\n\n    /**\n     * Return the hash of the permit-and-transfer voucher used by execute()\n     *\n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @return transactionHash  The hash of the permit-and-transfer voucher used by execute()\n     */\n    function getTransactionHash(PermitAndTransferVoucher memory permitAndTransferVoucher) external view returns (bytes32 transactionHash) {\n        transactionHash = _getTransactionHash(permitAndTransferVoucher);\n    }\n\n    /**\n     * Execute a pre-signed permit transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param permitVoucher  The permit voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(PermitVoucher memory permitVoucher, bytes memory signature) external {\n        _validateTransaction(permitVoucher.owner, _getTransactionHash(permitVoucher), signature);\n\n        IERC20Permit(token).permit(\n            permitVoucher.owner,\n            address(this),\n            permitVoucher.amount,\n            permitVoucher.deadline,\n            permitVoucher.v,\n            permitVoucher.r,\n            permitVoucher.s\n        );\n\n        if (0 != permitVoucher.fee) {\n            IERC20(token).transferFrom(permitVoucher.owner, _msgSender(), permitVoucher.fee);\n        }\n\n        _emit(permitVoucher.nonce);\n    }\n\n    /**\n     * Execute a pre-signed transfer transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(TransferVoucher memory transferVoucher, bytes memory signature) external {\n        require(block.timestamp <= transferVoucher.deadline, \"Gateway: expired deadline\");\n\n        _validateTransaction(transferVoucher.from, _getTransactionHash(transferVoucher), signature);\n\n        IERC20(token).transferFrom(transferVoucher.from, transferVoucher.to, transferVoucher.amount);\n\n        if (0 != transferVoucher.fee) {\n            IERC20(token).transferFrom(transferVoucher.from, _msgSender(), transferVoucher.fee);\n        }\n\n        _emit(transferVoucher.nonce);\n    }\n\n    /**\n     * Execute a pre-signed permit-and-transfer transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(PermitAndTransferVoucher memory permitAndTransferVoucher, bytes memory signature) external {\n        _validateTransaction(permitAndTransferVoucher.from, _getTransactionHash(permitAndTransferVoucher), signature);\n\n        IERC20Permit(token).permit(\n            permitAndTransferVoucher.from,\n            address(this),\n            permitAndTransferVoucher.amount,\n            permitAndTransferVoucher.deadline,\n            permitAndTransferVoucher.v,\n            permitAndTransferVoucher.r,\n            permitAndTransferVoucher.s\n        );\n        IERC20(token).transferFrom(permitAndTransferVoucher.from, permitAndTransferVoucher.to, permitAndTransferVoucher.amount);\n\n        if (0 != permitAndTransferVoucher.fee) {\n            IERC20(token).transferFrom(permitAndTransferVoucher.from, _msgSender(), permitAndTransferVoucher.fee);\n        }\n\n        _emit(permitAndTransferVoucher.nonce);\n    }\n\n    /**\n     * Validate the given transaction and mark it as served\n     *\n     * @param signer  The funds' owner address, signing the transaction voucher\n     * @param transactionHash  The transaction voucher's hash\n     * @param signature  The signature of the transaction hash by the signer\n     */\n    function _validateTransaction(address signer, bytes32 transactionHash, bytes memory signature) internal {\n        require(SignatureChecker.isValidSignatureNow(signer, transactionHash, signature), \"GenericGateway: invalid signature\");\n        require(transactionDone[transactionHash] == false, \"GenericGateway: transaction already executed\");\n\n        transactionDone[transactionHash] = true;\n    }\n\n    /**\n     * Emit a `TransactionExecuted` event, setting the correct delegate\n     *\n     * @param nonce  The transaction's nonce used\n     */\n    function _emit(uint256 nonce) internal {\n        emit TransactionExecuted(nonce, _msgSender());\n    }\n\n    /**\n     * Calculate the transaction hash for the given permit voucher\n     * \n     * @param permitVoucher  The permit voucher with the transaction details\n     * @return transactionHash  The calculated transaction hash\n     */\n    function _getTransactionHash(PermitVoucher memory permitVoucher) internal view returns (bytes32 transactionHash) {\n        transactionHash = _hashTypedDataV4(keccak256(abi.encode(_EXECUTE_PERMIT_TYPEHASH, permitVoucher)));\n    }\n\n    /**\n     * Calculate the transaction hash for the given transfer voucher\n     * \n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @return transactionHash  The calculated transaction hash\n     */\n    function _getTransactionHash(TransferVoucher memory transferVoucher) internal view returns (bytes32 transactionHash) {\n        transactionHash = _hashTypedDataV4(keccak256(abi.encode(_EXECUTE_TRANSFER_TYPEHASH, transferVoucher)));\n    }\n\n    /**\n     * Calculate the transaction hash for the given permit-and-transfer voucher\n     * \n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @return transactionHash  The calculated transaction hash\n     */\n    function _getTransactionHash(PermitAndTransferVoucher memory permitAndTransferVoucher) internal view returns (bytes32 transactionHash) {\n        transactionHash = _hashTypedDataV4(keccak256(abi.encode(_EXECUTE_PERMIT_AND_TRANSFER_TYPEHASH, permitAndTransferVoucher)));\n    }\n}\n"
    },
    "contracts/gateway/IGateway.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * Feeless payment gateway\n *\n */\ninterface IGateway {\n\n    /**\n     * Emitted upon realization of a pre-signed transaction\n     *\n     * @param nonce  The pre-signed transaction nonce (INDEXED)\n     * @param delegate  The address executing the transaction\n     */\n    event TransactionExecuted(uint256 indexed nonce, address delegate);\n\n    /**\n     * Permit details\n     *\n     * @custom:member owner  The address granting allowance\n     * @custom:member amount  The number of tokens being allowed\n     * @custom:member deadline  The maximum block timestamp this transaction is valid until\n     * @custom:member v  The \"v\" part of an ERC20Permit signature\n     * @custom:member r  The \"r\" part of an ERC20Permit signature\n     * @custom:member s  The \"s\" part of an ERC20Permit signature\n     * @custom:member fee  The number of tokens awarded to the delegate for executing the transaction\n     * @custom:member nonce  The transaction nonce to use\n     */\n    struct PermitVoucher {\n        address owner;\n        uint256 amount;\n        uint256 deadline;\n        uint8 v;\n        bytes32 r;\n        bytes32 s;\n        //\n        uint256 fee;\n        uint256 nonce;\n    }\n\n    /**\n     * Transfer details\n     *\n     * @custom:member from  The address from whence to transfer funds\n     * @custom:member to  The address where to transfer funds to\n     * @custom:member amount  The number of tokens being transferred\n     * @custom:member deadline  The maximum block timestamp this transaction is valid until\n     * @custom:member fee  The number of tokens awarded to the delegate for executing the transaction\n     * @custom:member nonce  The transaction nonce to use\n     */\n    struct TransferVoucher {\n        address from;\n        address to;\n        uint256 amount;\n        uint256 deadline;\n        //\n        uint256 fee;\n        uint256 nonce;\n    }\n\n    /**\n     * Permit-and-Transfer details\n     *\n     * @custom:member from  The address from whence to transfer funds / granting allowance\n     * @custom:member to  The address where to transfer funds to\n     * @custom:member amount  The number of tokens being transferred / allowed\n     * @custom:member deadline  The maximum block timestamp this transaction is valid until\n     * @custom:member v  The \"v\" part of an ERC20Permit signature\n     * @custom:member r  The \"r\" part of an ERC20Permit signature\n     * @custom:member s  The \"s\" part of an ERC20Permit signature\n     * @custom:member fee  The number of tokens awarded to the delegate for executing the transaction\n     * @custom:member nonce  The transaction nonce to use\n     */\n    struct PermitAndTransferVoucher {\n        address from;\n        address to;\n        uint256 amount;\n        uint256 deadline;\n        uint8 v;\n        bytes32 r;\n        bytes32 s;\n        //\n        uint256 fee;\n        uint256 nonce;\n    }\n\n    /**\n     * Retrieve the address of the token being acted upon\n     * \n     * @return  The address of the token being acted upon\n     */\n    function token() external view returns (address);\n\n    /**\n     * Determine whether the given transaction hash has already been executed or not\n     *\n     * @param transactionHash  The hash of the payload used by transfer()\n     * @return  Whether the given transfer has has already been processed or not\n     */\n    function transactionDone(bytes32 transactionHash) external view returns (bool);\n\n    /**\n     * Return the hash of the permit voucher used by execute()\n     *\n     * @param permitVoucher  The permit voucher with the transaction details\n     * @return transactionHash  The hash of the permit voucher used by execute()\n     */\n    function getTransactionHash(PermitVoucher memory permitVoucher) external view returns (bytes32 transactionHash);\n\n    /**\n     * Return the hash of the transfer voucher used by execute()\n     *\n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @return transactionHash  The hash of the transfer voucher used by execute()\n     */\n    function getTransactionHash(TransferVoucher memory transferVoucher) external view returns (bytes32 transactionHash);\n\n    /**\n     * Return the hash of the permit-and-transfer voucher used by execute()\n     *\n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @return transactionHash  The hash of the permit-and-transfer voucher used by execute()\n     */\n    function getTransactionHash(PermitAndTransferVoucher memory permitAndTransferVoucher) external view returns (bytes32 transactionHash);\n\n    /**\n     * Execute a pre-signed permit transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param permitVoucher  The permit voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(PermitVoucher memory permitVoucher, bytes memory signature) external;\n\n    /**\n     * Execute a pre-signed transfer transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(TransferVoucher memory transferVoucher, bytes memory signature) external;\n\n    /**\n     * Execute a pre-signed permit-and-transfer transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(PermitAndTransferVoucher memory permitAndTransferVoucher, bytes memory signature) external;\n}\n"
    },
    "contracts/gateway/GenericGateway.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport \"./IGenericGateway.sol\";\n\nimport {Context} from \"@openzeppelin/contracts_latest/utils/Context.sol\";\nimport {IERC20} from \"@openzeppelin/contracts_latest/token/ERC20/IERC20.sol\";\nimport {EIP712} from \"@openzeppelin/contracts_latest/utils/cryptography/draft-EIP712.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IERC20Permit} from \"@openzeppelin/contracts_latest/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport {SignatureChecker} from \"@openzeppelin/contracts_latest/utils/cryptography/SignatureChecker.sol\";\n\nstring constant NAME = \"GenericGateway\";\nstring constant VERSION = \"1\";\n\n/**\n * Feeless payment generic gateway\n *\n */\ncontract GenericGateway is Context, EIP712, ERC165, IGenericGateway {\n\n    /**\n     * Typehash to use for signing permit executions\n     *\n     */\n    bytes32 private constant _EXECUTE_PERMIT_TYPEHASH =\n        keccak256(bytes(\"execute(PermitVoucher{address,address,uint256,uint256,uint256,uint256,uint256,uint256,uint256})\"));\n\n    /**\n     * Typehash to use for signing transfer executions\n     *\n     */\n    bytes32 private constant _EXECUTE_TRANSFER_TYPEHASH =\n        keccak256(bytes(\"execute(TransferVoucher{address,address,address,uint256,uint256,uint256,uint256})\"));\n\n    /**\n     * Typehash to use for signing permit-and-transfer executions\n     *\n     */\n    bytes32 private constant _EXECUTE_PERMIT_AND_TRANSFER_TYPEHASH =\n        keccak256(bytes(\"execute(PermitAndTransferVoucher{address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,uint256})\"));\n\n    /**\n     * Mapping, from transaction hash to true/false, set upon a transaction being executed\n     *\n     */\n    mapping(bytes32 => bool) public transactionDone;\n\n    /**\n     * Construct the EIP712 component\n     *\n     */\n    constructor() EIP712(NAME, VERSION) {}\n\n    /**\n     * Implementation of the IERC165 interface\n     *\n     * @param interfaceId  Interface ID to check against\n     * @return  Whether the provided interface ID is supported\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IGenericGateway).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * Return the hash of the permit voucher used by execute()\n     *\n     * @param permitVoucher  The permit voucher with the transaction details\n     * @return transactionHash  The hash of the permit voucher used by execute()\n     */\n    function getTransactionHash(PermitVoucher memory permitVoucher) external view returns (bytes32 transactionHash) {\n        transactionHash = _getTransactionHash(permitVoucher);\n    }\n\n    /**\n     * Return the hash of the transfer voucher used by execute()\n     *\n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @return transactionHash  The hash of the transfer voucher used by execute()\n     */\n    function getTransactionHash(TransferVoucher memory transferVoucher) external view returns (bytes32 transactionHash) {\n        transactionHash = _getTransactionHash(transferVoucher);\n    }\n\n    /**\n     * Return the hash of the permit-and-transfer voucher used by execute()\n     *\n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @return transactionHash  The hash of the permit-and-transfer voucher used by execute()\n     */\n    function getTransactionHash(PermitAndTransferVoucher memory permitAndTransferVoucher) external view returns (bytes32 transactionHash) {\n        transactionHash = _getTransactionHash(permitAndTransferVoucher);\n    }\n\n    /**\n     * Execute a pre-signed permit transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param permitVoucher  The permit voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(PermitVoucher memory permitVoucher, bytes memory signature) external {\n        _validateTransaction(permitVoucher.owner, _getTransactionHash(permitVoucher), signature);\n\n        IERC20Permit(permitVoucher.token).permit(\n            permitVoucher.owner,\n            address(this),\n            permitVoucher.amount,\n            permitVoucher.deadline,\n            permitVoucher.v,\n            permitVoucher.r,\n            permitVoucher.s\n        );\n\n        if (0 != permitVoucher.fee) {\n            IERC20(permitVoucher.token).transferFrom(permitVoucher.owner, _msgSender(), permitVoucher.fee);\n        }\n\n        _emit(permitVoucher.token, permitVoucher.nonce);\n    }\n\n    /**\n     * Execute a pre-signed transfer transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(TransferVoucher memory transferVoucher, bytes memory signature) external {\n        require(block.timestamp <= transferVoucher.deadline, \"Gateway: expired deadline\");\n\n        _validateTransaction(transferVoucher.from, _getTransactionHash(transferVoucher), signature);\n\n        IERC20(transferVoucher.token).transferFrom(transferVoucher.from, transferVoucher.to, transferVoucher.amount);\n\n        if (0 != transferVoucher.fee) {\n            IERC20(transferVoucher.token).transferFrom(transferVoucher.from, _msgSender(), transferVoucher.fee);\n        }\n\n        _emit(transferVoucher.token, transferVoucher.nonce);\n    }\n\n    /**\n     * Execute a pre-signed permit-and-transfer transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(PermitAndTransferVoucher memory permitAndTransferVoucher, bytes memory signature) external {\n        _validateTransaction(permitAndTransferVoucher.from, _getTransactionHash(permitAndTransferVoucher), signature);\n\n        IERC20Permit(permitAndTransferVoucher.token).permit(\n            permitAndTransferVoucher.from,\n            address(this),\n            permitAndTransferVoucher.amount,\n            permitAndTransferVoucher.deadline,\n            permitAndTransferVoucher.v,\n            permitAndTransferVoucher.r,\n            permitAndTransferVoucher.s\n        );\n        IERC20(permitAndTransferVoucher.token).transferFrom(permitAndTransferVoucher.from, permitAndTransferVoucher.to, permitAndTransferVoucher.amount);\n\n        if (0 != permitAndTransferVoucher.fee) {\n            IERC20(permitAndTransferVoucher.token).transferFrom(permitAndTransferVoucher.from, _msgSender(), permitAndTransferVoucher.fee);\n        }\n\n        _emit(permitAndTransferVoucher.token, permitAndTransferVoucher.nonce);\n    }\n\n    /**\n     * Validate the given transaction and mark it as served\n     *\n     * @param signer  The funds' owner address, signing the transaction voucher\n     * @param transactionHash  The transaction voucher's hash\n     * @param signature  The signature of the transaction hash by the signer\n     */\n    function _validateTransaction(address signer, bytes32 transactionHash, bytes memory signature) internal {\n        require(SignatureChecker.isValidSignatureNow(signer, transactionHash, signature), \"GenericGateway: invalid signature\");\n        require(transactionDone[transactionHash] == false, \"GenericGateway: transaction already executed\");\n\n        transactionDone[transactionHash] = true;\n    }\n\n    /**\n     * Emit a `TransactionExecuted` event, setting the correct delegate\n     *\n     * @param token  The token this transaction applies to\n     * @param nonce  The transaction's nonce used\n     */\n    function _emit(address token, uint256 nonce) internal {\n        emit TransactionExecuted(token, nonce, _msgSender());\n    }\n\n    /**\n     * Calculate the transaction hash for the given permit voucher\n     * \n     * @param permitVoucher  The permit voucher with the transaction details\n     * @return transactionHash  The calculated transaction hash\n     */\n    function _getTransactionHash(PermitVoucher memory permitVoucher) internal view returns (bytes32 transactionHash) {\n        transactionHash = _hashTypedDataV4(keccak256(abi.encode(_EXECUTE_PERMIT_TYPEHASH, permitVoucher)));\n    }\n\n    /**\n     * Calculate the transaction hash for the given transfer voucher\n     * \n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @return transactionHash  The calculated transaction hash\n     */\n    function _getTransactionHash(TransferVoucher memory transferVoucher) internal view returns (bytes32 transactionHash) {\n        transactionHash = _hashTypedDataV4(keccak256(abi.encode(_EXECUTE_TRANSFER_TYPEHASH, transferVoucher)));\n    }\n\n    /**\n     * Calculate the transaction hash for the given permit-and-transfer voucher\n     * \n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @return transactionHash  The calculated transaction hash\n     */\n    function _getTransactionHash(PermitAndTransferVoucher memory permitAndTransferVoucher) internal view returns (bytes32 transactionHash) {\n        transactionHash = _hashTypedDataV4(keccak256(abi.encode(_EXECUTE_PERMIT_AND_TRANSFER_TYPEHASH, permitAndTransferVoucher)));\n    }\n}\n"
    },
    "contracts/gateway/IGenericGateway.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * Feeless payment generic gateway\n *\n */\ninterface IGenericGateway {\n\n    /**\n     * Emitted upon realization of a pre-signed transaction (ANONYMOUS)\n     *\n     * @param token  The token being acted upon (INDEXED)\n     * @param nonce  The pre-signed transaction nonce (INDEXED)\n     * @param delegate  The address executing the transaction\n     */\n    event TransactionExecuted(address indexed token, uint256 indexed nonce, address delegate) anonymous;\n\n    /**\n     * Permit details\n     *\n     * @custom:member token  The token being acted upon\n     * @custom:member owner  The address granting allowance\n     * @custom:member amount  The number of tokens being allowed\n     * @custom:member deadline  The maximum block timestamp this transaction is valid until\n     * @custom:member v  The \"v\" part of an ERC20Permit signature\n     * @custom:member r  The \"r\" part of an ERC20Permit signature\n     * @custom:member s  The \"s\" part of an ERC20Permit signature\n     * @custom:member fee  The number of tokens awarded to the delegate for executing the transaction\n     * @custom:member nonce  The transaction nonce to use\n     */\n    struct PermitVoucher {\n        address token;\n        //\n        address owner;\n        uint256 amount;\n        uint256 deadline;\n        uint8 v;\n        bytes32 r;\n        bytes32 s;\n        //\n        uint256 fee;\n        uint256 nonce;\n    }\n\n    /**\n     * Transfer details\n     *\n     * @custom:member token  The token being acted upon\n     * @custom:member from  The address from whence to transfer funds\n     * @custom:member to  The address where to transfer funds to\n     * @custom:member amount  The number of tokens being transferred\n     * @custom:member deadline  The maximum block timestamp this transaction is valid until\n     * @custom:member fee  The number of tokens awarded to the delegate for executing the transaction\n     * @custom:member nonce  The transaction nonce to use\n     */\n    struct TransferVoucher {\n        address token;\n        //\n        address from;\n        address to;\n        uint256 amount;\n        uint256 deadline;\n        //\n        uint256 fee;\n        uint256 nonce;\n    }\n\n    /**\n     * Permit-and-Transfer details\n     *\n     * @custom:member token  The token being acted upon\n     * @custom:member from  The address from whence to transfer funds / granting allowance\n     * @custom:member to  The address where to transfer funds to\n     * @custom:member amount  The number of tokens being transferred / allowed\n     * @custom:member deadline  The maximum block timestamp this transaction is valid until\n     * @custom:member v  The \"v\" part of an ERC20Permit signature\n     * @custom:member r  The \"r\" part of an ERC20Permit signature\n     * @custom:member s  The \"s\" part of an ERC20Permit signature\n     * @custom:member fee  The number of tokens awarded to the delegate for executing the transaction\n     * @custom:member nonce  The transaction nonce to use\n     */\n    struct PermitAndTransferVoucher {\n        address token;\n        //\n        address from;\n        address to;\n        uint256 amount;\n        uint256 deadline;\n        uint8 v;\n        bytes32 r;\n        bytes32 s;\n        //\n        uint256 fee;\n        uint256 nonce;\n    }\n\n    /**\n     * Determine whether the given transaction hash has already been executed or not\n     *\n     * @param transactionHash  The hash of the payload used by transfer()\n     * @return  Whether the given transfer has has already been processed or not\n     */\n    function transactionDone(bytes32 transactionHash) external view returns (bool);\n\n    /**\n     * Return the hash of the permit voucher used by execute()\n     *\n     * @param permitVoucher  The permit voucher with the transaction details\n     * @return transactionHash  The hash of the permit voucher used by execute()\n     */\n    function getTransactionHash(PermitVoucher memory permitVoucher) external view returns (bytes32 transactionHash);\n\n    /**\n     * Return the hash of the transfer voucher used by execute()\n     *\n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @return transactionHash  The hash of the transfer voucher used by execute()\n     */\n    function getTransactionHash(TransferVoucher memory transferVoucher) external view returns (bytes32 transactionHash);\n\n    /**\n     * Return the hash of the permit-and-transfer voucher used by execute()\n     *\n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @return transactionHash  The hash of the permit-and-transfer voucher used by execute()\n     */\n    function getTransactionHash(PermitAndTransferVoucher memory permitAndTransferVoucher) external view returns (bytes32 transactionHash);\n\n    /**\n     * Execute a pre-signed permit transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param permitVoucher  The permit voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(PermitVoucher memory permitVoucher, bytes memory signature) external;\n\n    /**\n     * Execute a pre-signed transfer transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param transferVoucher  The transfer voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(TransferVoucher memory transferVoucher, bytes memory signature) external;\n\n    /**\n     * Execute a pre-signed permit-and-transfer transaction\n     *\n     * The fee will be given to sender --- if it's a smart contract make sure it can accept funds.\n     *\n     * @param permitAndTransferVoucher  The permit-and-transfer voucher with the transaction details\n     * @param signature  The signature, issued by the funds' owner\n     * @custom:emit  TransactionExecuted\n     */\n    function execute(PermitAndTransferVoucher memory permitAndTransferVoucher, bytes memory signature) external;\n}\n"
    },
    "contracts/uniswap/UniswapV2Router02.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./libraries/UniswapV2Library.sol\";\nimport \"./libraries/TransferHelper.sol\";\nimport \"./interfaces/IUniswapV2Router02.sol\";\nimport \"./interfaces/IUniswapV2Factory.sol\";\nimport \"./interfaces/IERC20Uniswap.sol\";\nimport \"./interfaces/IWETH.sol\";\n\ncontract UniswapV2Router02 is IUniswapV2Router02 {\n    address public immutable override factory;\n    address public immutable override WETH;\n\n    modifier ensure(uint256 deadline) {\n        require(deadline >= block.timestamp, \"UniswapV2Router: EXPIRED\");\n        _;\n    }\n\n    constructor(address _factory, address _WETH) {\n        factory = _factory;\n        WETH = _WETH;\n    }\n\n    receive() external payable {\n        assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract\n    }\n\n    // **** ADD LIQUIDITY ****\n    function _addLiquidity(\n        address tokenA,\n        address tokenB,\n        uint256 amountADesired,\n        uint256 amountBDesired,\n        uint256 amountAMin,\n        uint256 amountBMin\n    ) internal virtual returns (uint256 amountA, uint256 amountB) {\n        // create the pair if it doesn't exist yet\n        if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {\n            IUniswapV2Factory(factory).createPair(tokenA, tokenB);\n        }\n        (uint256 reserveA, uint256 reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);\n        if (reserveA == 0 && reserveB == 0) {\n            (amountA, amountB) = (amountADesired, amountBDesired);\n        } else {\n            uint256 amountBOptimal = UniswapV2Library.quote(amountADesired, reserveA, reserveB);\n            if (amountBOptimal <= amountBDesired) {\n                require(amountBOptimal >= amountBMin, \"UniswapV2Router: INSUFFICIENT_B_AMOUNT\");\n                (amountA, amountB) = (amountADesired, amountBOptimal);\n            } else {\n                uint256 amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA);\n                assert(amountAOptimal <= amountADesired);\n                require(amountAOptimal >= amountAMin, \"UniswapV2Router: INSUFFICIENT_A_AMOUNT\");\n                (amountA, amountB) = (amountAOptimal, amountBDesired);\n            }\n        }\n    }\n\n    function addLiquidity(\n        address tokenA,\n        address tokenB,\n        uint256 amountADesired,\n        uint256 amountBDesired,\n        uint256 amountAMin,\n        uint256 amountBMin,\n        address to,\n        uint256 deadline\n    )\n        external\n        virtual\n        override\n        ensure(deadline)\n        returns (\n            uint256 amountA,\n            uint256 amountB,\n            uint256 liquidity\n        )\n    {\n        (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);\n        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);\n        TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);\n        TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);\n        liquidity = IUniswapV2Pair(pair).mint(to);\n    }\n\n    function addLiquidityETH(\n        address token,\n        uint256 amountTokenDesired,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline\n    )\n        external\n        payable\n        virtual\n        override\n        ensure(deadline)\n        returns (\n            uint256 amountToken,\n            uint256 amountETH,\n            uint256 liquidity\n        )\n    {\n        (amountToken, amountETH) = _addLiquidity(token, WETH, amountTokenDesired, msg.value, amountTokenMin, amountETHMin);\n        address pair = UniswapV2Library.pairFor(factory, token, WETH);\n        TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);\n        IWETH(WETH).deposit{value: amountETH}();\n        assert(IWETH(WETH).transfer(pair, amountETH));\n        liquidity = IUniswapV2Pair(pair).mint(to);\n        // refund dust eth, if any\n        if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);\n    }\n\n    // **** REMOVE LIQUIDITY ****\n    function removeLiquidity(\n        address tokenA,\n        address tokenB,\n        uint256 liquidity,\n        uint256 amountAMin,\n        uint256 amountBMin,\n        address to,\n        uint256 deadline\n    ) public virtual override ensure(deadline) returns (uint256 amountA, uint256 amountB) {\n        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);\n        IUniswapV2Pair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair\n        (uint256 amount0, uint256 amount1) = IUniswapV2Pair(pair).burn(to);\n        (address token0, ) = UniswapV2Library.sortTokens(tokenA, tokenB);\n        (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);\n        require(amountA >= amountAMin, \"UniswapV2Router: INSUFFICIENT_A_AMOUNT\");\n        require(amountB >= amountBMin, \"UniswapV2Router: INSUFFICIENT_B_AMOUNT\");\n    }\n\n    function removeLiquidityETH(\n        address token,\n        uint256 liquidity,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline\n    ) public virtual override ensure(deadline) returns (uint256 amountToken, uint256 amountETH) {\n        (amountToken, amountETH) = removeLiquidity(token, WETH, liquidity, amountTokenMin, amountETHMin, address(this), deadline);\n        TransferHelper.safeTransfer(token, to, amountToken);\n        IWETH(WETH).withdraw(amountETH);\n        TransferHelper.safeTransferETH(to, amountETH);\n    }\n\n    function removeLiquidityWithPermit(\n        address tokenA,\n        address tokenB,\n        uint256 liquidity,\n        uint256 amountAMin,\n        uint256 amountBMin,\n        address to,\n        uint256 deadline,\n        bool approveMax,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external virtual override returns (uint256 amountA, uint256 amountB) {\n        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);\n        uint256 value = approveMax ? type(uint256).max : liquidity;\n        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);\n        (amountA, amountB) = removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);\n    }\n\n    function removeLiquidityETHWithPermit(\n        address token,\n        uint256 liquidity,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline,\n        bool approveMax,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external virtual override returns (uint256 amountToken, uint256 amountETH) {\n        address pair = UniswapV2Library.pairFor(factory, token, WETH);\n        uint256 value = approveMax ? type(uint256).max : liquidity;\n        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);\n        (amountToken, amountETH) = removeLiquidityETH(token, liquidity, amountTokenMin, amountETHMin, to, deadline);\n    }\n\n    // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) ****\n    function removeLiquidityETHSupportingFeeOnTransferTokens(\n        address token,\n        uint256 liquidity,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline\n    ) public virtual override ensure(deadline) returns (uint256 amountETH) {\n        (, amountETH) = removeLiquidity(token, WETH, liquidity, amountTokenMin, amountETHMin, address(this), deadline);\n        TransferHelper.safeTransfer(token, to, IERC20Uniswap(token).balanceOf(address(this)));\n        IWETH(WETH).withdraw(amountETH);\n        TransferHelper.safeTransferETH(to, amountETH);\n    }\n\n    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n        address token,\n        uint256 liquidity,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline,\n        bool approveMax,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external virtual override returns (uint256 amountETH) {\n        address pair = UniswapV2Library.pairFor(factory, token, WETH);\n        uint256 value = approveMax ? type(uint256).max : liquidity;\n        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);\n        amountETH = removeLiquidityETHSupportingFeeOnTransferTokens(token, liquidity, amountTokenMin, amountETHMin, to, deadline);\n    }\n\n    // **** SWAP ****\n    // requires the initial amount to have already been sent to the first pair\n    function _swap(\n        uint256[] memory amounts,\n        address[] memory path,\n        address _to\n    ) internal virtual {\n        for (uint256 i; i < path.length - 1; i++) {\n            (address input, address output) = (path[i], path[i + 1]);\n            (address token0, ) = UniswapV2Library.sortTokens(input, output);\n            uint256 amountOut = amounts[i + 1];\n            (uint256 amount0Out, uint256 amount1Out) = input == token0 ? (uint256(0), amountOut) : (amountOut, uint256(0));\n            address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;\n            IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(amount0Out, amount1Out, to, new bytes(0));\n        }\n    }\n\n    function swapExactTokensForTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external virtual override ensure(deadline) returns (uint256[] memory amounts) {\n        amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);\n        require(amounts[amounts.length - 1] >= amountOutMin, \"UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT\");\n        TransferHelper.safeTransferFrom(path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]);\n        _swap(amounts, path, to);\n    }\n\n    function swapTokensForExactTokens(\n        uint256 amountOut,\n        uint256 amountInMax,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external virtual override ensure(deadline) returns (uint256[] memory amounts) {\n        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);\n        require(amounts[0] <= amountInMax, \"UniswapV2Router: EXCESSIVE_INPUT_AMOUNT\");\n        TransferHelper.safeTransferFrom(path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]);\n        _swap(amounts, path, to);\n    }\n\n    function swapExactETHForTokens(\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external payable virtual override ensure(deadline) returns (uint256[] memory amounts) {\n        require(path[0] == WETH, \"UniswapV2Router: INVALID_PATH\");\n        amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);\n        require(amounts[amounts.length - 1] >= amountOutMin, \"UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT\");\n        IWETH(WETH).deposit{value: amounts[0]}();\n        assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));\n        _swap(amounts, path, to);\n    }\n\n    function swapTokensForExactETH(\n        uint256 amountOut,\n        uint256 amountInMax,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external virtual override ensure(deadline) returns (uint256[] memory amounts) {\n        require(path[path.length - 1] == WETH, \"UniswapV2Router: INVALID_PATH\");\n        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);\n        require(amounts[0] <= amountInMax, \"UniswapV2Router: EXCESSIVE_INPUT_AMOUNT\");\n        TransferHelper.safeTransferFrom(path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]);\n        _swap(amounts, path, address(this));\n        IWETH(WETH).withdraw(amounts[amounts.length - 1]);\n        TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);\n    }\n\n    function swapExactTokensForETH(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external virtual override ensure(deadline) returns (uint256[] memory amounts) {\n        require(path[path.length - 1] == WETH, \"UniswapV2Router: INVALID_PATH\");\n        amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);\n        require(amounts[amounts.length - 1] >= amountOutMin, \"UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT\");\n        TransferHelper.safeTransferFrom(path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]);\n        _swap(amounts, path, address(this));\n        IWETH(WETH).withdraw(amounts[amounts.length - 1]);\n        TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);\n    }\n\n    function swapETHForExactTokens(\n        uint256 amountOut,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external payable virtual override ensure(deadline) returns (uint256[] memory amounts) {\n        require(path[0] == WETH, \"UniswapV2Router: INVALID_PATH\");\n        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);\n        require(amounts[0] <= msg.value, \"UniswapV2Router: EXCESSIVE_INPUT_AMOUNT\");\n        IWETH(WETH).deposit{value: amounts[0]}();\n        assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));\n        _swap(amounts, path, to);\n        // refund dust eth, if any\n        if (msg.value > amounts[0]) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0]);\n    }\n\n    // **** SWAP (supporting fee-on-transfer tokens) ****\n    // requires the initial amount to have already been sent to the first pair\n    function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {\n        for (uint256 i; i < path.length - 1; i++) {\n            (address input, address output) = (path[i], path[i + 1]);\n            (address token0, ) = UniswapV2Library.sortTokens(input, output);\n            IUniswapV2Pair pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output));\n            uint256 amountInput;\n            uint256 amountOutput;\n            {\n                // scope to avoid stack too deep errors\n                (uint256 reserve0, uint256 reserve1, ) = pair.getReserves();\n                (uint256 reserveInput, uint256 reserveOutput) = input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n                amountInput = IERC20Uniswap(input).balanceOf(address(pair)) - reserveInput;\n                amountOutput = UniswapV2Library.getAmountOut(amountInput, reserveInput, reserveOutput);\n            }\n            (uint256 amount0Out, uint256 amount1Out) = input == token0 ? (uint256(0), amountOutput) : (amountOutput, uint256(0));\n            address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;\n            pair.swap(amount0Out, amount1Out, to, new bytes(0));\n        }\n    }\n\n    function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external virtual override ensure(deadline) {\n        TransferHelper.safeTransferFrom(path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn);\n        uint256 balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);\n        _swapSupportingFeeOnTransferTokens(path, to);\n        require(IERC20Uniswap(path[path.length - 1]).balanceOf(to) - balanceBefore >= amountOutMin, \"UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT\");\n    }\n\n    function swapExactETHForTokensSupportingFeeOnTransferTokens(\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external payable virtual override ensure(deadline) {\n        require(path[0] == WETH, \"UniswapV2Router: INVALID_PATH\");\n        uint256 amountIn = msg.value;\n        IWETH(WETH).deposit{value: amountIn}();\n        assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn));\n        uint256 balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);\n        _swapSupportingFeeOnTransferTokens(path, to);\n        require(IERC20Uniswap(path[path.length - 1]).balanceOf(to) - balanceBefore >= amountOutMin, \"UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT\");\n    }\n\n    function swapExactTokensForETHSupportingFeeOnTransferTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external virtual override ensure(deadline) {\n        require(path[path.length - 1] == WETH, \"UniswapV2Router: INVALID_PATH\");\n        TransferHelper.safeTransferFrom(path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn);\n        _swapSupportingFeeOnTransferTokens(path, address(this));\n        uint256 amountOut = IERC20Uniswap(WETH).balanceOf(address(this));\n        require(amountOut >= amountOutMin, \"UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT\");\n        IWETH(WETH).withdraw(amountOut);\n        TransferHelper.safeTransferETH(to, amountOut);\n    }\n\n    // **** LIBRARY FUNCTIONS ****\n    function quote(\n        uint256 amountA,\n        uint256 reserveA,\n        uint256 reserveB\n    ) public pure virtual override returns (uint256 amountB) {\n        return UniswapV2Library.quote(amountA, reserveA, reserveB);\n    }\n\n    function getAmountOut(\n        uint256 amountIn,\n        uint256 reserveIn,\n        uint256 reserveOut\n    ) public pure virtual override returns (uint256 amountOut) {\n        return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);\n    }\n\n    function getAmountIn(\n        uint256 amountOut,\n        uint256 reserveIn,\n        uint256 reserveOut\n    ) public pure virtual override returns (uint256 amountIn) {\n        return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);\n    }\n\n    function getAmountsOut(uint256 amountIn, address[] memory path) public view virtual override returns (uint256[] memory amounts) {\n        return UniswapV2Library.getAmountsOut(factory, amountIn, path);\n    }\n\n    function getAmountsIn(uint256 amountOut, address[] memory path) public view virtual override returns (uint256[] memory amounts) {\n        return UniswapV2Library.getAmountsIn(factory, amountOut, path);\n    }\n}\n"
    },
    "contracts/uniswap/libraries/UniswapV2Library.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../interfaces/IUniswapV2Pair.sol\";\n\nlibrary UniswapV2Library {\n    // returns sorted token addresses, used to handle return values from pairs sorted in this order\n    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\n        require(tokenA != tokenB, \"UniswapV2Library: IDENTICAL_ADDRESSES\");\n        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n        require(token0 != address(0), \"UniswapV2Library: ZERO_ADDRESS\");\n    }\n\n    // calculates the CREATE2 address for a pair without making any external calls\n    function pairFor(\n        address factory,\n        address tokenA,\n        address tokenB\n    ) internal pure returns (address pair) {\n        (address token0, address token1) = sortTokens(tokenA, tokenB);\n        pair = address(\n            bytes20(\n                keccak256(\n                    abi.encodePacked(\n                        hex\"ff\",\n                        factory,\n                        keccak256(abi.encodePacked(token0, token1)),\n                        hex\"1ca4cf5a40745ee86969727917c8aeb8c6bca71e9495830ee9f911ee7547d604\" // init code hash\n                    )\n                )\n            )\n        );\n    }\n\n    // fetches and sorts the reserves for a pair\n    function getReserves(\n        address factory,\n        address tokenA,\n        address tokenB\n    ) internal view returns (uint256 reserveA, uint256 reserveB) {\n        (address token0, ) = sortTokens(tokenA, tokenB);\n        (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\n        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n    }\n\n    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\n    function quote(\n        uint256 amountA,\n        uint256 reserveA,\n        uint256 reserveB\n    ) internal pure returns (uint256 amountB) {\n        require(amountA > 0, \"UniswapV2Library: INSUFFICIENT_AMOUNT\");\n        require(reserveA > 0 && reserveB > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n        amountB = (amountA * reserveB) / reserveA;\n    }\n\n    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\n    function getAmountOut(\n        uint256 amountIn,\n        uint256 reserveIn,\n        uint256 reserveOut\n    ) internal pure returns (uint256 amountOut) {\n        require(amountIn > 0, \"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\");\n        require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n        uint256 amountInWithFee = amountIn * 997;\n        uint256 numerator = amountInWithFee * reserveOut;\n        uint256 denominator = reserveIn * 1000 + amountInWithFee;\n        amountOut = numerator / denominator;\n    }\n\n    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\n    function getAmountIn(\n        uint256 amountOut,\n        uint256 reserveIn,\n        uint256 reserveOut\n    ) internal pure returns (uint256 amountIn) {\n        require(amountOut > 0, \"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\");\n        require(reserveIn > 0 && reserveOut > 0, \"UniswapV2Library: INSUFFICIENT_LIQUIDITY\");\n        uint256 numerator = reserveIn * amountOut * 1000;\n        uint256 denominator = (reserveOut - amountOut) * 997;\n        amountIn = (numerator / denominator) + 1;\n    }\n\n    // performs chained getAmountOut calculations on any number of pairs\n    function getAmountsOut(\n        address factory,\n        uint256 amountIn,\n        address[] memory path\n    ) internal view returns (uint256[] memory amounts) {\n        require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\n        amounts = new uint256[](path.length);\n        amounts[0] = amountIn;\n        for (uint256 i; i < path.length - 1; i++) {\n            (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i], path[i + 1]);\n            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);\n        }\n    }\n\n    // performs chained getAmountIn calculations on any number of pairs\n    function getAmountsIn(\n        address factory,\n        uint256 amountOut,\n        address[] memory path\n    ) internal view returns (uint256[] memory amounts) {\n        require(path.length >= 2, \"UniswapV2Library: INVALID_PATH\");\n        amounts = new uint256[](path.length);\n        amounts[amounts.length - 1] = amountOut;\n        for (uint256 i = path.length - 1; i > 0; i--) {\n            (uint256 reserveIn, uint256 reserveOut) = getReserves(factory, path[i - 1], path[i]);\n            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);\n        }\n    }\n}\n"
    },
    "contracts/uniswap/libraries/TransferHelper.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n    function safeApprove(\n        address token,\n        address to,\n        uint256 value\n    ) internal {\n        // bytes4(keccak256(bytes(\"approve(address,uint256)\")));\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), \"TransferHelper: APPROVE_FAILED\");\n    }\n\n    function safeTransfer(\n        address token,\n        address to,\n        uint256 value\n    ) internal {\n        // bytes4(keccak256(bytes(\"transfer(address,uint256)\")));\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), \"TransferHelper: TRANSFER_FAILED\");\n    }\n\n    function safeTransferFrom(\n        address token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        // bytes4(keccak256(bytes(\"transferFrom(address,address,uint256)\")));\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), \"TransferHelper: TRANSFER_FROM_FAILED\");\n    }\n\n    function safeTransferETH(address to, uint256 value) internal {\n        (bool success, ) = to.call{value: value}(new bytes(0));\n        require(success, \"TransferHelper: ETH_TRANSFER_FAILED\");\n    }\n}\n"
    },
    "contracts/uniswap/interfaces/IUniswapV2Factory.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IUniswapV2Factory {\n    event PairCreated(address indexed token0, address indexed token1, address pair, uint256);\n\n    function feeTo() external view returns (address);\n\n    function feeToSetter() external view returns (address);\n\n    function migrator() external view returns (address);\n\n    function getPair(address tokenA, address tokenB) external view returns (address pair);\n\n    function allPairs(uint256) external view returns (address pair);\n\n    function allPairsLength() external view returns (uint256);\n\n    function createPair(address tokenA, address tokenB) external returns (address pair);\n\n    function setFeeTo(address) external;\n\n    function setFeeToSetter(address) external;\n\n    function setMigrator(address) external;\n}\n"
    },
    "contracts/uniswap/interfaces/IWETH.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IWETH {\n    function deposit() external payable;\n\n    function transfer(address to, uint256 value) external returns (bool);\n\n    function withdraw(uint256) external;\n}\n"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 2000,
      "details": {
        "peephole": true,
        "inliner": true,
        "jumpdestRemover": true,
        "orderLiterals": true,
        "deduplicate": true,
        "cse": true,
        "constantOptimizer": true,
        "yul": true,
        "yulDetails": {
          "stackAllocation": true
        }
      }
    },
    "outputSelection": {
      "*": {
        "*": [
          "abi",
          "evm.bytecode",
          "evm.deployedBytecode",
          "evm.methodIdentifiers",
          "metadata",
          "devdoc",
          "userdoc",
          "storageLayout",
          "evm.gasEstimates"
        ],
        "": [
          "ast"
        ]
      }
    },
    "metadata": {
      "useLiteralContent": true
    }
  }
}