Oracle
The Oracle contract provides real-time price feeds and market data for Amber Finance. It aggregates price information from multiple sources to ensure accurate and reliable pricing for BRTs and other assets used in lending, borrowing, and swapping operations.
Deployment
- Neutron:
neutron18l6cfm34qng2h9cvl3mxfw9zck9j5awv9jen4sa4f67x6t98y47s9vmuye
Types
type Uint128 = string
type Addr = string
type Decimal = string
type Timestamp = number
Queries
config
Returns the contract’s configuration.
{
config: {
}
}
Response:
{
data: {
address_provider: Addr
owner?: Addr | null
proposed_new_owner?: Addr | null
}
}
owner
Returns contract ownership details.
{
owner: {
}
}
Response:
{
data: {
owner?: Addr | null
proposed_new_owner?: Addr | null
}
}
price
Returns the current price for a specific asset.
{
price: {
denom: string
}
}
Response:
{
data: {
price: Decimal
last_updated: Timestamp
}
}
prices
Returns prices for multiple assets.
{
prices: {
denoms: string[]
}
}
Response:
{
data: {
prices: [
{
denom: string
price: Decimal
last_updated: Timestamp
},
...
]
}
}
all_prices
Returns all available prices.
{
all_prices: {
limit?: number | null
start_after?: string | null
}
}
Response:
{
data: {
prices: [
{
denom: string
price: Decimal
last_updated: Timestamp
},
...
]
}
}
price_source
Returns the price source configuration for a specific asset.
{
price_source: {
denom: string
}
}
Response:
{
data: {
price_source: {
pyth: {
price_feed_id: string
}
} | {
fixed: {
price: Decimal
}
} | {
astroport: {
pair_address: Addr
}
}
}
}
price_sources
Returns all price source configurations.
{
price_sources: {
limit?: number | null
start_after?: string | null
}
}
Response:
{
data: {
price_sources: [
{
denom: string
price_source: {
pyth: {
price_feed_id: string
}
} | {
fixed: {
price: Decimal
}
} | {
astroport: {
pair_address: Addr
}
}
},
...
]
}
}
emv_price
Returns the EMV (Expected Market Value) price for a specific asset.
{
emv_price: {
denom: string
}
}
Response:
{
data: {
price: Decimal
last_updated: Timestamp
}
}
Methods
update_owner
Updates the contract owner (admin only).
{
update_owner: {
new_owner: Addr
}
}
accept_ownership
Accepts ownership transfer (proposed owner only).
{
accept_ownership: {
}
}
set_price_source
Sets the price source for a specific asset (owner only).
{
set_price_source: {
denom: string
price_source: {
pyth: {
price_feed_id: string
}
} | {
fixed: {
price: Decimal
}
} | {
astroport: {
pair_address: Addr
}
}
}
}
remove_price_source
Removes the price source for a specific asset (owner only).
{
remove_price_source: {
denom: string
}
}
update_pyth_price
Updates price from Pyth oracle (authorized callers only).
{
update_pyth_price: {
price_feed_id: string
price: Decimal
conf: Decimal
expo: number
publish_time: Timestamp
}
}
Price Sources
The Oracle contract supports multiple price source types:
Pyth Oracle
- Type:
pyth
- Description: Real-time price feeds from Pyth Network
- Use Case: High-frequency, low-latency price updates
Fixed Price
- Type:
fixed
- Description: Static price values
- Use Case: Stable assets or test scenarios
Astroport DEX
- Type:
astroport
- Description: Price derived from DEX liquidity pools
- Use Case: Decentralized price discovery
Supported Assets
The Oracle provides price feeds for:
- eBTC - Ether.fi Bitcoin
- LBTC - Lombard Finance Bitcoin
- solvBTC - Solv Protocol Bitcoin
- uniBTC - Bedrock Bitcoin
- wBTC - Wrapped Bitcoin (Eureka)
- NTRN - Neutron tokens
- USDC - USD Coin
- USDT - Tether USD
Usage Examples
Get Single Price
curl -X GET "https://api.neutron.org/oracle/price" \
-H "Content-Type: application/json" \
-d '{"denom": "eBTC"}'
Get Multiple Prices
curl -X GET "https://api.neutron.org/oracle/prices" \
-H "Content-Type: application/json" \
-d '{"denoms": ["eBTC", "LBTC", "solvBTC"]}'
Get All Prices
curl -X GET "https://api.neutron.org/oracle/all_prices"
Get Price Source
curl -X GET "https://api.neutron.org/oracle/price_source" \
-H "Content-Type: application/json" \
-d '{"denom": "eBTC"}'
Integration
The Oracle contract integrates with:
- Credit Manager - Provides price data for health factor calculations
- Red Bank - Supplies collateral and debt pricing
- Swapper - Offers price feeds for swap calculations
- Health Computer - Delivers real-time pricing for risk assessment
- Frontend Applications - Displays current asset prices
Security Features
- Multi-Source Validation - Cross-references multiple price sources
- Staleness Checks - Ensures price data is recent and valid
- Access Control - Restricted price update permissions
- Fallback Mechanisms - Graceful handling of price source failures
This documentation reflects the Mars Protocol Oracle contract as deployed by Amber Finance on Neutron.