Assessment reports>Y2K Finance>Threat Model>afterClose

Function: afterClose()

This repays the loan and swaps the excess to aTokens.

Branches and code coverage (including function calls)

Intended branches

  • Repays the loan by calling _repay(borrowToken).

  • Checks for excess tokens and swaps them to deposit tokens.

  • Transfers any remaining excess tokens to the strategy contract.

Negative behavior

  • The function reverts if the caller is an address other than the strategy contract.

Function call analysis

  • _repay(borrowToken)

    • What is controllable? N/A.

    • If return value controllable, how is it used and how can it go wrong? N/A.

    • What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.

  • _swap(excess, borrowToken, 0)

    • What is controllable? N/A.

    • If return value controllable, how is it used and how can it go wrong? N/A.

    • What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.

  • _supply(amountOut, false)

    • What is controllable? N/A.

    • If return value controllable, how is it used and how can it go wrong? N/A.

    • What happens if it reverts, reenters, or does other unusual control flow? If this reverts, the entire call fails --- no reentrancy issues.

Zellic © 2024Back to top ↑