0xripleys borrow coefficient - #127
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 @@
## 0xripleys_outflow_limits #127 +/- ##
============================================================
+ Coverage 80.86% 81.62% +0.76%
============================================================
Files 42 43 +1
Lines 13373 13896 +523
============================================================
+ Hits 10814 11343 +529
+ Misses 2559 2553 -6
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
i still think it would be better to just do 1 + borrow weight so there isn't a need to rely on checks like this. is there a strong reason not to? also I guess i wonder if this needs to be basis point precision rather than just percent precision |
i don't have a strong opinion. i guess as long as we use the borrow_weight() function directly, the dangers are minimized anyways. your call
hmm i guess not really lol. kinda annoying that Decimal::from_pct accepts a u8, but w/e i guess i could change that |
f03e923 to
0db6403
Compare
Add a borrow weight to the Reserve
* 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)
Summary:
Add a borrow weight to the Reserve
before, borrowed value in usd was calculated by
now, we do:
Borrow weight is always greater than 1.
Purpose: If some reserve R is at 100% util, then any liquidator who liquidates an obligation that's collateralized by R will receive cTokens, which is undesirable. With this change, when reserve util is close to or at 100%, Solend plans to increase the borrow weight. This in turn will cause liquidations to happen, and reserve util will eventually decrease.
Affected instructions
Testing