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

high rate map #86

Merged
merged 2 commits into from
May 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
high rate map
  • Loading branch information
nope-finance committed May 26, 2022
commit a85a4262f90d776a357e68d7b287107702dcb8a1
11 changes: 11 additions & 0 deletions token-lending/program/src/state/reserve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ impl Reserve {

Ok(normalized_rate.try_mul(rate_range)?.try_add(min_rate)?)
} else {
if self.config.optimal_borrow_rate == self.config.max_borrow_rate {
let rate = Rate::from_percent(50u8);
return Ok(match self.config.max_borrow_rate {
251u8 => rate.try_mul(6)?, //300%
252u8 => rate.try_mul(7)?, //350%
253u8 => rate.try_mul(8)?, //400%
254u8 => rate.try_mul(10)?, //500%
255u8 => rate.try_mul(12)?, //600%
_ => Rate::from_percent(self.config.max_borrow_rate),
});
}
let normalized_rate = utilization_rate
.try_sub(optimal_utilization_rate)?
.try_div(Rate::from_percent(
Expand Down