{
    "Function": "_liquidateExactRepay",
    "File": "contracts/MarginAccount.sol",
    "Parent Contracts": [
        "contracts/legos/HubbleBase.sol",
        "node_modules/@openzeppelin/contracts/metatx/ERC2771Context.sol",
        "node_modules/@openzeppelin/contracts/security/Pausable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/legos/Governable.sol",
        "node_modules/@openzeppelin/contracts/proxy/utils/Initializable.sol",
        "contracts/legos/Governable.sol",
        "contracts/Interfaces.sol"
    ],
    "High-Level Calls": [
        "SafeCast"
    ],
    "Internal Calls": [
        "require(bool,string)",
        "_scaleDecimals",
        "_executeLiquidation",
        "_min"
    ],
    "Library Calls": [
        "toUint256"
    ],
    "Low-Level Calls": [],
    "Code": "function _liquidateExactRepay(\n        LiquidationBuffer memory buffer,\n        address trader,\n        uint repay,\n        uint idx,\n        uint minSeizeAmount\n    )\n        internal\n        returns (uint seized)\n    {\n        // determine the seizable collateral amount on the basis of the most recent chainlink price feed\n        seized = _min(\n            _scaleDecimals(repay * buffer.incentivePerDollar, buffer.decimals - 6) / buffer.priceCollateral,\n            // can't seize more than available\n            // this also protects the liquidator in the scenario that they were front-run and only a small seize isn't worth it for them\n            margin[idx][trader].toUint256()\n        );\n        require(seized >= minSeizeAmount, \"Not seizing enough\");\n        _executeLiquidation(trader, repay, idx, seized, buffer.repayAble);\n    }"
}