Submitted by Silvermist, also found by rbserver, ElCid, Topmark, and carrotsmuggler
A user is allowed to partial repay a loan via the _partialRepay() function. It has a debtToRepay parameter which determines how much of the loan debt will be repaid. The debtToRepay amount should repay part of the borrowed amount and also a part of the fees and interest.
interestRepaid is calculated when from debtToRepay is subtracted the principalRepaid. It is made like that because we assume when we subtract the principalRepaid from the debtToRepay, the remaining amount from the  debtToRepay  is the interest.
So far so good, but there is one require or more specifically the interestRepaid != 0 part of the require that causes a problem:
That check is used to ensure that the amount the user is repaying is not too small; however, the interestRepaid would be 0 when there is 0 amount interest. A loan can be configured with 0 interest so it is a possible case. We can see it is not a problem to repay it through _repay() but it is impossible to partial repay it.
Paste the following test inside test/unit/loan/LendingTerm.t.sol:
A possible solution would be to remove the interestRepaid != 0 from the require in _partialRepay():
And a check to confirm the interest is not 0 before transferring it:
eswak (Ethereum Credit Guild) confirmed via duplicate issue #782
TrungOre (judge) commented:
