Oracle
A service or contract that brings external data on-chain. Without oracles, smart contracts cannot know prices, event outcomes, or fiat-payment statuses.
Aliases: on-chain oracle, blockchain oracle
Oracle is the bridge between external data and a blockchain. A smart contract is deterministic by nature and sees only what is in state. To know the TON/USD price, the result of a sports match, or the EUR/USD rate, a contract needs an oracle — an external publisher that writes the data on-chain.
Why DeFi needs oracles
Every DeFi primitive that touches asset prices depends on an oracle:
- Lending checks whether a position is due for liquidation.
- Perpetuals compute mark price and funding rate.
- Stablecoins revalue collateral.
- Options decide whether a contract is in the money at expiry.
Without oracles, those protocols either do not function or are restricted to assets quoted purely from on-chain swaps (which limits design).
Types of oracle
- Push oracle. An off-chain operator regularly writes prices on-chain. Gas-heavy but always fresh.
- Pull oracle. Contract subscribes to an off-chain feed; the user submits signed data when calling the function (the Pyth model).
- TWAP oracle. Derives price from an on-chain DEX as a time-weighted average — manipulation-resistant but laggy.
- Aggregated. Multiple sources, median or weighted average (Chainlink, RedStone).
Manipulation and attack
If a protocol prices off a thin DEX, an attacker can briefly skew it and:
- Borrow a large amount against an overpriced collateral.
- Trigger mass liquidations by mispricing the asset.
- Drain liquidity through arbitrage.
The defence is TWAPs, median feeds, and multi-source oracles.
On TON
TON’s infrastructure has no dominant oracle like Chainlink on Ethereum. Lending and perp protocols (EVAA, Storm Trade) run their own feeds or integrate Pyth-style solutions. That means trust in the protocol partially equals trust in its oracle.
When picking a DeFi protocol on TON, look beyond the audit at oracle architecture: who runs the feed, how it resists manipulation, and what happens if publication stops.