Skip to content

Query Operations

Obligations

get_user_obligation

Get a user's obligation (deposits, collateral, borrows). Works for all obligation types (standard, earn, looping, etc.) via the ObligationKey seed.

rust
fn get_user_obligation(user: ObligationKey) -> Result<Obligation, MCError>
typescript
get_user_obligation: (
  {user}: {user: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<Obligation>>>

Pools

get_pool

Get pool state and configuration.

rust
fn get_pool(pool_address: Address) -> Result<Pool, MCError>
typescript
get_pool: (
  {pool_address}: {pool_address: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<Pool>>>

get_pool_data

Get pool data with computed APYs, token rates, and oracle price.

rust
fn get_pool_data(pool_address: Address) -> Result<PoolData, MCError>
typescript
get_pool_data: (
  {pool_address}: {pool_address: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<PoolData>>>

get_all_pools

Get all pool addresses registered in the market.

rust
fn get_all_pools() -> Vec<Address>
typescript
get_all_pools: (
  options?: MethodOptions
) => Promise<AssembledTransaction<Array<string>>>

get_oracle_price_decimals

Get the number of decimals used by oracle prices (typically 14).

rust
fn get_oracle_price_decimals() -> u32
typescript
get_oracle_price_decimals: (
  options?: MethodOptions
) => Promise<AssembledTransaction<u32>>

Market

get_global_state

Get the market's global configuration and status.

rust
fn get_global_state() -> GlobalState
typescript
get_global_state: (
  options?: MethodOptions
) => Promise<AssembledTransaction<GlobalState>>

get_market_data

Get comprehensive market data including all pools with computed APYs. Intended to be used as a simulation call.

rust
fn get_market_data() -> Result<MarketData, MCError>
typescript
get_market_data: (
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<MarketData>>>

Returns a MarketData struct containing pools_data, global_state, and oracle_price_decimals.


Refresh (Interest Accrual)

refresh_pool

Manually accrue interest on a pool. Permissionless.

rust
fn refresh_pool(pool_address: Address) -> Result<(), MCError>
typescript
refresh_pool: (
  {pool_address}: {pool_address: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>

refresh_obligation

Accrue interest on all pools that a user's obligation has open positions in. Works for all obligation types via the ObligationKey seed. Permissionless.

rust
fn refresh_obligation(user: ObligationKey) -> Result<(), MCError>
typescript
refresh_obligation: (
  {user}: {user: string},
  options?: MethodOptions
) => Promise<AssembledTransaction<Result<void>>>