Dandy Caramel Tortoise - EMI calculation is flawed #71
Labels
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Won't Fix
The sponsor confirmed this issue will not be fixed
Dandy Caramel Tortoise
Medium
EMI calculation is flawed
Summary
Taking min when calculating EMI repayment amount is flawed
Root Cause
The amount due in case of EMI repayment is calculated as:
https://github.com/sherlock-audit/2024-11-teller-finance-update/blob/0c8535728f97d37a4052d2a25909d28db886a422/teller-protocol-v2-audit-2024/packages/contracts/contracts/libraries/V2Calculations.sol#L124-L138
This is incorrect and leads to lowered payments since
_bid.terms.paymentCycleAmount+interest_
will be taken instead of the ratio wise amountEg:
Principal (P) = 100
Annual Rate (r) = 12% = 0.12
Number of Monthly Payments (n) = 12
monthly EMI = 8.84
But if the repayment occurs after 2 months, this formula calculates the amount due as 8.84 + 2 == 10.84 instead of 8.84 * 2
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
No response
Impact
Incorrectly lowered payments in case of EMI repayments
PoC
No response
Mitigation
Dont take the min. Instead use
The text was updated successfully, but these errors were encountered: