PriceOracle
ThePriceOracle is a convenience wrapper that lets anyone query asset prices by ticker symbol (e.g., "NVDA", "AAPL") instead of by token address.
Interface
Ticker Resolution
The oracle resolves tickers through theStockTokenFactory:
- Try
tokenBySymbol(ticker)— matches if the ticker is already prefixed (e.g.,"tiltNVDA") - If not found, try
tokenBySymbol("tilt" + ticker)— matches raw tickers (e.g.,"NVDA") - If neither resolves, revert with
TokenNotFound(ticker)
getTokenPrice("NVDA") and getTokenPrice("tiltNVDA") return the same result.
Price Source
Prices come from theTokenRouter.tokenPrices() mapping, which is updated by the backend price service using data aggregated from:
- Yahoo Finance
- Financial Modeling Prep (FMP)
- Alpha Vantage
192000000000000000000).
Error Handling
| Error | Cause |
|---|---|
TokenNotFound(ticker) | Ticker doesn’t resolve to any known token |
PriceNotSet(ticker) | Token exists but has no price data (price = 0) |
Dependencies
The PriceOracle references two other contracts:ITokenRouter— for readingtokenPrices(address)storageIStockTokenFactory— for resolvingtokenBySymbol(string)lookups