Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 1.78 KB

064.md

File metadata and controls

22 lines (15 loc) · 1.78 KB

Orbiting Sangria Porpoise

Medium

Interest charged to borrower even when protocol is paused

Description

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 calls vault.repayLeverage(true) and repayLeverage is protected by the whenNotPaused 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.

Impact

Borrowers unfairly pay interest even for the paused duration when they did not have the power to repay and close their debts.

Mitigation

Interest accrual should be suspended during paused periods.