Apollo, an oracle built as a modular pallet powering Substrate primitives
Apollo is an MEV-resistant oracle pallet built into the runtime of Picasso, Composable’s Kusama parachain. It serves as a primary pallet fundamental to the Composable ecosystem’s modular functionality, and its suite of DeFi primitives. Apollo provides oracle services that verify events' occurrence and up-to-date pricing data.
What is Apollo?
The function of an oracle is to determine the real-time price of assets even if they are distributed across different chains and layers. Hence, oracles verify on-chain and off-chain events for smart contract execution. Apollo is decentralized and permissionless and built directly into the base runtime of the parachain. It is able to deploy blockchain hooks on either side of the creation of a block, and as a result, is deeply customizable, and updates information immediately, to stay in real-time.
Apollo functions through permissionless data provider nodes, who provide information and stake their own tokens. Assets are added to Apollo, and then the price is added to the chain via API. Once a threshold of providers have inputted information, prices are aggregated and medianized to find a common price point, with stakes of tokens acting as a form of weighting. The stake of tokens acts as an incentive to provide information, and a countermeasure to malicious actors who can have their tokens slashed via defensive mechanisms. The median price is stored within a block number, which acts to stop front-running, or miner-extracted value (MEV).
How does Apollo support Composable’s Vision of modular DeFi functionality?
As a primary substrate pallet, Apollo is modularly functional and can be composed into other pallets that require oracle services even though it is integrated into an L1 base runtime like Picasso. Hence, it can be stacked and combined with other pallets to create new secondary and tertiary DeFi primitives. This further extends Apollo’s use case beyond just Composable’s ecosystem to other substrate chains or ecosystems that connect with Composable through the cross-chain virtual machine (XCVM). Pablo, for example, is stacked on top of the Apollo pallet and uses it to price different assets on its exchange that exist across different chains and layers.
Apollo also forms part of the Composable technology stack’s infrastructure layer, which is made up of all of its different pallets. The XCVM is then able to orchestrate the infrastructure layer and leverage the underlying functionality of pallets like Apollo to create modularly functional multi-chain smart contracts. These contracts could then use the secure price information and event authentication capacity of Apollo to enable cross-chain smart contract execution.
How Apollo overcomes security and fraud concerns through its design
Apollo is MEV-resistant through its storage of mediated prices within block numbers. In addition, its permissionless nature means price feeds cannot be added or removed by users, which can be used to cause price manipulation. Instead, any user can open and operate a node without the need for permission, and without the threat of manipulation as the node is decentralized.
Apollo also has other mechanisms to stop fraud. Apollo uses a time-weighted average price, or TWAP, which incorporates the time-interval of an asset’s price according to a provider, into the calculation of its medianized price. In the future, Apollo will also add price banding, wherein a trusted server selected by users calculates a delta between its price and that of others, and price distortions on other nodes can be more easily identified. Malicious actors would have to therefore capture multiple nodes to manipulate the price. In the event the trusted server itself is compromised, it can safely be ignored as it would only broadcast price differentials, and not the price itself.
Apollo plays a critical role within the ecosystem as a secure and modularly functional oracle pallet. Apollo’s composable pallet functionality enables the creation of an entire suite of secondary and tertiary DeFi primitives. This also empowers applications built on the XCVM as Apollo can be leveraged to provide oracle services. Apollo, like other Composable infrastructure, represents the height of DeFi innovation, built from the ground up to solve the needs of users and developers alike.
Composable is unveiling the XCVM at its inaugural conference in Berlin, the Unchained conference set for the 1st of July 2022. With a live demo and hackathon planned around the XCVM, developers will be able to get insight into how they can maximize XCVM in tandem with the benefits Apollo provides. Registration for Composable Unchained is live and tickets are available for sale.