Function: repayPrincipal(uint256 _principal)
This allows the repayment of the principal amount by custom amount.
Inputs
_principalControl: 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
borrowedInterestandborrowedPrincipalstate 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
borrowedPrincipalvariable.