Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] p2p rate reverts when utilization > 100% on Compound #1674

Open
QGarchery opened this issue Mar 14, 2024 · 0 comments
Open

[Lens] p2p rate reverts when utilization > 100% on Compound #1674

QGarchery opened this issue Mar 14, 2024 · 0 comments

Comments

@QGarchery
Copy link
Collaborator

In Compound it is actually possible to borrow the reserves, in which case utilization > 100%. The computation of the p2p rate of the Compound Lens reverts if utilization > 100%. This is because the supply rate is computed as multiplying the borrow rate by the utilization, so the pool supply rate is greater than the borrow rate.

A few things to note:

  • it is not enforced that cash > reserves, where cash is simply the balance of the pool in underlying:
    • in accrueInterest, the reserves grow (by interestAccumulated * reserveFactor but the cash obv does not change
    • it is not checked in the main functions. For example, there is no such check when withdrawing
    • this effectively means you can borrow the reserves rights now, with about $16M available. I guess it's useful in events like this when the market is deprecated. But it's also a risk of loss for Compound (they could take most of those reserves now though)
  • the utilization rate's definition is borrow / (cash + borrow - reserves), which is over 100% when reserves > cash
    • note that this utilization is not just for display on the interface, and it is used in the interest rate model (piecewise linear, so no problem there, it just goes up)
    • the documentation of this function says that it cannot go over 100%
  • the total amount of underlying tokens owed to suppliers is also defined as cash + borrow - reserves, given how the exchange rate is computed
@QGarchery QGarchery self-assigned this Mar 14, 2024
@QGarchery QGarchery removed their assignment Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant