1inch’s spot price aggregator: an overview
The tool delivers spot price data from the blockchain, enabling immediate displays of token prices in the interfaces of websites and apps.
This article explains how 1inch’s spot price aggregator works and how it can be used to make token swaps more efficient.
What is the spot price aggregator?
The spot price aggregator, developed by the 1inch Labs team, is a tool that extracts price data for tokens traded on DEXes from the blockchain.
The tool provides a liquidity-weighted average of tokens’ spot prices on multiple DEXes. To avoid price manipulations within a transaction, it is recommended that the spot price aggregator only be used off-chain.
A need for a spot price aggregator arose as a solution to a specific issue: not all tokens aggregated by 1inch were supported by existing price information services. The spot price aggregator aims to primarily solve information-related tasks, such as visualization of token prices extracted from the blockchain in the interfaces of websites and apps. Basically, the tool consists of smart contracts that communicate with various DEXes to immediately receive a token’s liquidity-weighted spot price.
The spot price aggregator supports multiple DEXes aggregated by the 1inch router and, therefore, all tokens traded on those DEXes. To handle wrapped tokens, such as wETH, cDAI, aDAI etc., the 1inch spot price aggregator uses custom wrapper smart contracts that wrap/unwrap tokens at the current wrapping exchange rate.
If no direct liquidity pair exists between two tokens, the spot price aggregator calculates rates for those coins using another token that has pairs with both of them — a connector token.
You can view all the supported deployments here.
What makes the 1inch spot price aggregator special?
Compared with other similar solutions, the 1inch spot price aggregator’s main advantages are support for a higher number of DEXes on Ethereum, Binance Smart Chain, Polygon, Avalanche, Optimistic Ethereum, Arbitrum and Gnosis Chain, as well as immediate display of prices without any lag.
While other price information tools could face lags of up to several minutes, 1inch’s tool displays a token’s price immediately.
Potential use cases
The 1inch spot price aggregator is already used in the 1inch dApp interface. When you enter the amount of tokens you want to swap, an approximate US dollar value is displayed below the amount field.
To get that value, the spot price aggregator extracts the token’s liquidity-weighted price against ETH, which is subsequently converted into US dollars using CoinGecko. In addition, the 1inch spot price aggregator is used by the Pathfinder algorithm.
Technically, the spot price aggregator could be integrated in any place where a token price is displayed and needs to be converted into US dollar or other fiat currency. Potential use cases for the tool include crypto wallets, price trackers and portfolio managers that enable traders and investors to view the value of their tokens.
If you want to integrate the 1inch spot price aggregator into your project, you can find the relevant addresses here.
If you need to execute more complex tasks related to trading, arbitrage or liquidation, consider using the 1inch Aggregation Protocol API.
Meanwhile, if you want to develop your own full-scale solution based on 1inch protocols, you are entitled to funding under the 1inch Grant Program. Details of the grant program are available here.
Stay tuned for more articles explaining 1inch tech!