SIP 32: Chainlink Oracles Phase 1 - Forex & Commodities Source

Author Justin J Moses Discussions-To https://discord.gg/3uJ5rAy Status Implemented Created 2019-12-02

Simple Summary

Phase one of migrating to decentralized oracles involves transitioning to Chainlink networks for our forex and commodity synths.

Abstract

As part of the migration towards decentralized oracles with Chainlink, we will implement the transition in phases. Phase 1 will involve migrating our forex and commodity synths to Chainlink pricing networks.

In the meantime the SNX centralized oracle will continue to supply the prices for the remaining crypto synths (including inverses and indexes).

Motivation

As discussed in this issue, it is imperative that the Synthetix ecosystem move away from a centralized oracle to decentralized pricing networks.

It has also been established that Chainlink oracles could expose the Synthetix system to front-running as the deviation target for updates of 1% is larger than the exchange fee.

Thus in order to achieve a safe and secure transition, and to minimize any potential front-running risks, we have selected migrating to the forex and commodity prices first, as these have much less volatility on average than crypto prices and as such are a minimal target for front-running.

In addition, we will keep the max gas solution in place (SIP-12) during this transition and work with the chainlink nodes to ensure their gwei settings exceed our exchange limits to prevent front-running.

Specification

Our ExchangeRates contract (https://contracts.synthetix.io/ExchangeRates) will continue to be fed prices from the decentralized oracle. However, the logic for looking up prices will be extended with a mapping of Chainlink Aggregator contracts for each forex and commodity synth.

The synths are as follows:

Rationale

In order to have both the centralized oracle and decentralized oracles work in tandem, we will abstract away the logic in the ExchangeRates contract. Fortunately, the current architecture is such that this change is a fairly minimal impact to the Synthetix system.

Test Cases

To be added

Implementation

To be added

Copyright

Copyright and related rights waived via CC0.