Interest Model
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

Key
Type
Description
owner
CanonicalAddr
Address of contract owner that can update model configuration
base_rate
Decimal256
Minimum per-block interest rate applied to borrows
interest_multiplier
Decimal256
Multiplier between utilization ratio and per-block borrow rate

InstantiateMsg

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct InstantiateMsg {
3
pub owner: String,
4
pub base_rate: Decimal256,
5
pub interest_multiplier: Decimal256,
6
}
Copied!
1
{
2
"owner": "terra1...",
3
"base_rate": "0.000000002",
4
"interest_multiplier": "0.00000004"
5
}
Copied!
Key
Type
Description
owner
String
Address of contract owner that can update model parameters
base_rate
Decimal256
Minimum per-block interest rate applied to borrows
interest_multiplier
Decimal256
Multiplier between utilization ratio and per-block borrow rate

ExecuteMsg

UpdateConfig

Updates the configuration of the interest model contract. This message can only be issued by the owner.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
UpdateConfig {
5
owner: Option<String>,
6
base_rate: Option<Decimal256>,
7
interest_multiplier: Option<Decimal256>,
8
}
9
}
Copied!
1
{
2
"update_config": {
3
"owner": "terra1...",
4
"base_rate": "0.000000002",
5
"interest_multiplier": "0.00000004"
6
}
7
}
Copied!
Key
Type
Description
owner*
String
Address of new owner
base_rate*
Decimal256
New minimum per-block borrow rate
interest_multiplier*
Decimal256
New borrow rate multiplier
* = optional

QueryMsg

Config

Gets the interest model contract configuration.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
Config {}
5
}
Copied!
1
{
2
"config": {}
3
}
Copied!
Key
Type
Description

ConfigResponse

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct ConfigResponse {
3
pub owner: String,
4
pub base_rate: Decimal256,
5
pub interest_multiplier: Decimal256,
6
}
Copied!
1
{
2
"owner": "terra1...",
3
"base_rate": "0.000000002",
4
"interest_multiplier": "0.00000004"
5
}
Copied!
Key
Type
Description
owner
String
Address of contract owner
base_rate
Decimal256
Minimum per-block borrow rate
interest_multiplier
Decimal256
Borrow rate multiplier

BorrowRate

Gets the calculated per-block borrow rate, based on fed in market conditions.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
BorrowRate {
5
market_balance: Uint256,
6
total_liabilities: Decimal256,
7
total_reserves: Decimal256,
8
}
9
}
Copied!
1
{
2
"borrow_rate": {
3
"market_balance": "123.456789",
4
"total_liabilities": "12.3456789",
5
"total_reserves": "1.23456789"
6
}
7
}
Copied!
Key
Type
Description
market_balance
Uint256
Stablecoin balance of Market
total_liabilities
Decimal256
Total amount of borrower liabilities
total_reserves
Decimal256
Amount of Market contract reserves

BorrowRateResponse

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct BorrowRateResponse {
3
pub rate: Decimal256,
4
}
Copied!
1
{
2
"rate": "0.000000005"
3
}
Copied!
Key
Type
Description
rate
Decimal256
Calculated per-block borrow rate
Last modified 17d ago