Introducing Aries Price Oracle

Aries Protocol
3 min readJan 31, 2022

We introduce a universal on-chain price oracle for any DEX token pairs on Aurora EVM, designed to be maintenance-free, robust and reusable by other DeFi projects.

Aries Price Oracle is maintenance-free, manipulation-resistant and universal

What are Price Oracles?

Price oracles are an essential piece of DeFi infrastructure.

A price oracle is any contract that provides on-chain access to price information for a token, usually denominated in terms of another token or an off-chain unit of account. Virtually every decentralized lending protocol requires timely and accurate on-chain prices in order to determine the value of collateralized loans, as well as to prevent borrowers from withdrawing more than the value of their collateral at any time.

There have always been many different oracle implementations with varying degrees of decentralization and availability. The Aries Price Oracle uses a fully decentralized and on-chain design that complements other price oracles, with a robust and minimalist approach for getting on-chain prices from any decentralized exchanges (DEXs) on Aurora EVM.

The Aries Price Oracle

The Aries Price Oracle is completely on-chain, designed to be working with any Uniswap V2-compatible LP token pair supported by all major DEXs like Trisolaris and WannaSwap. It calculates the time-weighted average price (TWAP) by using the pair’s built-in price accumulators, over a period of at least 1,200 seconds (20 minutes). This is accomplished using the pair’s current price and a previously-observed price (stored within the oracle’s contract) from at least 20 minutes prior.

Because it is implemented as a minimalistic permissionless contract on-chain, the Aries Price Oracle guarantees a high availability and accessibility.

Anyone can add a new token pair to the Aries Price Oracle by calling:

initialize(address uniswapV2Pair)

Once a token pair has been initialized and at least 20 minutes have elapsed, the TWAP for the pair can be retrieved by calling:

getResult(address uniswapV2Pair)

Subsequent calls to getResult within 20 minutes will return a new TWAP using the pair’s current price and the same price observation as before. After 20 minutes, a new call to getResult will update the contract’s price observation for the pair, use it for its TWAP calculation, and continue to use the price observation for at least 20 minutes.

We are thrilled to release the Aries Price Oracle on Aurora EVM and look forward to new DeFi protocols leveraging it for decentralized lending, derivatives, synthetic assets, and more.

Contract on Aurora Mainnet: 0x0A60Bef6b2d3ADDFDC6d9d0cf11CD702AED8B209

GitHub: Aries Price Oracle

Risks and security considerations

In many DeFi protocol hacks and exploits, the the primary vulnerability often comes from the underlying price oracle implementation. A protocol may be susceptible to price manipulation if it relies on a vulnerable oracle for current prices.

For Aries Protocol, we need to protect against a scenario where a borrower can withdraw more than the value of the collateral deposited, and thus result in a loss of lenders’ funds.

To achieve manipulation resistance, Aries Price Oracle emphasizes robustness and manipulation resistance, opting for a sufficiently long minimum time period to calculate the TWAP (20 minutes) and being limited to one type of data: the prices for highly liquid token pairs on decentralized exchanges.

Calculating LP token value

A liquidity pool is a pool of tokens locked in a smart contract and used to facilitate automatic market making or other DeFi activities. The basic type of liquidity pool most DEX’s implement holds two tokens in its reserves and creates a decentralized trading venue for the token pair according to a constant product market maker formula.

When liquidity is added to a pool, the liquidity provider (LP) receives special tokens called LP tokens representing the liquidity supplied to the pool, relative to the total size of the pool’s reserves. Aries Protocol uses these LP tokens as collateral to enable decentralized lending. The ultimate goal is to allow liquidity providers to leverage their LP tokens for significantly enhanced yield farming and staking rewards.

In order to determine how much collateral is necessary for borrowing and leverage, Aries Protocol uses the Aries Price Oracle to reliably calculate the value of LP tokens. The pricing of LP tokens will be explained in-depth in a future article.

Aries Protocol is empowering those in the Aurora and greater NEAR ecosystem to choose their own destination. Join us on our adventure to explore the DeFi constellations:

--

--