Anchor Protocol
  • Home
  • Security
  • Protocol
    • Overview
    • Bonded Assets (bAssets)
      • Bonded Luna (bLuna)
      • Bonded ETH (bETH)
    • Money Market
      • Deposit Rate Subsidization
    • Loan Liquidation
    • Anchor Token (ANC)
    • Anchor Governance
      • Modify Collateral Attributes
      • Modify Market Parameters
      • Modify Liquidation Parameters
      • Modify ANC Parameters
      • Modify Governance Parameters
      • Modify Borrow Interest
      • Modify ANC Distribution
      • Community Grants
      • Text Proposal
  • User Guide
    • Interchain Transfers
    • WebApp
      • EARN
      • BORROW
      • bASSET [bLUNA]
      • bASSET [bETH]
      • GOVERN
        • ANC - UST LP Staking
        • Anchor Governance Staking
        • Claiming ANC Rewards
        • Creating and voting on proposals
  • EthAnchor
    • EthAnchor
    • EthAnchor Contracts
      • Deployed Contracts
      • Router
      • ConversionPool
      • ExchangeRateFeeder
    • Fees
  • Developers - Earn
    • Anchor Earn SDK
    • Example Usage
    • Appendix
  • xAnchor
    • xAnchor
    • xAnchor Contracts
    • xAnchor Bridge (EVM Chains)
    • xAnchor Terra-side Contracts
      • xAnchor Core
      • xAnchor Wormhole Bridge
      • Address Proxy
  • Developers - Terra
    • Anchor.js
    • AnchorCLI
  • Smart Contracts
    • Deployed Contracts
    • bLuna
      • Hub
      • Reward
      • Rewards Dispatcher
      • Validators Registry
      • Airdrop Registry
      • Tokens: bLuna and stLuna
    • bETH
      • Reward
      • Token
      • Converter
    • Money Market
      • Overseer
      • Market
      • Custody [bLUNA]
      • Custody [bETH]
      • Interest Model
      • Distribution Model
      • Oracle
    • Liquidation
      • Liquidation Contract
      • Liquidation Queue Contract
    • Anchor Token (ANC)
      • Gov
      • Staking
      • Community
      • Collector
      • Distributor
  • Developers - Ethereum [Legacy]
    • EthAnchor
    • EthAnchor Account Contract
    • EthAnchor API
      • Getting Market Information
      • Depositing Stablecoins
      • Redeeming Stablecoins
    • Fees
  • External Resources
    • Anchor WebApp
    • Anchor Protocol GitHub
    • Terra Blockchain
Powered by GitBook
On this page
  • Config
  • InstantiateMsg
  • ExecuteMsg
  • UpdateConfig
  • QueryMsg
  • Config
  • ConfigResponse
  • BorrowRate
  • BorrowRateResponse

Was this helpful?

  1. Smart Contracts
  2. Money Market

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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
    pub owner: String, 
    pub base_rate: Decimal256, 
    pub interest_multiplier: Decimal256, 
}
{
  "owner": "terra1...", 
  "base_rate": "0.000000002", 
  "interest_multiplier": "0.00000004" 
}

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.

#[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>, 
    }
}
{
  "update_config": {
    "owner": "terra1...", 
    "base_rate": "0.000000002", 
    "interest_multiplier": "0.00000004" 
  }
}

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.

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
    Config {}
}
{
  "config": {}
}

Key

Type

Description

ConfigResponse

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ConfigResponse {
    pub owner: String, 
    pub base_rate: Decimal256, 
    pub interest_multiplier: Decimal256, 
}
{
  "owner": "terra1...", 
  "base_rate": "0.000000002", 
  "interest_multiplier": "0.00000004" 
}

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.

#[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, 
    }
}
{
  "borrow_rate": {
    "market_balance": "123.456789", 
    "total_liabilities": "12.3456789", 
    "total_reserves": "1.23456789" 
  }
}

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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct BorrowRateResponse {
    pub rate: Decimal256, 
}
{
  "rate": "0.000000005" 
}

Key

Type

Description

rate

Decimal256

Calculated per-block borrow rate

PreviousCustody [bETH]NextDistribution Model

Last updated 3 years ago

Was this helpful?