{
    "Function": "mint",
    "File": "contracts/contracts/Pair.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "IERC20",
        "Math",
        "IERC20",
        "Math"
    ],
    "Internal Calls": [
        "lock",
        "_mint",
        "require(bool,string)",
        "_mint",
        "_update"
    ],
    "Library Calls": [
        "min",
        "sqrt"
    ],
    "Low-Level Calls": [],
    "Code": "function mint(address to) external lock returns (uint liquidity) {\n        (uint _reserve0, uint _reserve1) = (reserve0, reserve1);\n        uint _balance0 = IERC20(token0).balanceOf(address(this));\n        uint _balance1 = IERC20(token1).balanceOf(address(this));\n        uint _amount0 = _balance0 - _reserve0;\n        uint _amount1 = _balance1 - _reserve1;\n\n        uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee\n        if (_totalSupply == 0) {\n            liquidity = Math.sqrt(_amount0 * _amount1) - MINIMUM_LIQUIDITY;\n            _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens\n        } else {\n            liquidity = Math.min(_amount0 * _totalSupply / _reserve0, _amount1 * _totalSupply / _reserve1);\n        }\n        require(liquidity > 0, 'ILM'); // Pair: INSUFFICIENT_LIQUIDITY_MINTED\n        _mint(to, liquidity);\n\n        _update(_balance0, _balance1, _reserve0, _reserve1);\n        emit Mint(msg.sender, _amount0, _amount1);\n    }"
}