Dandy Caramel Tortoise
Medium
Failure to use updated payment amount will cause repayer's to loose assets in case they pay in excess
Failure to use updated payment amount will cause re-payer's to loose assets in case they pay in excess
In case the payment is greater than the owed amount, the _sendOrEscrowFunds
function still uses the excess amount instead of the owed amount. This causes the excess amounts to be lost to the borrower
function _repayLoan(
uint256 _bidId,
Payment memory _payment,
uint256 _owedAmount,
bool _shouldWithdrawCollateral
) internal virtual {
Bid storage bid = bids[_bidId];
uint256 paymentAmount = _payment.principal + _payment.interest;
RepMark mark = reputationManager.updateAccountReputation(
bid.borrower,
_bidId
);
// Check if we are sending a payment or amount remaining
if (paymentAmount >= _owedAmount) {
paymentAmount = _owedAmount;
...
// @audit the old _payment amount is still used instead of the updated paymentAmount
_sendOrEscrowFunds(_bidId, _payment); //send or escrow the funds
- User must make excess repayment
No response
No response
Borrowers will loose the excess they have paid
No response
Cap the payment to amountOwed