The Interest Model contract is responsible for calculating the current borrow interest rate for stablecoin loans, based on the fed in market details. The interest rate is initially set to increase proportionally with market utilization, or the stablecoin borrow demand of the Anchor Money Market.
Config
InstantiateMsg
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
pub struct InstantiateMsg {
pub owner : String ,
pub base_rate : Decimal256 ,
pub interest_multiplier : Decimal256 ,
}
Copy {
"owner" : "terra1..." ,
"base_rate" : "0.000000002" ,
"interest_multiplier" : "0.00000004"
}
ExecuteMsg
UpdateConfig
Updates the configuration of the interest model contract. This message can only be issued by the owner.
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum ExecuteMsg {
UpdateConfig {
owner : Option < String >,
base_rate : Option < Decimal256 >,
interest_multiplier : Option < Decimal256 >,
}
}
Copy {
"update_config" : {
"owner" : "terra1..." ,
"base_rate" : "0.000000002" ,
"interest_multiplier" : "0.00000004"
}
}
* = optional
QueryMsg
Config
Gets the interest model contract configuration.
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
Config {}
}
ConfigResponse
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
pub struct ConfigResponse {
pub owner : String ,
pub base_rate : Decimal256 ,
pub interest_multiplier : Decimal256 ,
}
Copy {
"owner" : "terra1..." ,
"base_rate" : "0.000000002" ,
"interest_multiplier" : "0.00000004"
}
BorrowRate
Gets the calculated per-block borrow rate, based on fed in market conditions.
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
#[serde(rename_all = "snake_case" )]
pub enum QueryMsg {
BorrowRate {
market_balance : Uint256 ,
total_liabilities : Decimal256 ,
total_reserves : Decimal256 ,
}
}
Copy {
"borrow_rate" : {
"market_balance" : "123.456789" ,
"total_liabilities" : "12.3456789" ,
"total_reserves" : "1.23456789"
}
}
BorrowRateResponse
Rust JSON
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
pub struct BorrowRateResponse {
pub rate : Decimal256 ,
}
Copy {
"rate" : "0.000000005"
}