Skip to content

Conversation

peer2f00l
Copy link
Collaborator

@peer2f00l peer2f00l commented Mar 6, 2025

Introduces InterestRateStrategy which provides a few different strategies:

  • Linear takes two parameters: the minimum interest rate (at 0% usage) and the maximum interest rate (at 100% usage) and linearly interpolates between them.

$$ r(u) = (t - b)u + b $$

  • Piecewise takes four parameters: the base rate, the optimal usage ratio, and two slopes: one for 0%<->optimal%, and the other for optimal%<->100%.

$$ r(u) = \begin{cases} r_{1} u + b & \text{if } u < o \\ r_{2} u + o ( r_{1} - r_{2} ) + b \\ \end{cases} $$

  • Exponential2 takes three parameters, and implements this function:

$$ r(u) = (t - b) \frac{2^{ku} - 1}{2^{k} - 1} + b $$

Additionally:

  • Renames logs -> snapshots.
  • Improved snapshot processing: simpler, linear algorithm.
  • Contract self-reports interest and yield rates with two new functions: get_last_interest_rate and get_last_yield_rate.

	- Everything is async, so we have to implement some asset locking (`borrow_asset_in_flight`, not yet implemented)
	- Some updates to requesting current balance: let's just go with making everything a return value.
	- Will also need to implement borrow record locking.
…sset_usage_ratio

`maximum_borrow_asset_usage_ratio`
Base automatically changed from dev/fresh_start to main March 7, 2025 02:10
@peer2f00l peer2f00l changed the base branch from main to dev March 7, 2025 02:28
Copy link

github-actions bot commented Mar 7, 2025

Staging contract is deployed to gh-34.templar-in-training.testnet account

Copy link

github-actions bot commented Mar 8, 2025

Staging contract is deployed to gh-34.templar-in-training.testnet account

Copy link

Staging contract is deployed to gh-34.templar-in-training.testnet account

@peer2f00l peer2f00l requested a review from SmolinPavel March 10, 2025 13:51
Copy link

Staging contract is deployed to gh-34.templar-in-training.testnet account

@peer2f00l peer2f00l closed this Mar 10, 2025
@peer2f00l peer2f00l reopened this Mar 10, 2025
Copy link

Staging contract is deployed to gh-34.templar-in-training.testnet account

Copy link

Staging contract is deployed to gh-34.templar-in-training.testnet account

@peer2f00l peer2f00l enabled auto-merge (squash) March 10, 2025 16:04
@peer2f00l peer2f00l merged commit b6d4156 into dev Mar 10, 2025
4 checks passed
@peer2f00l peer2f00l deleted the 24-interest-rate-modeling branch March 10, 2025 16:41
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

Successfully merging this pull request may close these issues.

Interest rate modeling

2 participants