Assessment reports>WOOFI Stake>Threat Model>repayPrincipal

Function: repayPrincipal(uint256 _principal)

This allows the repayment of the principal amount by custom amount.

Inputs

  • _principal

    • Control: Full control by the caller.

    • Constraints: None.

    • Impact: The amount of principal to be repaid by the caller.

Branches and code coverage

Intended branches

  • Accrue the interest before repaying.

  • Repay by transferring in the funds from the caller.

  • Update the borrowedInterest and borrowedPrincipal state variables by subtracting the repaid amount.

Negative behavior

  • Should not allow anyone other than the borrower to repay.

  • Should not allow paying more than what is borrowed. Ensured through the borrowedPrincipal variable.

Zellic © 2024Back to top ↑