Introducing Polaris

A trustless price oracle for ERC20 tokens on Ethereum Mainnet

Mykel Pereira
Mar 27 · 4 min read

Uniswap

Uniswap is a decentralized exchange and automated market maker. Instead of matching buyers and sellers with an order book, it pools liquidity from market makers and uses an algorithm to set the price. Automated market makers like Uniswap have prices that are close to the market price, because whenever price imbalances exist, arbitrage opportunities are created and the price quickly corrects.

  1. Now that the price is inaccurate, attacker liquidates loans on a lending protocol that uses Uniswap to value collateral
  2. Attacker repurchases all tokens initially sold

Polaris

Polaris makes attacks more costly by taking the median of price checkpoints from Uniswap over time. By extending the required duration of price manipulation beyond a single transaction, manipulating the price becomes much more difficult and costly. This solution makes a small compromise on the liveliness of the price in order to resist price manipulation.

  • If more than one checkpoint is registered within a 3.5 minute period (15 blocks), count the median of these checkpoints as a single checkpoint

Incentives

Polaris uses a set of incentives to encourage third party actors to regularly checkpoint prices and maintain an accurate price feed. In order to reward “pokers”, Polaris charges smart contracts a monthly subscription fee for the ability to read prices from the oracle. In anticipation of using the oracle for our secured lending protocol, Marble is currently the first paying subscriber of the ETH-DAI price feed.

  • The current price on Uniswap is >1% different from the median of all checkpoints in the last 3.5 minutes
  • The current price on Uniswap is >1% different from the last checkpoint
  • It has been >3 hours since the last price checkpoint was registered

Analysis

We backtested the oracle’s performance with historical Uniswap DAI/ETH prices for every block since January 1, 2019. Using only incentivized “pokes” as checkpoints for the oracle, we found that the oracle would have tracked the Uniswap price closely.

ETH/DAI prices since January 1 — Uniswap spot prices vs Oasis DEX vs Price Oracle
Oracle performance during a 12% ETH crash on Feb 24

Conclusion

If we want truly fair and self-sustaining financial markets, we need an oracle system that is accurate, fast, unbiased, and resistant to price manipulation. This is a first attempt towards that goal. We realize it may not be perfect so we are eager to hear feedback and constructive criticism from the decentralized finance community. Please reach out at info@marble.org or on Twitter @marbleprotocol.


Marble.org

Secured lending on Ethereum

Mykel Pereira

Written by

Co-founder of Marble https://marble.org/

Marble.org

Secured lending on Ethereum