NeapDocs
Launch app
Docs · Oracles and pricing

Protocol

Oracles and pricing

Where prices come from, how the contract defends against a bad price, and what is coming for tokens on other chains.

NEAR pools: read on-chain

For a token on NEAR, the contract reads the price itself. refresh_price calls the DEX pool, and the callback computes the price from the pool's reserves and stores it as an observation. No off-chain party can supply or alter this price. Anyone can call refresh_price; the keeper does it every few seconds.

Defences against a bad price

DefenceHow it works
SmoothingThe mark follows an exponential moving average of pool reads, not a single read.
Price bandA read more than 20% away from the average is rejected, and the market drops to reduce-only.
StaircaseThe engine price walks toward the target by at most 10 bps per block on majors and 30 bps on long-tail markets. It never jumps.
Depth checkA market only activates if its source pool is deep enough.
Two-step fillsAn order can only fill on a price observed after it was requested.
OrderingObservations must be strictly newer than the last one.

When the price is old

Price ageEffect
under 10 sNormal trading.
10 s or moreOnly orders that reduce a position fill.
1 h or moreNo fills and no liquidations until a fresh price arrives.

The contract never invents a fallback price.

Price sources on testnet today

MarketSource
NEAR-PERPPushed by the Neap oracle account from public exchange prices. This is a transitional feed for the demo.
TIDE-PERPRead on-chain from Ref pool 2962 on ref-finance-101.testnet.
Markets you createRead on-chain from the pool you name.

Roadmap: tokens on other chains

NEAR cannot read a Solana pool directly. The next phase adds an oracle agent that runs inside a trusted execution environment (TEE), reads the Solana pool, and signs the price. The contract verifies the signature against keys registered on-chain before it accepts the price.

The same phase lets Solana users deposit, trade and withdraw from a Solana wallet through NEAR Intents. Funds arrive as USDC on NEAR. This is not live yet. The Solana page in the app previews the tokens.