
TEE-Secured Price Oracle
On-Demand Oracle with Sustainable Economics
Based on OutLayer — verifiable off-chain computation for NEAR Protocol
How It Works
On-Demand Pricing
Request prices when you need them. Your contract calls oracle_call() and receives fresh data via callback.
Zero Trust
All price fetching and aggregation happens exclusively inside Intel TDX enclave. No external operator ever touches raw data.
Yield-Resume Pattern
Uses NEAR yield/resume for async TEE calls. Your contract pauses, TEE fetches prices, contract resumes with data.
Custom Data Sources
Not just prices — use custom_call() to fetch any JSON from any API directly into your contract.
Direct OutLayer Integration
Your contract calls OutLayer directly — no intermediary contracts needed
Internal Architecture
How the scheduler keeps prices warm in TEE (mainnet only)
Why It's Secure
Trust comes from cryptographic proof, not from counting independent operators.
Intel TDX Enclave
WASI binary runs inside Intel Trust Domain Extensions (TDX) providing hardware-level isolation.
TEE Attestation
Workers verify via DCAP attestation. RTMR3 whitelist ensures only approved binaries can run.
Cryptographic Proof
Access keys are bound to TEE instances. If enclave is compromised, keys are lost.
Verifiable Execution
All price fetching happens in auditable, deterministic WASI code. Open source on GitHub.
Supported Tokens
13 tokens with multiple price sources for maximum reliability
Quick Start
Get Prices with Callback
Use oracle_call to request prices. Your contract will receive them via oracle_on_call callback.
near call price-oracle.near oracle_call '{
"receiver_id": "your-contract.near",
"asset_ids": ["wrap.near", "aurora"],
"msg": ""
}' --accountId your.near --deposit 0.02 --gas 200000000000000Direct Price Request
Get prices directly without callback. Useful for scripts and testing.
near call price-oracle.near request_price_data '{
"asset_ids": ["wrap.near"]
}' --accountId your.near --deposit 0.02 --gas 200000000000000Direct OutLayer Integration
Skip the oracle contract — call OutLayer directly from your contract using the price oracle project.
// Rust: Call OutLayer directly with the price oracle project
let execution_source = serde_json::json!({
"Project": { "project_id": "price-oracle.near/price-oracle" }
});
let resource_limits = serde_json::json!({
"max_instructions": 10000000000_u64,
"max_memory_mb": 128,
"max_execution_seconds": 60
});
let input_data = serde_json::json!({
"command": "get_prices", // OracleCommand enum
"tokens": ["wrap.near"] // field name is "tokens"
}).to_string();
ext_outlayer::ext("outlayer.near".parse().unwrap())
.with_attached_deposit(NearToken::from_millinear(10))
.request_execution(
execution_source, Some(resource_limits), Some(input_data),
None, Some("json".to_string()), None, None
)See full documentation for callback handling and complete examples.
About Cached Prices (view methods)
get_price_data is a free view method, but it only returns data if someone recently paid for an update. Due to the on-demand nature of this oracle, the cache is usually empty or stale — prices are fetched when needed for specific operations (liquidations, borrowing, swaps), not stored permanently.
This is by design: Unlike traditional oracles with a central price feed contract, this oracle delivers prices directly to your contract via callback. Any contract can integrate without intermediaries.
Deployed Contracts
| Contract | Mainnet |
|---|---|
| Price Oracle (ex NEAR Native Oracle) | price-oracle.near |
| Simple Oracle Wrapper | price-oracle-wrapper.near |
| Pyth-Compatible oracle | price-oracle-pyth.near |
| OutLayer Project ID | price-oracle.near/price-oracle |