{
    "Function": "_burn",
    "File": "contracts/dex/pool/BasePool.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol",
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol",
        "node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol",
        "node_modules/@openzeppelin/contracts/utils/introspection/ERC165.sol",
        "node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/dex/utils/GasThrottle.sol",
        "contracts/shared/ProtocolConstants.sol",
        "contracts/interfaces/dex/pool/IBasePool.sol"
    ],
    "High-Level Calls": [
        "IERC20",
        "SafeERC20",
        "IERC20",
        "IERC20",
        "SafeERC20",
        "IERC20"
    ],
    "Internal Calls": [
        "ownerOf",
        "nonReentrant",
        "_burn",
        "require(bool,string)",
        "require(bool,string)",
        "getReserves",
        "_update"
    ],
    "Library Calls": [
        "safeTransfer",
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function _burn(uint256 id, address to)\r\n        internal\r\n        nonReentrant\r\n        returns (uint256 amountNative, uint256 amountForeign)\r\n    {\r\n        require(\r\n            ownerOf(id) == address(this),\r\n            \"BasePool::burn: Incorrect Ownership\"\r\n        );\r\n\r\n        (uint112 reserveNative, uint112 reserveForeign, ) = getReserves(); // gas savings\r\n        IERC20 _nativeAsset = nativeAsset; // gas savings\r\n        IERC20 _foreignAsset = foreignAsset; // gas savings\r\n        uint256 nativeBalance = IERC20(_nativeAsset).balanceOf(address(this));\r\n        uint256 foreignBalance = IERC20(_foreignAsset).balanceOf(address(this));\r\n\r\n        uint256 liquidity = positions[id].liquidity;\r\n\r\n        uint256 _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee\r\n        amountNative = (liquidity * nativeBalance) / _totalSupply; // using balances ensures pro-rata distribution\r\n        amountForeign = (liquidity * foreignBalance) / _totalSupply; // using balances ensures pro-rata distribution\r\n\r\n        require(\r\n            amountNative > 0 && amountForeign > 0,\r\n            \"BasePool::burn: Insufficient Liquidity Burned\"\r\n        );\r\n\r\n        totalSupply -= liquidity;\r\n        _burn(id);\r\n\r\n        _nativeAsset.safeTransfer(to, amountNative);\r\n        _foreignAsset.safeTransfer(to, amountForeign);\r\n\r\n        nativeBalance = _nativeAsset.balanceOf(address(this));\r\n        foreignBalance = _foreignAsset.balanceOf(address(this));\r\n\r\n        _update(nativeBalance, foreignBalance, reserveNative, reserveForeign);\r\n\r\n        emit Burn(msg.sender, amountNative, amountForeign, to);\r\n    }"
}