Assessment reports>Prisma Finance>Threat Models>_tryLiquidateWithCap

Function: _tryLiquidateWithCap(ITroveManager troveManager, address _borrower, uint256 _ICR, uint256 _debtInStabPool, uint256 _TCR, uint256 _price)

This internal function will attempt to liquidate a single trove in recovery mode.

Inputs

  • troveManager

    • Control: None.

    • Constraints: None.

    • Impact: The trove manager is used to determine the trove, move the pending balances, and close it.

  • _borrower

    • Control: None.

    • Constraints: None.

    • Impact: The borrower address to be liquidated.

  • _ICR

    • Control: None.

    • Constraints: None.

    • Impact: The calculated ICR of the trove.

  • _debtInStabPool

    • Control: None.

    • Constraints: None.

    • Impact: Available debt in stability pool.

  • _TCR

    • Control: None.

    • Constraints: None.

    • Impact: TCR of the system.

  • _price

    • Control: None.

    • Constraints: None.

    • Impact: The price of the collateral.

Branches and code coverage (including function calls)

Intended branches

  • Adds any collateral surplus to the user's surplus balance.

Negative behavior

  • Do not liquidate if the condition (_ICR >= _TCR) || (_TCR >= CCR) is true.

  • Do not liquidate if the entire trove cannot be liquidated via SP.

Function call analysis

  • troveManager.getEntireDebtAndColl(_borrower)

    • What is controllable? _borrower.

    • If return value controllable, how is it used and how can it go wrong? Return values are not controllable.

    • What happens if it reverts, reenters, or does other unusual control flow? No reentrancy scenarios.

  • troveManager.movePendingTroveRewardsToActiveBalances(pendingDebtReward, pendingCollReward)

    • What is controllable? N/A.

    • If return value controllable, how is it used and how can it go wrong? Return value is not controllable.

    • What happens if it reverts, reenters, or does other unusual control flow? No reentrancy scenarios.

  • troveManager.closeTroveByLiquidation(_borrower)

    • What is controllable? _borrower.

    • If return value controllable, how is it used and how can it go wrong? Return value is not controllable.

    • What happens if it reverts, reenters, or does other unusual control flow? No reentrancy scenarios.

  • troveManager.addCollateralSurplus(_borrower, collSurplus)

    • What is controllable? _borrower.

    • If return value controllable, how is it used and how can it go wrong? Return value is not controllable.

    • What happens if it reverts, reenters, or does other unusual control flow? No reentrancy scenarios.

Zellic © 2025Back to top ↑