creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/ChebuToken.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\n\npragma solidity 0.8.23;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./TradeManager.sol\";\n\ncontract ChebuToken is ERC20, TradeManager {\n\n    uint256 immutable public MAX_TOTAL_SUPPLY =1_000_000_000_000e18;\n    \n    // For BEP-20 compatibility\n    // https://github.com/bnb-chain/BEPs/blob/master/BEPs/BEP20.md#5116-getowner\n    address immutable public getOwner;\n    //address immutable public minter; // sale contract\n\n    constructor (\n        string memory _name, \n        string memory _symbol,\n        address _feeBeneficiary,\n        address _tradeFor\n    )\n        ERC20(_name, _symbol)\n        TradeManager(_feeBeneficiary, _tradeFor)\n    { \n        getOwner = msg.sender;\n    }\n\n    function _mintFor(address _user, uint256 _amount) internal override {\n        require(totalSupply() + _amount <= MAX_TOTAL_SUPPLY, \"MAX_TOTAL_SUPPLY LIMIT\");\n        _mint(_user, _amount);\n    }\n\n    function _burnFor(address _user, uint256 _amount) internal override {\n        _burn(_user, _amount);\n    }\n\n    function _distributedAmount() internal view override returns(uint256) {\n        return totalSupply();\n    }\n\n    function _distributionTokenDecimals() internal view override returns(uint8) {\n        return decimals();\n    }\n    \n}\n\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.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 *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\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 */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n    mapping(address account => uint256) private _balances;\n\n    mapping(address account => mapping(address spender => 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     * 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 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 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 default value returned by this function, unless\n     * it's 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 returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual 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 `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` 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 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\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 `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` 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     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            _totalSupply += value;\n        } else {\n            uint256 fromBalance = _balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                _balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                _totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                _balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` 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     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n     * true using the following override:\n     * ```\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        _allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"
      },
      "src/TradeManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// Mem Token TradeManager\npragma solidity 0.8.23;\n\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ninterface IERC20Decimals{\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n\ncontract TradeManager {\n\t using SafeERC20 for IERC20;\n    \n    struct Fee {\n    \tuint256 total;\n    \tuint256 claimed;\n    }\n\n    /////////////////////////////////////////////////\n    ///  Main Constants, check before Deployment   //\n    /////////////////////////////////////////////////\n    uint256 constant public START_PRICE = 1;         \n    uint256 constant public PRICE_INCREASE_STEP = 1; // 1 decimal unit of stable coin\n    uint256 constant public INCREASE_FROM_ROUND = 1;\n    uint256 immutable public ROUND_VOLUME = 1_000_000 * 10**_distributionTokenDecimals(); // in wei\n    /////////////////////////////////////////////////\n\n    uint256 constant public FEE_PERCENT_POINT = 50000;\n    uint256 constant public PERCENT_DENOMINATOR = 10000;\n    \n    address immutable public BENEFICIARY;\n    uint8 immutable public TRADE_DECIMALS;\n    uint256 immutable public CREATED;\n\n    uint256 public maxPrice;\n    Fee public fee;\n\n    IERC20 public tradeToken;\n\n    event Deal(\n        address indexed User,\n        address indexed assetIn,\n        uint256 amountIn,\n        uint256 amountOut\n    );\n\n    constructor (\n    \taddress _feeBeneficiary,\n        address _tradeFor       // e.g. USDT address\n    ) \n    {\n    \trequire(_feeBeneficiary != address(0), \"Please set beneficiary\");\n        BENEFICIARY = _feeBeneficiary;\n    \tTRADE_DECIMALS = 18;\n    \tif (_tradeFor != address(0)) {\n    \t\ttradeToken = IERC20(_tradeFor);\n    \t\tTRADE_DECIMALS = IERC20Decimals(_tradeFor).decimals();\n    \t}\n        CREATED = block.timestamp;\n        \n    }\n\n    /// @notice Mint tokens for stable coins (or native)\n    /// @dev _inAmount in wei. Don't forget approve\n    /// @param _inAmount amount of stable (or native) to spent\n    /// @param _outNotLess minimal desired amount of  tokens (anti slippage)\n    function mintTokensForExactStableWithSlippage(\n        uint256 _inAmount, \n        uint256 _outNotLess\n    ) \n        external \n    {\n        (uint256 out, ) = _calcMintTokensForExactStable(_inAmount);\n        require(out >= _outNotLess, \"Slippage occur\");\n        mintTokensForExactStable(_inAmount); \n\n    }     \n\n    /// @notice Mint tokens for stable coins (or native)\n    /// @dev _inAmount in wei. Don't forget approve\n    /// @param _inAmount amount of stable to spent\n    function mintTokensForExactStable(uint256 _inAmount) \n        public \n    {\n\n        // 1. Calc distribution tokens\n        (uint256 outAmount, uint256 inAmountFee)= _calcMintTokensForExactStable(_inAmount);\n        require(outAmount > 0, 'Cant buy zero');\n        \n        // 2. Charge Fee\n        fee.total += inAmountFee;\n        \n        // 3. Mint distribution token\n        _mintFor(msg.sender, outAmount);\n\n        // Save maxPrice\n        uint256 currPrice = _priceForRound(_currenRound());\n        if (maxPrice < currPrice){\n            maxPrice = currPrice;\n        }\n\n        // 4. Get payment\n        tradeToken.safeTransferFrom(msg.sender, address(this), _inAmount);\n\n        emit Deal(msg.sender, address(tradeToken), _inAmount, outAmount);\n\n    }\n\n    function burnExactTokensForStable(uint256 _inAmount) public {\n\n        // 1. Calc distribution tokens\n        (uint256 outAmount, uint256 outAmountFee)= _calcBurnExactTokensForStable(_inAmount);\n        require(outAmount > 0, 'Cant buy zero');\n        \n        // 2. Charge Fee\n        fee.total += outAmountFee;\n        \n        // 3. Mint distribution token\n        _burnFor(msg.sender, _inAmount);\n\n        // 4. Get payment\n        tradeToken.safeTransfer(msg.sender, outAmount);\n\n        emit Deal(msg.sender, address(this), _inAmount, outAmount);\n\n    }\n\n    function claimFee(uint256 _amount) external {\n        require(msg.sender == BENEFICIARY, \"Unauthorized\");\n        require(_amount <= fee.total - fee.claimed);\n        fee.claimed += _amount;\n        tradeToken.safeTransfer(msg.sender, _amount);\n\n    }\n    \n    //////////////////\n    //   GETTERS    //\n    //////////////////\n\n    /// @notice Returns amount of tokens that will be\n    /// get by user if he(she) pay given stable coin amount\n    /// @dev _inAmount must be with given in wei (eg 1 USDT =1000000)\n    /// @param _inAmount stable coin amount that user want to spend\n    /// @param outAmount stable coin amount that user will get\n    /// @param inAmountFee fee that will given from _inAmount\n    function calcMintTokensForExactStable(uint256 _inAmount) \n        external \n        view \n        returns(uint256 outAmount, uint256 inAmountFee) \n    {\n        (outAmount, inAmountFee) = _calcMintTokensForExactStable(_inAmount);\n    }\n\n    /// @notice Returns amount of stable coins that must be spent\n    /// for user get given  amount of  token\n    /// @dev _outAmount must be with given in wei (eg 1 UBDN =1e18)\n    /// @param _outAmount distributing token amount that user want to get\n    /// @param inAmount amount of stable coins that must be spent with fee includede\n    /// @param includeFee fee amount that already included in inAmount\n    function calcMintStableForExactTokens(uint256 _outAmount) \n        external \n        view \n        returns(uint256 inAmount, uint256 includeFee) \n    {\n        \n        (inAmount, includeFee) =  _calcMintStableForExactTokens(_outAmount);\n    }\n\n\n    /// @notice Returns amount of stable tokens that will be\n    /// get by user if he(she) burn given chebu coin amount\n    /// @dev _inAmount must be with given in wei (eg 1 CHEBU =1000000000000000000)\n    /// @param _inAmount CHEBU coin amount that user want to burn\n    /// @param outAmount stable coin amount that user will get\n    /// @param outAmountFee fee that will charged from outAmount\n    function calcBurnExactTokensForStable(uint256 _inAmount)\n        external\n        view\n        returns(uint256 outAmount, uint256 outAmountFee) \n    {\n        (outAmount, outAmountFee) = _calcBurnExactTokensForStable(_inAmount);\n    }\n\n     /// @notice Returns amount of CHEBU tokens that will be\n    /// burn by user to get some  exact amount of stables\n    /// @dev _inAmount must be with given in wei (eg 1 CHEBU =1000000000000000000)\n    /// @param _outAmount stable coin amount that user want to get after burn\n    /// @param inAmount CHEBU coin amount that user will need to  burn\n    /// @param includeFee fee that will charged from _outAmount\n    function calcBurnTokensForExactStable(uint256 _outAmount)\n        external\n        view\n        returns(uint256 inAmount, uint256 includeFee)\n    {\n        (inAmount, includeFee) = _calcBurnTokensForExactStable(_outAmount);\n    }\n\n\n    /// @notice Returns price  and distributing token rest\n    /// for given round\n    /// @dev returns tuple  (price, rest)\n    /// @param _round round number\n    function priceAndRemainByRound(uint256 _round) \n        external \n        view \n        returns(uint256, uint256) \n    {\n        return _priceInUnitsAndRemainByRound(_round);\n    }\n\n    /// @notice Returns price  and minted token \n    /// for given round\n    /// @dev returns tuple  (price, rest)\n    /// @param _round round number\n    function priceAndMintedInRound(uint256 _round) \n        external \n        view \n        returns(uint256, uint256) \n    {\n        return _priceInUnitsAndMintedInRound(_round);\n    }\n\n    /// @notice Returns current round number\n    function getCurrentRound() external view returns(uint256){\n        return _currenRound();   \n    }\n\n    /////////////////////////////////////////////////////////////////////\n\n    function _calcMintStableForExactTokens(uint256 _outAmount) \n        internal\n        virtual \n        view \n        returns(uint256 inAmount, uint256 includeFee) \n    {\n        uint256 outA = _outAmount;\n        uint256 curR = _currenRound();\n        uint256 curPrice; \n        uint256 curRest;\n        uint8 dstTokenDecimals = _distributionTokenDecimals();\n        while (outA > 0) {\n            (curPrice, curRest) = _priceInUnitsAndRemainByRound(curR); \n            if (outA > curRest) {\n                inAmount += curRest \n                    //* curPrice * 10**TRADE_DECIMALS\n                    * curPrice \n                    / (10**dstTokenDecimals);\n                outA -= curRest;\n                ++ curR;\n            } else {\n                inAmount += outA \n                    //* curPrice * 10**TRADE_DECIMALS\n                    * curPrice\n                    / (10**dstTokenDecimals);\n                //return inAmount;\n                break;\n            }\n        }\n        // Fee Charge\n        includeFee = inAmount * FEE_PERCENT_POINT / (100 * PERCENT_DENOMINATOR);\n        inAmount += includeFee; // return inAmount with fee incleded\n    }\n\n    function _calcMintTokensForExactStable(uint256 _inAmount) \n        internal\n        virtual \n        view \n        returns(uint256 outAmount, uint256 inAmountFee) \n    {\n        // Calc realy inamount with excluded fee\n        uint256 inA = _inAmount * 100 * PERCENT_DENOMINATOR \n            / (100 * PERCENT_DENOMINATOR + FEE_PERCENT_POINT);\n        inAmountFee = _inAmount - inA;\n        uint256 curR = _currenRound();\n        uint256 curPrice; \n        uint256 curRest;\n        uint8 dstTokenDecimals = _distributionTokenDecimals();\n        while (inA > 0) {\n            (curPrice, curRest) = _priceInUnitsAndRemainByRound(curR); \n            if (\n                // calc out amount\n                inA \n                * (10**dstTokenDecimals)\n                // / (curPrice * 10**TRADE_DECIMALS)\n                / curPrice\n                   > curRest\n                ) \n            {\n                // Case when inAmount more then price of all tokens \n                // in current round\n                outAmount += curRest;\n                inA -= curRest \n                       //* curPrice * 10**TRADE_DECIMALS\n                       * curPrice\n                       / (10**dstTokenDecimals);\n                ++ curR;\n            } else {\n                // Case when inAmount less or eqal then price of all tokens \n                // in current round\n                outAmount += inA \n                  * 10**dstTokenDecimals\n                 // / (curPrice * 10**TRADE_DECIMALS);\n                  / (curPrice );\n                return (outAmount, inAmountFee);\n            }\n        }\n    }\n\n    function _calcBurnExactTokensForStable(uint256 _inAmount)\n        internal\n        view\n        returns(uint256 outAmount, uint256 outAmountFee)\n    {\n    \tuint256 inA = _inAmount;\n        uint256 curR = _currenRound();\n        uint256 curPrice; \n        uint256 curMint;\n        uint8 dstTokenDecimals = _distributionTokenDecimals();\n        while (inA > 0) {\n            (curPrice, curMint) = _priceInUnitsAndMintedInRound(curR);\n            // Case when \n            if (inA > curMint) {\n                outAmount += curMint \n                    // * curPrice * 10**TRADE_DECIMALS  // check about decimals\n                    * curPrice\n                    / (10**dstTokenDecimals);\n                inA -= curMint;\n                -- curR;\n            } else {\n                outAmount += inA \n                    // * curPrice * 10**TRADE_DECIMALS\n                    * curPrice\n                    / (10**dstTokenDecimals);\n                //return inAmount;\n                break;\n            }\n        }\n        // Fee Charge\n        outAmountFee = outAmount * FEE_PERCENT_POINT / (100 * PERCENT_DENOMINATOR);\n        outAmount -= outAmountFee; // return outAmount  fee excleded\n\n    }\n\n    function _calcBurnTokensForExactStable(uint256 _outAmount)\n        internal\n        view\n        returns(uint256 inAmount, uint256 payedFee)\n    {\n    \t// Calc realy out amount before pay fee\n        uint256 outA = _outAmount * 100 * PERCENT_DENOMINATOR \n            / (100 * PERCENT_DENOMINATOR - FEE_PERCENT_POINT);\n        payedFee = outA  - _outAmount;\n\n        uint256 curR = _currenRound();\n        uint256 curPrice; \n        uint256 curMint;\n        uint8 dstTokenDecimals = _distributionTokenDecimals();\n        while (outA > 0) {\n            (curPrice, curMint) = _priceInUnitsAndMintedInRound(curR); \n            if (\n                // calc out amount\n                outA \n                * (10**dstTokenDecimals)\n                 // / (curPrice * 10**TRADE_DECIMALS)\n                / curPrice\n                   > curMint\n                ) \n            {\n                // Case when inAmount more then price of all tokens \n                // in current round\n                inAmount += curMint;\n                outA -= curMint \n                       //* curPrice * 10**TRADE_DECIMALS\n                       * curPrice\n                       / (10**dstTokenDecimals);\n                -- curR;\n            } else {\n                // Case when inAmount less or equal then price of all tokens \n                // in current round\n                inAmount += outA \n                  * 10**dstTokenDecimals\n                   /// (curPrice * 10**TRADE_DECIMALS);\n                   / curPrice;\n                return (inAmount, payedFee);\n            }\n        }\n    }\n    function _priceInUnitsAndMintedInRound(uint256 _round)\n        internal\n        view\n        returns(uint256 price, uint256 minted)\n    {\n         price = _priceForRound(_round);\n\n         // in finished rounds rest always zero\n        if (_round < _currenRound()){\n            minted = ROUND_VOLUME;\n        \n        // in current round need calc \n        } else if (_round == _currenRound()){\n            if (_round == 1){\n                // first round\n                minted = _distributedAmount(); \n            } else {\n                minted = _distributedAmount() % ROUND_VOLUME; \n            } \n        \n        // in future rounds rest always ROUND_VOLUME\n        } else {\n            minted = 0;\n        }\n    }\n\n    function _priceInUnitsAndRemainByRound(uint256 _round) \n        internal \n        view \n        virtual \n        returns(uint256 price, uint256 rest) \n    {\n        price = _priceForRound(_round);\n        \n        // in finished rounds rest always zero\n        if (_round < _currenRound()){\n            rest = 0;\n        \n        // in current round need calc \n        } else if (_round == _currenRound()){\n            if (_round == 1){\n                // first round\n                rest = ROUND_VOLUME - _distributedAmount(); \n            } else {\n                rest = ROUND_VOLUME - (_distributedAmount() % ROUND_VOLUME); \n            } \n        \n        // in future rounds rest always ROUND_VOLUME\n        } else {\n            rest = ROUND_VOLUME;\n        }\n    }\n\n    function _priceForRound(uint256 _round) internal pure returns (uint256 price) {\n    \tif (_round < INCREASE_FROM_ROUND){\n            price = START_PRICE;\n        } else {\n            price = PRICE_INCREASE_STEP * (_round - INCREASE_FROM_ROUND + 1); \n        }\n    }\n\n    function _currenRound() internal view virtual returns(uint256){\n        return _distributedAmount() / ROUND_VOLUME + 1;\n    }\n\n    \n\n    //////////////////////////////////////////////////////////////////////\n    function _mintFor(address _user, uint256 _amount) internal virtual {\n\n    }\n\n    function _burnFor(address _user, uint256 _amount) internal virtual {\n    \t\n    }\n\n    function _distributedAmount() internal view virtual returns(uint256) {\n    \treturn 0;\n    }\n\n    function _distributionTokenDecimals() internal view virtual returns(uint8){\n    \treturn 18;\n    }\n}"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev An operation with an ERC20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error AddressInsufficientBalance(address account);\n\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedInnerCall();\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert AddressInsufficientBalance(address(this));\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert FailedInnerCall();\n        }\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {FailedInnerCall} error.\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert AddressInsufficientBalance(address(this));\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n     * unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            // only check if target is a contract if the call was successful and the return data is empty\n            // otherwise we already know that it was a contract\n            if (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {FailedInnerCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert FailedInnerCall();\n        }\n    }\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "@openzeppelin/=lib/openzeppelin-contracts/",
        "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
        "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}