{
    "Function": "reimburseImpermanentLoss",
    "File": "contracts/reserve/VaderReserve.sol",
    "Parent Contracts": [
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/shared/ProtocolConstants.sol",
        "contracts/interfaces/reserve/IVaderReserve.sol"
    ],
    "High-Level Calls": [
        "SafeERC20",
        "ILiquidityBasedTWAP",
        "ILiquidityBasedTWAP",
        "ILiquidityBasedTWAP"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "reserve",
        "_min"
    ],
    "Library Calls": [
        "safeTransfer"
    ],
    "Low-Level Calls": [],
    "Code": "function reimburseImpermanentLoss(address recipient, uint256 amount)\r\n        external\r\n        override\r\n    {\r\n        require(\r\n            msg.sender == router,\r\n            \"VaderReserve::reimburseImpermanentLoss: Insufficient Priviledges\"\r\n        );\r\n\r\n        // NOTE: Loss is in USDV, reimbursed in VADER\r\n        // NOTE: If USDV LBT is working, prefer it otherwise use VADER price\r\n        if (lbt.previousPrices(uint256(ILiquidityBasedTWAP.Paths.USDV)) != 0) {\r\n            uint256 usdvPrice = lbt.getUSDVPrice();\r\n\r\n            amount = amount / usdvPrice;\r\n        } else {\r\n            uint256 vaderPrice = lbt.getVaderPrice();\r\n\r\n            amount = amount * vaderPrice;\r\n        }\r\n\r\n        uint256 actualAmount = _min(reserve(), amount);\r\n\r\n        vader.safeTransfer(recipient, actualAmount);\r\n\r\n        emit LossCovered(recipient, amount, actualAmount);\r\n    }"
}