Oracle Contract
Key Functions
| Function | Description | Access |
|---|---|---|
getPrice(tokenId) | Returns min(spot, TWAP) for a position | View |
isFresh(tokenId) | Whether the price is within staleness window | View |
getRiskTier(tokenId) | Returns the position's risk tier (Conservative/Moderate/Risk) | View |
getLTV(tokenId) | Returns effective LTV including early-closure decay | View |
updatePrice(tokenId, spot, twap) | Update price from authorized feed | Oracle Keeper |
setAdapter(platform, adapter) | Register a new market adapter | Governance |
Price Pipeline
Oracle pipeline
Off-chain Oracle Keeper
├── Fetches spot price from PM orderbook
├── Computes TWAP from trade history
├── Signs price update
└── Submits to VarlaOracle contract
On-chain VarlaOracle
├── Verifies keeper signature
├── Stores spot + TWAP + timestamp
├── getPrice() returns min(spot, TWAP)
└── isFresh() checks timestamp < maxStaleness ℹ Keeper network
Oracle keepers are authorized off-chain agents that submit price updates. Multiple keepers provide redundancy — any authorized keeper can update prices. See Oracle System for full architecture details.