-
Notifications
You must be signed in to change notification settings - Fork 25
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
Hiring task: Create a price-based interest rate model #24
Comments
@nourharidy according to the requirements,
|
According to the requirement, you have to respect the InterestRateModel interface (used by cTokens). It's ok to remove anything that is not in the interface. cToken address should be passed yup. cToken contract is in this repo. However, you do not need to import it in your own code. |
Added you as a collaborator to my private repo |
Background
Currently, BaseJumpRateModelV2 is used to calculate interest rates for all Anchor markets based on borrowing utilization rate of the market liquidity.
However, unlike other assets on Anchor, DOLA is a stablecoin that's originally minted on Anchor. Interest rates should be set not based on liqudity utilization, but rather based on the DOLA's $1 USD peg. If DOLA is <$1, then DOLA supply should be reduced in order to meet the decrease in demand. Therefore, DOLA interest rate should rise in order to incentivize borrower repayments, reducing the supply in circulation. If DOLA is >$1, then supply should be increased in order to meet increased demand. Therefore, interest rates should be decreased in order to incentivize more borrows, expanding supply in circulation.
Right now, we use a contract called the Fed in order to mint or redeem DOLA in the Anchor DOLA market in order to increase or reduce the interest rate. However, this requires manual intervention by an operator who doesn't always respond to DOLA price changes in time.
Requirements
baseRate
provided by the owner in the constructor and can be changed using a setter function.updateRate()
function that is callable by anyone.negativeDepegThreshold
price, increase the borrow rate by a fixed valuerateStep
up to a maximummaxRate
.positiveDepegThreshold
price, decrease the borrow rate by the samerateStep
down to a minimumminRate
.baseRate
, decrease or increase the borrow rate to the direction ofbaseRate
byrateStep
e.g. if the borrow rate is higher thanbaseRate
, the borrow rate would decrease byrateStep
on each function call until it reachesbaseRate
.updateRateInterval
seconds ago. However, it should NOT revert otherwise. This is in order to allow other contracts to call it without causing them to fail.cToken.accrueInterest()
in order to update the market contract.feed
contract. SeeIFeed
interface here as an example.The text was updated successfully, but these errors were encountered: