Submitted by gpersoon
The value of the global variable debts in the contract MochiVault.sol is calculated in an inconsistent way.
In the function borrow() the variable debts is increased with a value excluding the fee.
However in repay() and liquidate() it is decreased with the same value as details\[\_id].debt is decreased, which is including the fee.
This would mean that debts will end up in a negative value when all debts are repay-ed. Luckily the function repay() prevents this from happening.
In the meantime the value of debts isnt accurate.
This value is used directly or indirectly in:
This means the entire debt and claimable calculations are slightly off.
vault/MochiVault sol
see issue page for referenced code.
In function borrow():
replace
debts += \_amount;
with
debts += totalDebt
ryuheimat (Mochi) confirmed
