InstantiateMsg, ExecuteMsg, QueryMsg, and response type. This is the contract’s API surface, what you can call and what comes back.
Live source from
contracts/oracle/src/msg.rs (76 lines). Generated from the deployed contract code.use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Addr, Uint128};
#[cw_serde]
pub struct InstantiateMsg {
/// Address authorized to call UpdatePrice. Typically the relayer's bwick1... address.
pub relayer_address: String,
/// Max acceptable age of a price reading in seconds. Queries with `require_fresh=true`
/// fail if the latest update is older than this. Sane default: 30.
pub max_age_seconds: u64,
/// Optional max history entries kept for TWAP (default 60 — at 5s polling = 5min window).
pub history_size: Option<u32>,
}
#[cw_serde]
pub enum ExecuteMsg {
/// Post a fresh price reading. Caller must be the configured relayer.
UpdatePrice {
/// BWICK/USD price in micro-USD (6 decimals). $0.0001 = 100.
bwick_usd_price: Uint128,
/// SOL/USD price in micro-USD. Stored for transparency / debugging.
sol_usd_price: Uint128,
/// Source label, e.g. "pumpfun-curve" or "raydium-pool".
source: String,
},
/// Admin: rotate the relayer address.
UpdateRelayer { relayer_address: String },
/// Admin: change max age threshold.
UpdateMaxAge { max_age_seconds: u64 },
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
/// Latest spot price. Set `require_fresh=true` to fail if stale.
#[returns(PriceResponse)]
Price { require_fresh: Option<bool> },
/// Time-weighted average over the last `window_seconds` (default 60).
/// Returns the spot price if no history is available.
#[returns(PriceResponse)]
Twap { window_seconds: Option<u64> },
/// Contract config + last update metadata.
#[returns(ConfigResponse)]
Config {},
}
#[cw_serde]
pub struct PriceResponse {
/// BWICK/USD in micro-USD (6 decimals).
pub bwick_usd_price: Uint128,
/// SOL/USD in micro-USD (informational).
pub sol_usd_price: Uint128,
/// Block height at last update.
pub last_update_height: u64,
/// Unix timestamp at last update.
pub last_update_timestamp: u64,
/// "pumpfun-curve" or "raydium-pool" or whatever the relayer reported.
pub source: String,
/// True if the latest update is within `max_age_seconds`.
pub fresh: bool,
}
#[cw_serde]
pub struct ConfigResponse {
pub admin: Addr,
pub relayer_address: Addr,
pub max_age_seconds: u64,
pub history_size: u32,
pub history_count: u32,
}
#[cw_serde]
pub struct MigrateMsg {}

