{
    "Function": "mint",
    "File": "contracts/external/UniswapV2Pair.sol",
    "Parent Contracts": [
        "contracts/external/UniswapV2ERC20.sol",
        "contracts/interfaces/external/uniswap/IUniswapV2Pair.sol",
        "contracts/interfaces/external/uniswap/IUniswapV2ERC20.sol"
    ],
    "High-Level Calls": [
        "UniswapMath",
        "IERC20",
        "UniswapMath",
        "IERC20"
    ],
    "Internal Calls": [
        "_mint",
        "lock",
        "_update",
        "_mint",
        "require(bool,string)",
        "_mintFee",
        "getReserves"
    ],
    "Library Calls": [
        "sqrt",
        "min"
    ],
    "Low-Level Calls": [],
    "Code": "function mint(address to) external lock returns (uint256 liquidity) {\n        (uint112 _reserve0, uint112 _reserve1, ) = getReserves(); // gas savings\n        uint256 balance0 = IERC20(token0).balanceOf(address(this));\n        uint256 balance1 = IERC20(token1).balanceOf(address(this));\n        uint256 amount0 = balance0 - _reserve0;\n        uint256 amount1 = balance1 - _reserve1;\n\n        bool feeOn = _mintFee(_reserve0, _reserve1);\n        uint256 _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee\n        if (_totalSupply == 0) {\n            liquidity = UniswapMath.sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY;\n            _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens\n        } else {\n            liquidity = UniswapMath.min(\n                (amount0 * (_totalSupply)) / _reserve0,\n                (amount1 * (_totalSupply)) / _reserve1\n            );\n        }\n        require(liquidity > 0, \"UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED\");\n        _mint(to, liquidity);\n\n        _update(balance0, balance1, _reserve0, _reserve1);\n        if (feeOn) kLast = uint256(reserve0) * reserve1; // reserve0 and reserve1 are up-to-date\n        emit Mint(msg.sender, amount0, amount1);\n    }"
}