-
Notifications
You must be signed in to change notification settings - Fork 71
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
Two Prices PR #129
Two Prices PR #129
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## v2_upcoming #129 +/- ##
==============================================
Coverage ? 82.88%
==============================================
Files ? 44
Lines ? 14809
Branches ? 0
==============================================
Hits ? 12275
Misses ? 2534
Partials ? 0 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
/// Risk-adjusted upper bound market value of borrows. | ||
/// ie sum(b.borrowed_amount * max(b.current_spot_price, b.smoothed_price) * b.borrow_weight for b in borrows) | ||
pub borrowed_value_upper_bound: Decimal, | ||
/// The maximum borrow value at the weighted average loan to value ratio using the minimum of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the maximum borrow value using min of spot and smooth price times ltv of each asset
something closer to this?
let remaining_borrow_value = obligation.remaining_borrow_value()?; | ||
let remaining_borrow_value = obligation | ||
.remaining_borrow_value() | ||
.unwrap_or_else(|_| Decimal::zero()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wil just error on the next line
7a0c9c2
to
f49ff13
Compare
- Add a smoothed_market_price to Reserve that is used to limit borrows and withdraws in cases where smoothed price and spot price diverge. - allowed_borrow_value now uses the min(smoothed_market_price, current spot price) - new field on obligation called borrowed_value_upper_bound that uses max(smoothed_market_price, current spot price)
* 0xripleys outflow limits (#125) Use a sliding window rate limiter to limit borrows and withdraws at the lending pool owner's discretion. * 0xripleys borrow coefficient (#127) Add a borrow weight to the Reserve * Two Prices PR (#129) - Add a smoothed_market_price to Reserve that is used to limit borrows and withdraws in cases where smoothed price and spot price diverge. - allowed_borrow_value now uses the min(smoothed_market_price, current spot price) - new field on obligation called borrowed_value_upper_bound that uses max(smoothed_market_price, current spot price) * audit nits * audit fixes pt 2 * disable rate limiter if window duration == 0 * cli changes for v2.0.1 (#133)
Main Changes
Affected instructions
Refresh Reserve
Refresh Obligation
Withdraw Obligation Collateral + Withdraw Obligation Collateral and Redeem Reserve Liquidity
Borrow Obligation Liquidity
Note that liquidations still using current spot prices and have no dependence on the new smoothed_price value or borrowed_value_upper_bound