Oracle

Oracle provides an interface allowing for a customization layer on top of other onchain oracles. Oracle is how Swapper determines prices for different assets.

Since Oracle itself is just an interface, most of these docs focus on the specific Oracle implementations offered by the Splits team. Currently, Splits offers two implementations, UniV3Oracle and ChainlinkOracle.

UniV3Oracle

This Oracle implementation uses Uniswap's v3 (opens in a new tab) TWAP to price assets.

How it works

UniV3OracleImpl sequence diagram (opens in a new tab)

Default token pairs

The following token pairs are supported by our default, immutable deployment of this Oracle implementation.

Ethereum – 1
Base – 8453
Optimism – 10
Polygon – 137
Arbitrum - 42161

Addresses

Ethereum – 1
Base – 8453
Optimism – 10
Polygon – 137
Arbitrum – 42161

Create your own

We don't offer UI support for creating oracles at the moment, but technical users can fork our default creation scripts (opens in a new tab) and alter appropriately to suite their needs.

ChainlinkOracle

The oracle uses Chainlink data feeds for onchain prices. Checkout the chainlink documentation (opens in a new tab) to learn more about data feeds.

How it works

The oracle setup includes a defined path for price computation for each currency pair. The oracle maintainer configures this path, which comprises sequential steps, each containing:

  1. Feed: This denotes the specific Chainlink oracle feed utilized to retrieve the exchange rate data.
  2. Decimals: The scale of precision of the returned price from the feed is denoted by the decimals. It dictates the factor by which the price should be adjusted to get the actual value.
  3. StaleAfter: A time-based parameter set by the user, which dictates the acceptable age of the data feed. If the data is older than this value, it's disregarded as stale.
  4. Mul (boolean): A boolean flag that determines the mathematical operation for the price adjustment. If set to true, the price from the feed is multiplied by the 'current price' in the computation path. If false, it's divided. The 'current price' is initialized to a standard base of 1 wad (1e18) to maintain precision.

Addresses

Mainnet – 1
Base – 8453
Optimism – 10
Polygon – 137
Arbitrum – 42161

Create your own

We don't offer UI support for creating oracles at the moment, but technical users can fork our default creation scripts (opens in a new tab) and alter appropriately to suite their needs.