Assessment reports>Nukem Loans>Threat Model>maxWithdraw

Function: maxWithdraw(address account)

This calculates how much a user can withdraw.

Inputs

  • account

    • Control: Full.

    • Constraints: None.

    • Impact: The account.

Branches and code coverage (including function calls)

Intended branches

  • Works as intended and allows user to withdraw as long as position is healthy.

Negative behavior

  • Zero edge cases.

Function call analysis

  • maxWithdraw(account) -> assetsOf(account)

    • What is controllable? Everything.

    • If return value controllable, how is it used and how can it go wrong? Account assets (collateral).

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • maxWithdraw(account) -> debt.assetsOf(account)

    • What is controllable? Everything.

    • If return value controllable, how is it used and how can it go wrong? Amount of debt.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • maxWithdraw(account) -> market.swapper().valueOf(debt.asset(), account_debt_assets)

    • What is controllable? Full.

    • If return value controllable, how is it used and how can it go wrong? Manipulated to return a small number, allowing a user to remove their collateral for their debt.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

  • maxWithdraw(account) -> (asset_balance * strategy.maxCollateralizationRatio()) / strategy.precision()

    • What is controllable? Nothing.

    • If return value controllable, how is it used and how can it go wrong? Used in calculations to calculate how much collateral can be withdrawn.

    • What happens if it reverts, reenters, or does other unusual control flow? N/A.

Zellic © 2024Back to top ↑