Files
papers/lux-oracle-infrastructure/sections/02-traditional-price-oracles.tex
zeekay abf99d05fc papers: reorganize into per-paper dirs, add Antje Worring as co-author
Restructured from flat .tex/.pdf files into per-paper subdirectories.
Added Antje Worring as co-author on all papers.
Synced PDFs to pdfs/ for download site.
2026-04-18 21:50:07 -07:00

83 lines
2.9 KiB
TeX

\section{Traditional Price Oracles}
\subsection{Chainlink Integration}
Lux integrates Chainlink's decentralized oracle network to leverage its extensive infrastructure of node operators and data providers. The integration follows Chainlink's aggregator pattern:
\begin{lstlisting}[caption={Chainlink Price Feed Interface}]
interface IPriceFeed {
function description() external view returns (string memory);
function aggregator() external view returns (address);
function latestAnswer() external view returns (int256);
function latestRound() external view returns (uint80);
function getRoundData(uint80 roundId)
external view returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
\end{lstlisting}
\subsection{Pyth Network Integration}
Pyth Network provides high-frequency price updates with sub-second latency, crucial for derivatives trading:
\begin{itemize}
\item \textbf{Pull-based updates}: Validators fetch prices on-demand
\item \textbf{Confidence intervals}: Each price includes uncertainty bounds
\item \textbf{Publisher diversity}: Aggregates from 70+ first-party publishers
\item \textbf{Cross-chain availability}: Native support for Lux's multi-chain architecture
\end{itemize}
\subsection{Median Aggregation Algorithm}
To ensure price reliability, Lux employs a robust median aggregation mechanism:
\begin{equation}
P_{final} = \text{median}\{P_1, P_2, ..., P_n\}
\end{equation}
Where $P_i$ represents individual price feeds. The median approach provides resistance to manipulation:
\begin{equation}
\text{Manipulation Cost} = \lceil \frac{n+1}{2} \rceil \times \text{Feed Cost}
\end{equation}
\subsection{Update Frequency and Latency}
The oracle system implements adaptive update frequencies based on market conditions:
\begin{lstlisting}[caption={Fast Price Feed Implementation}]
contract FastPriceFeed is ISecondaryPriceFeed {
uint256 public constant MAX_PRICE_DURATION = 30 minutes;
uint256 public priceDuration;
uint256 public maxPriceUpdateDelay;
struct PriceDataItem {
uint160 refPrice; // Chainlink price
uint32 refTime; // Last updated timestamp
uint32 cumulativeRefDelta; // Cumulative price delta
uint32 cumulativeFastDelta; // Fast price delta
}
function setPrice(address token, uint256 price)
external onlyUpdater {
require(block.timestamp < lastUpdatedAt + maxPriceUpdateDelay);
PriceDataItem memory data = priceData[token];
uint256 refPrice = getRefPrice(token);
uint256 deviation = getDeviation(price, refPrice);
require(deviation < maxDeviationBasisPoints);
prices[token] = price;
lastUpdatedAt = block.timestamp;
}
}
\end{lstlisting}