This has low risk because all of the update[XXXX]LimitLimits functions are protected by onlyOwner. However if the owner did make a mistake then it would impact all limit calculations and effectively brick the contract until the owner resolved the mistake.
calculateInterestAccrued calculations differ from documentation
Grace Period Interest Rate: Interest rate that will be used for calculating interest during the grace period
However in the calculateInterestAccrued function here, penalty interest is added to normal interest (where normal interest is also calculated during the grace period):
Thus, the actual interest being calculated during the grace period is actually the normal interest rate plus the penalty interest rate. This is detrimental to the borrower. Either the documentation should be updated to reflect the code, or the interest calculation in the code should be modified to match the documentation.
Max = 0 is the case where there are no restrictions on the max. value of a variable. Thus the logic works as expected - we'll update the natspec to make this explicit.
Looks like we weren't descriptive enough in one of the sections. In the technical spec of the document we mention that the interest rate is cumulative
Low Priority Findings
Logic error in
update[XXXX]LimitLimits
functionsAll the
update[XXXX]LimitLimits
functions here have a logic error in the firstrequire
:This require check passes if
_max = 0
..._min
can then be bigger thanmax
. I would suggest the following fix:This has low risk because all of the
update[XXXX]LimitLimits
functions are protected byonlyOwner
. However if the owner did make a mistake then it would impact all limit calculations and effectively brick the contract until the owner resolved the mistake.calculateInterestAccrued
calculations differ from documentationIn the documentation it states the following:
However in the
calculateInterestAccrued
function here, penalty interest is added to normal interest (where normal interest is also calculated during the grace period):Thus, the actual interest being calculated during the grace period is actually the normal interest rate plus the penalty interest rate. This is detrimental to the borrower. Either the documentation should be updated to reflect the code, or the interest calculation in the code should be modified to match the documentation.