Overseer
The Overseer contract is responsible for storing key protocol parameters and the whitelisting of new bAsset collaterals. The borrow limit of users are calculated here, as the Overseer keeps track of locked collateral amounts for all users.
This contract is the recipient for collected bAsset rewards claimed by Custody contracts. The Overseer calculates the amount of depositor subsidies that has to be distributed, and the resulting amount is sent to the Market contract.
The Overseer halts borrow-related operations if the Oracle's price data is older than 60 seconds (price_timeframe). Operations are resumed when new price data is fed-in.

Config

Key
Type
Description
owner_addr
CanonicalAddr
Address of contract owner that can update config
oracle_contract
CanonicalAddr
Contract address of Oracle
market_contract
CanonicalAddr
Contract address of Market
liquidation_contract
CanonicalAddr
Contract address of Liquidation Contract
collector_contract
CanonicalAddr
Contract address of Collector
stable_denom
String
Native token denomination for stablecoin
epoch_period
u64
Minimum time delay between epoch operations [blocks]
threshold_deposit_rate
Decimal256
Threshold per-block deposit rate before triggering interest buffer distribution
target_deposit_rate
Decimal256
Target per-block stablecoin deposit rate of Anchor
buffer_distribution_factor
Decimal256
Maximum portion of interest buffer that can be distributed in an epoch
anc_purchase_factor
Decimal256
Portion of bAsset rewards used to purchase ANC
price_timeframe
u64
Window of time before price data is considered outdated [seconds]

InstantiateMsg

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub struct InstantiateMsg {
4
pub owner_addr: String,
5
pub oracle_contract: String,
6
pub market_contract: String,
7
pub liquidation_contract: String,
8
pub collector_contract: String,
9
pub stable_denom: String,
10
pub epoch_period: u64,
11
pub threshold_deposit_rate: Decimal256,
12
pub target_deposit_rate: Decimal256,
13
pub buffer_distribution_factor: Decimal256,
14
pub anc_purchase_factor: Decimal256,
15
pub price_timeframe: u64,
16
}
Copied!
1
{
2
"owner_addr": "terra1...",
3
"oracle_contract": "terra1...",
4
"market_contract": "terra1...",
5
"liquidation_contract": "terra1...",
6
"collector_contract": "terra1...",
7
"stable_denom": "uusd",
8
"epoch_period": 86400,
9
"threshold_deposit_rate": "0.1",
10
"target_deposit_rate": "0.15",
11
"buffer_distribution_factor": "0.1",
12
"anc_purchase_factor": "0.5",
13
"price_timeframe": 60
14
}
Copied!
Key
Type
Description
owner_addr
String
Address of contract owner that can update config
oracle_contract
String
Contract address of Oracle
market_contract
String
Contract address of Market
liquidation_contract
String
Contract address of Liquidation Contract
collector_contract
String
Contract address of Collector
stable_denom
String
Native token denomination for stablecoin
epoch_period
u64
Minimum time delay between epoch operations [blocks]
threshold_deposit_rate
Decimal256
Threshold per-block deposit rate to trigger interest buffer distribution
target_deposit_rate
Decimal256
Target per-block stablecoin deposit rate of Anchor
buffer_distribution_factor
Decimal256
Maximum portion of interest buffer that can be distributed in an epoch
anc_purchase_factor
Decimal256
Portion of bAsset rewards used to purchase ANC
price_timeframe
u64
Window of time before price data is considered outdated [seconds]

ExecuteMsg

UpdateConfig

Updates the configuration of the contract. 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_addr: Option<String>,
6
oracle_contract: Option<String>,
7
liquidation_contract: Option<String>,
8
threshold_deposit_rate: Option<Decimal256>,
9
target_deposit_rate: Option<Decimal256>,
10
buffer_distribution_factor: Option<Decimal256>,
11
anc_purchase_factor: Option<Decimal256>,
12
epoch_period: Option<u64>,
13
price_timeframe: Option<u64>,
14
}
15
}
Copied!
1
{
2
"update_config": {
3
"owner_addr": "terra1...",
4
"oracle_contract": "terra1...",
5
"liquidation_contract": "terra1...",
6
"threshold_deposit_rate": "0.1",
7
"target_deposit_rate": "0.15",
8
"buffer_distribution_factor": "0.1",
9
"anc_purchase_factor": "0.5",
10
"epoch_period": 86400,
11
"price_timeframe": 60
12
}
13
}
Copied!
Key
Type
Description
owner_addr*
String
Address of new contract owner
oracle_contract*
String
Contract address of new Oracle
liquidation_contract*
String
Contract address of new Liquidation Contract
threshold_deposit_rate*
Decimal256
New threshold per-block deposit rate to trigger interest buffer distribution
target_deposit_rate*
Decimal256
New target per-block stablecoin deposit rate of Anchor
buffer_distribution_factor*
Decimal256
New maximum portion of interest buffer that can be distributed in an epoch
anc_purchase_factor*
Decimal256
New portion of bAsset rewards used to purchase ANC
epoch_period*
u64
New minimum time delay between epoch operations [blocks]
price_timeframe*
u64
New window of time before price data is considered outdated [seconds]
* = optional

Whitelist

Whitelists a new collateral accepted in the money market. 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
Whitelist {
5
name: String,
6
symbol: String,
7
collateral_token: String,
8
custody_contract: String,
9
max_ltv: Decimal256,
10
}
11
}
Copied!
1
{
2
"whitelist": {
3
"name": "bonded luna",
4
"symbol": "ubluna",
5
"collateral_token": "terra1...",
6
"custody_contract": "terra1...",
7
"max_ltv": "0.75"
8
}
9
}
Copied!
Key
Type
Description
name
String
Name of collateral bAsset
symbol
String
Token symbol of collateral bAsset
collateral_token
String
Cw20 token contract address of collateral
custody_contract
String
Custody contract address of collateral
max_ltv
Decimal256
Maximum loan-to-value ratio allowed for collateral

UpdateWhitelist

Updates information for an already whitelisted collateral. 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
UpdateWhitelist {
5
collateral_token: String,
6
custody_contract: Option<String>,
7
max_ltv: Option<Decimal256>,
8
}
9
}
Copied!
1
{
2
"update_whitelist": {
3
"collateral_token": "terra1...",
4
"custody_contract": "terra1...",
5
"max_ltv": "0.75"
6
}
7
}
Copied!
Key
Type
Description
collateral_token
String
Cw20 token contract address of collateral
custody_contract*
String
New Custody contract address of collateral
max_ltv*
Decimal256
New maximum loan-to-value ratio allowed for collateral
* = optional

ExecuteEpochOperations

Executes epoch operations. Distributes interest buffers if necessary, and requests Custody contracts to claim bAsset rewards and distribute depositor subsidies.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
ExecuteEpochOperations {}
5
}
Copied!
1
{
2
"execute_epoch_operations": {}
3
}
Copied!
Key
Type
Description

[Internal] UpdateEpochState

Updates state related to epoch operations. Can only be issued by Overseer.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
UpdateEpochState {
5
interest_buffer: Uint256,
6
distributed_interest: Uint256,
7
}
8
}
Copied!
1
{
2
"update_epoch_state": {
3
"interest_buffer": "100000000",
4
"distributed_interest": "100000000"
5
}
6
}
Copied!
Key
Type
Description
interest_buffer
Uint256
Amount of yield reserve left after distributing subsidies
distributed_interest
Uint256
Amount of depositor subsidies distributed in this epoch

LockCollateral

Locks specified amount of collateral deposited by message sender. Requests Custody contracts to reduce spendable collateral balance.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
LockCollateral {
5
collaterals: TokensHuman,
6
}
7
}
8
9
pub type TokensHuman = Vec<(String, Uint256)>;
Copied!
1
{
2
"lock_collateral": {
3
"collaterals": [
4
["terra1...", "100000000"], // (CW20 contract address, Amount to lock)
5
["terra1...", "100000000"]
6
]
7
}
8
}
Copied!
Key
Type
Description
collaterals
TokensHuman
List of collaterals and their lock amounts
Key
Type
Description
TokensHuman
Vec<(String, Uint256)>
Vector of (Collateral token address, Amount to lock)

UnlockCollateral

Unlocks specified amount of collateral unlocked by message sender. Requests Custody contracts to increase spendable collateral balance.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
UnlockCollateral {
5
collaterals: TokensHuman,
6
}
7
}
8
9
pub type TokensHuman = Vec<(String, Uint256)>;
Copied!
1
{
2
"unlock_collateral": {
3
"collaterals": [
4
["terra1...", "100000000"], // (CW20 contract address, Amount to unlock)
5
["terra1...", "100000000"]
6
]
7
}
8
}
Copied!
Key
Type
Description
collaterals
TokensHuman
List of collaterals and their unlock amounts
Key
Type
Description
TokensHuman
Vec<(String, Uint256)>
Vector of (Collateral token address, Amount to lock)

LiquidateCollateral

Liquidates loan position of the specified borrower. Requests Custody contracts to process collateral liquidation.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum ExecuteMsg {
4
LiquidateCollateral {
5
borrower: String,
6
}
7
}
Copied!
1
{
2
"liquidate_collateral": {
3
"borrower": "terra1..."
4
}
5
}
Copied!
Key
Type
Description
borrower
String
Address of borrower to liquidate loan position

QueryMsg

Config

Gets the configuration of the Overseer contract.
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_addr: String,
4
pub oracle_contract: String,
5
pub market_contract: String,
6
pub liquidation_contract: String,
7
pub collector_contract: String,
8
pub threshold_deposit_rate: Decimal256,
9
pub target_deposit_rate: Decimal256,
10
pub buffer_distribution_factor: Decimal256,
11
pub anc_purchase_factor: Decimal256,
12
pub stable_denom: String,
13
pub epoch_period: u64,
14
pub price_timeframe: u64,
15
}
Copied!
1
{
2
"owner_addr": "terra1...",
3
"oracle_contract": "terra1...",
4
"market_contract": "terra1...",
5
"liquidation_contract": "terra1...",
6
"collector_contract": "terra1...",
7
"distribution_threshold": "0.1",
8
"target_deposit_rate": "0.15",
9
"buffer_distribution_rate": "0.1",
10
"anc_purchase_factor": "0.5",
11
"stable_denom": "uusd",
12
"epoch_period": 86400,
13
"price_timeframe": 60
14
}
Copied!
Key
Type
Description
owner_addr
String
Address of contract owner
oracle_contract
String
Contract address of Oracle
market_contract
String
Contract address of Market
liquidation_contract
String
Contract address of Liquidation Contract
collector_contract
String
Contract address of Collector
threshold_deposit_rate
Decimal256
Threshold per-block deposit rate before triggering interest buffer distribution
target_deposit_rate
Decimal256
Target per-block stablecoin deposit rate of Anchor
buffer_distribution_factor
Decimal256
Maximum portion of interest buffer that can be distributed in an epoch
anc_purchase_factor
Decimal256
Portion of bAsset rewards used to purchase ANC
stable_denom
String
Native token denomination for stablecoin
epoch_period
u64
Minimum time delay between epoch operations [blocks]
price_timeframe
u64
Window of time before price data is considered outdated [seconds]

EpochState

Gets information related to the current epoch.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
EpochState {}
5
}
Copied!
1
{
2
"epoch_state": {}
3
}
Copied!
Key
Type
Description

EpochStateResponse

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct EpochState {
3
pub deposit_rate: Decimal256,
4
pub prev_aterra_supply: Uint256,
5
pub prev_exchange_rate: Decimal256,
6
pub prev_interest_buffer: Uint256,
7
pub last_executed_height: u64,
8
}
Copied!
1
{
2
"deposit_rate": "0.13",
3
"prev_aterra_supply": "100000000",
4
"prev_exchange_rate": "1.2",
5
"prev_interest_buffer": "100000000",
6
"last_executed_height": 123456
7
}
Copied!
Key
Type
Description
deposit_rate
Decimal256
Average per-block deposit rate during the last epoch
prev_aterra_supply
Uint256
Total aTerra supply at when epoch operations were last executed
prev_exchange_rate
Decimal256
aTerra exchange rate when epoch operations were last executed
prev_interest_buffer
Uint256
Amount of yield reserves when epoch operations were last executed
last_executed_height
u64
Block number when epoch operations were last executed

Whitelist

Gets information about the specified collateral if the collateral_token field is filled. Gets information about all collaterals if the collateral_token field is not filled.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
Whitelist {
5
collateral_token: Option<String>,
6
start_after: Option<String>,
7
limit: Option<u32>,
8
}
9
}
Copied!
1
{
2
"whitelist": {
3
"collateral_token": null,
4
"start_after": "terra1...",
5
"limit": 3
6
}
7
}
Copied!
Key
Type
Description
collateral_token*
String
Cw20 Token address of collateral to query information
start_after*
String
Collateral Cw20 Token address to start query
limit*
u32
Maximum number of query entries
* = optional

WhitelistResponse

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct WhitelistResponse {
3
pub elems: Vec<WhitelistResponseElem>,
4
}
5
6
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
7
pub struct WhitelistResponseElem {
8
pub name: String,
9
pub symbol: String,
10
pub max_ltv: Decimal256,
11
pub custody_contract: String,
12
pub collateral_token: String,
13
}
Copied!
1
{
2
"elems": [
3
{
4
"name": "bonded luna",
5
"symbol": "ubluna",
6
"max_ltv": "0.5",
7
"custody_contract": "terra1...",
8
"collateral_token": "terra1..."
9
},
10
{
11
"name": "bonded atom",
12
"symbol": "ubatom",
13
"max_ltv": "0.4",
14
"custody_contract": "terra1...",
15
"collateral_token": "terra1..."
16
}
17
]
18
}
Copied!
Key
Type
Description
elems
Vec<WhitelistResponseElem>
Vector of whitelisted collateral information
Key
Type
Description
name
String
Name of bAsset collateral
symbol
String
Token symbol of bAsset collateral
max_ltv
Decimal256
Loan-to-value ratio allowed for collateral
custody_contract
String
Custody contract address of this collateral
collateral_token
String
Cw20 Token contract address of this collateral

Collaterals

Gets locked collateral information for the specified borrower.
Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
#[serde(rename_all = "snake_case")]
3
pub enum QueryMsg {
4
Collaterals {
5
borrower: String,
6
}
7
}
Copied!
1
{
2
"collaterals": {
3
"borrower": "terra1..."
4
}
5
{
Copied!
Key
Type
Description
borrower
String
Address of borrower that locked collateral

CollateralsResponse

Rust
JSON
1
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
2
pub struct CollateralsResponse {
3
pub borrower: String,
4
pub collaterals: TokensHuman,
5
}
6
7
pub type TokensHuman = Vec<(String, Uint256)>;
Copied!
1
{