Orbiting Sangria Porpoise
Medium
accrueInterest() only takes into account the blockDelta
which is currentBlockNumber - accrualBlockNumberPrior
for calculating the interest payable by a borrower. It unfairly includes any duration of time for which the protocol was paused when the borrower couldn't have repaid even if they wanted to.
- Let's say Alice borrowed on a leveraged strategy on Monday at 2:00 PM
- At 2:05 PM the protocol gets paused
- Alice is now unable to repay until the protocol is unpaused since the call to
closeLeverageStrategy()
internally callsvault.repayLeverage(true)
and repayLeverage is protected by thewhenNotPaused
modifier. - According to the code, interest continues accruing during this period
- When unpaused on Tuesday at 2:05 PM, Alice would owe a full day's interest
NOTE: It's interesting to observe that while closeLeverageStrategy()
has whenNotPaused
, the regular repayBorrow() is allowed to operate even when the protocol is paused, showing the inconsistency in code implementation.
Borrowers unfairly pay interest even for the paused duration when they did not have the power to repay and close their debts.
Interest accrual should be suspended during paused periods.