| Crates.io | moneymarket-overseer |
| lib.rs | moneymarket-overseer |
| version | 0.1.0 |
| created_at | 2025-08-08 09:07:05.327134+00 |
| updated_at | 2025-08-08 09:07:05.327134+00 |
| description | A MoneyMarket custody contract - handles over loan management |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1786465 |
| size | 131,119 |
The Overseer contract is responsible for storing key protocol parameters and the whitelisting of new bAsset collaterals. The Overseer keeps track of locked collateral amounts and calculates the borrow limits for each user.
This contract is the recipient for collected bAsset rewards claimed by Custody contracts. The Overseer calculates the amount of depositor subsidies 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.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct InstantiateMsg {
pub owner_addr: String, // Owner address
pub oracle_contract: String, // Oracle contract address
pub market_contract: String, // Market contract address
pub liquidation_contract: String, // Liquidation model contract address
pub collector_contract: String, // Collector contract address
pub stable_contract: String, // Stable contract address
pub epoch_period: u64, // # of blocks per epoch period
pub price_timeframe: u64, // Window of time before price data is considered outdated (in seconds)
}
{
"owner_addr": "terra1...",
"oracle_contract": "terra1...",
"market_contract": "terra1...",
"liquidation_contract": "terra1...",
"collector_contract": "terra1...",
"stable_contract": "terra1...",
"epoch_period": "86400",
"price_timeframe": "60"
}
Updates the configuration of the contract. Can only be issued by the owner.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[allow(clippy::large_enum_variant)]
pub enum ExecuteMsg {
UpdateConfig {
owner_addr: Option<String>, // New owner address
oracle_contract: Option<String>, // New oracle contract address
liquidation_contract: Option<String>, // New liquidation contract address
epoch_period: Option<u64>, // # of blocks per epoch period
price_timeframe: Option<u64>, // Window of time before price data is considered outdated (in seconds)
},
}
{
"update_config": {
"owner_addr": "terra1...",
"oracle_contract": "terra1...",
"liquidation_contract": "terra1...",
"epoch_period": "86400",
"price_timeframe": "60",
}
}
Create new custody contract for the given collateral token. Can only be issued by the owner.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[allow(clippy::large_enum_variant)]
pub enum ExecuteMsg {
Whitelist {
name: String, // bAsset name
symbol: String, // bAsset symbol
collateral_token: String, // bAsset token contract
custody_contract: String, // bAsset custody contract
max_ltv: Decimal256, // Maximum loan To Value ratio
},
}
{
"whitelist": {
"name": "LunaX",
"symbol": "lunax",
"collateral_token": "terra1...",
"custody_contract": "terra1...",
"max_ltv": "0.75"
}
}
Update registered whitelist info. Can only be issued by the owner.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[allow(clippy::large_enum_variant)]
pub enum ExecuteMsg {
UpdateWhitelist {
collateral_token: String, // Liquid asset token contract
custody_contract: Option<String>, // Liquid asset custody contract
max_ltv: Option<Decimal256>, // Loan To Value ratio
},
}
{
"update_whitelist": {
"collateral_token": "terra1...",
"custody_contract": "terra1...",
"max_ltv": "0.75"
}
}
Claims all staking rewards from the bAsset contracts and also do a epoch basis updates:
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[allow(clippy::large_enum_variant)]
pub enum ExecuteMsg {
ExecuteEpochOperations {}
}
{
"execute_epoch_operations": {}
}
Locks specified amount of collateral deposited.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[allow(clippy::large_enum_variant)]
pub enum ExecuteMsg {
LockCollateral {
collaterals: TokensHuman, // List of collaterals and their lock amounts
}
}
pub type TokensHuman = Vec<(String, Uint256)>; // Vector of (Collateral token, Amount to lock)
{
"lock_collateral": {
"collaterals": [
["terra1...", "100000000"], // <(Collateral Token, Amount)>
]
}
}
Unlocks specified amount of collateral unlocked.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[allow(clippy::large_enum_variant)]
pub enum ExecuteMsg {
UnlockCollateral {
collaterals: TokensHuman, // List of collaterals and their lock amounts
}
}
pub type TokensHuman = Vec<(String, Uint256)>; // Vector of (Collateral token, Amount to lock)
{
"unlock_collateral": {
"collaterals": [
["terra1...", "100000000"], // <(Collateral Token, Amount)>
]
}
}
Liquidates loan position of the specified borrower.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[allow(clippy::large_enum_variant)]
pub enum ExecuteMsg {
LiquidateCollateral {
borrower: String, // Borrower address
}
}
{
"liquidate_collateral": {
"borrower": "terra1..."
}
}
Gets Overseer contract configuration.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Config {}
}
{
"config": {}
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct ConfigResponse {
pub owner_addr: String, // Owner address
pub oracle_contract: String, // Oracle contract address
pub market_contract: String, // Market contract address
pub liquidation_contract: String, // Liquidation contract address
pub collector_contract: String, // Collector contract address
pub stable_contract: String, // Stable contract address
pub epoch_period: u64, // # of blocks per epoch period
pub price_timeframe: u64, // Window of time before price data is considered outdated (in seconds)
}
{
"owner_addr": "terra1...",
"oracle_contract": "terra1...",
"market_contract": "terra1...",
"liquidation_contract": "terra1...",
"collector_contract": "terra1...",
"stable_contract": "terra1...",
"epoch_period": "86400",
"price_timeframe": "60"
}
Gets information of the current epoch.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
EpochState {}
}
{
"epoch_state": {}
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct EpochState {
pub deposit_rate: Decimal256,
pub prev_stable_supply: Uint256,
pub prev_exchange_rate: Decimal256,
pub prev_interest_buffer: Uint256,
pub last_executed_height: u64, // Block number when epoch operations were last executed
}
{
"deposit_rate": "0.13",
"prev_stable_supply": "1000000",
"prev_exchange_rate": "1.2",
"prev_interest_buffer": "1000000",
"last_executed_height": "123456"
}
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.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Whitelist {
collateral_token: Option<String>, // Cw20 Token address of collateral to query information
start_after: Option<String>, // Collateral Cw20 Token address to start query
limit: Option<u32>, // Maximum number of query entries
}
}
{
"whitelist": {
"collateral_token": null,
"start_after": "terra1...",
"limit": "3"
}
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct WhitelistResponse {
pub elems: Vec<WhitelistResponseElem>, // Vector of whitelisted collateral information
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct WhitelistResponseElem {
pub name: String, // Name of liquid asset collateral
pub symbol: String, // Token symbol of liquid asset collateral
pub max_ltv: Decimal256, // Loan-to-value ratio allowed for collateral
pub custody_contract: String, // Custody contract address of this collateral
pub collateral_token: String, // Cw20 Token contract address of this collateral
}
{
"elems": [
{
"name": "LunaX",
"symbol": "lunax",
"max_ltv": "0.5",
"custody_contract": "terra1...",
"collateral_token": "terra1..."
},
{
"name": "bonded atom",
"symbol": "ubatom",
"max_ltv": "0.4",
"custody_contract": "terra1...",
"collateral_token": "terra1..."
}
]
}
Gets locked collateral information for the specified borrower.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Collaterals {
borrower: String, // Borrower address
}
}
{
"collaterals": {
"borrower": "terra1..."
}
{
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct CollateralsResponse {
pub borrower: String, // Borrower address
pub collaterals: TokensHuman, // List of collaterals and locked amounts
}
pub type TokensHuman = Vec<(String, Uint256)>; // <(Collateral Token, Amount)>
{
"borrower": "terra1...",
"collaterals": [
["terra1...", "100000000"], // <(Collateral Token, Amount)>
]
}
Gets locked collateral information for all borrowers.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
AllCollaterals {
start_after: Option<String>, // Borrower address of start query
limit: Option<u32>, // Maximum number of query entries
}
}
{
"all_collaterals": {
"start_after": "terra1...",
"limit": 8
}
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct AllCollateralsResponse {
pub all_collaterals: Vec<CollateralsResponse>, // List of collaterals and locked amounts
}
{
"all_collaterals": [
{
"borrower": "terra1...",
"collaterals": [
["terra1...", "100000000"], // <(Collateral Token, Amount)>
]
},
{
"borrower": "terra1...",
"collaterals": [
["terra1...", "100000000"], // <(Collateral Token, Amount)>
]
}
]
}
Gets the borrow limit for the specified borrower.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
BorrowLimit {
borrower: String, // Borrow address
block_time: Option<u64>, // Current block timestamp
}
}
{
"borrow_limit": {
"borrower": "terra1...",
"block_time": "123456"
}
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct BorrowLimitResponse {
pub borrower: String, // Borrow address
pub borrow_limit: Uint128, // Borrow limit
}
{
"borrower": "terra1...",
"borrow_limit": "10000000",
}