Oracle Solutions
What is an oracle?
Within the context of borrowing and lending, oracles are an essential part of the infrastructure. In particular, Oracles are needed to correctly price an asset, as asset prices are not directly available on the blockchain.
In this context, oracles usually work in the following manner: based on a set of external price feeds (e.g.: the price feed of BTC/USD on Coinbase, Binance, an UniswapV2 on Ethereum), an Oracle Provider will aggregate such price feeds and provide a smart contract that enables end users (such as a borrowing and lending pool on Ionic) to query the price of BTC/USD using on-chain calls.
Oracle Risks
The fact that oracles serve to bring off-chain data into a blockchain inherently implies a security risk, as they bring data that is not validated by the blockchain's own consensus mechanism. While some Oracle solutions are more secure than others, it is essential to understand that no perfect implementation exists.
As mentioned previously, not all Oracles are created equally. As it has been observed in a multitude of hacks across the DeFi ecosystem, the level of difficulty and cost to manipulate an Oracle is usually what lies at the core of how secure such Oracle is.
To give a simple example, an Oracle that only uses UniswapV3 prices as its pricing mechanism can be subject to manipulations if the liquidity of the specific pair is not deep enough. Let's take for instance the ETH/USDT pair on UniswapV2. A large enough trade as seen in the screenshot below would cause a price impact of over 40%. While a trade like this would get arbitraged back quickly enough, an Oracle that simply returns the price of a token as given by a single source and that does not smooth out short-lived variations is doomed to be manipulated (especially because large sums of capital can be sourced in a single block via Flash Loans, making single-block oracle attacks particularly doable -- and profitable)
Solrune Network utilizes the oracle solution provided by Pyth Protocol.
Solrune utilizes Pyth as its oracle, a first-party data oracle meticulously designed to deliver high-fidelity data directly to the blockchain. Pyth supplies price updates with a confidence interval on Solana every slot (approximately 0.5 seconds), significantly reducing the potential for front-running on our DEX. Solrune implements three mechanisms to mitigate trade losses:
Trades are executed only if Pyth has published in the current slot, requiring a minimum number of publishers.
If a slot remains unupdated for an extended period, trading activity is suspended (this timeframe varies by pool).
The confidence interval must meet specific criteria (this varies by pool) to ensure trade execution accuracy.
Last updated