Proposed Upgrades to SynLev Price Calculator & Price Aggregator

SynLev
4 min readJan 7, 2021
Chainlink Oracle Price Smoothing (100 Round)

Today we are introducing updates to the SynLev priceCalculator.sol and priceAggregator.sol contracts. The contracts are currently live Ethereum mainnet for testing and observation purposes only. They have been proposed to their respective proxies and must wait 48 hours before being fully implemented.

Goals of Upgrades

  • To increase long term LP share price.
  • Curb the efficacy and profitability of bot “frontrunning” oracles or taking advantage of short term price volatility.
  • Decrease the “volatility decay” of bull/bear token price.
  • Reduction in gas costs.

How

This is accomplished by fundamentally changing how price is calculated. Instead of grabbing singular price data points for price calculation the price aggregator now averages price over multiple price rounds, for both new price and old price averages. This has the effect of “smoothing” out price data and reducing the effect each Chainlink price update has on SynLev price update cycles.

Fundamentally what’s happening is two price averages are being taken over a price window N (by default we are starting with 10 rounds, however this is adjustable for each SynLev asset pair). Each price average is shifted by only 1 Chainlink price round, greatly reducing the impact of a single price change on SynLev assets.

The Math

First the old price average is taken. Pₛ represents the first price in the price round window. For example if the most recent Chainlink price round is 6055 Pₛ would be the price data from round 6045 (s = Current round-N). All price rounds between 6045 and 6054 are then averaged. For the purpose of more accurate price updates P₀ replaces Pₛ. In general P₀=Pₛ, except when P₀<Pₛ. Meaning that the price has not been updated in N price rounds. This is to ensure that price updates always pick up from where they left off.

Old Price Average

Next the new price average is taken in a very similar process to the old price average. Only with the exclusion of P₀ and the inclusion of Pₛ+ₙ. Effectively shifting the price window by only 1 price round. Averaging price rounds 6046 to 6055.

New Price Average

Finally the difference between the two price averages are calculated as the new ΔP. And can be used to calculate SynLev asset price similarly to before.

Average Price Change

The Effects

The first graph in this post shows the price effects of this strategy with a 100 round price window over historical ETH/USD chanlink data from Nov 22 to present. This is an unrealistically large price windows as Chainlink oracles typically have 50–200 price updates per day (varying greatly depending on the asset and its volatility). Below is the same graph with a 10 round price window.

Chainlink Oracle Price Smoothing (10 Round)

At first glace the difference appears to be very small. This is however over a 1.5 month period. Zooming into just a 24 hour period the difference is apparent.

Chainlink Oracle Price Smoothing (10 Round)

Price data sees lower highs and higher lows, while nearly completely ignoring short term price spikes which. This fundamentally shifts the term on which traders can use SynLev assets, transitioning form short term trading to medium term trading. The benefits to this are multi fold.

Advantages

  • Significantly less “volatility decay” to bull/bear tokens as there is much less up and down price movement. Read here for more info on this effect.
  • Significantly reduced vulnerability to bots attempting to front run oracle price updates as price changes are experienced more gradually.
  • Reduction of loss to liquidity providers. Due to the two above improvements.
  • Significantly reduced gas costs due to having to only perform 1 price calculation instead of looping.

Disadvantages

  • Less “true” to actual Chainlink price data. Particularly if the vault price has not been updated in some time. There is a possibility that volatile price data could be under-emphasized.
  • Price data is slightly delayed, as price data is now using a moving window average. This discourages short term bull/bear positions.

What’s Next

As stated these contracts are both being on the Ethereum mainnet waiting to be implemented after the 48 hour waiting period. In the coming week we will be tweaking price round windows for both 3XETH/USD and 3XBTC/USD to optimize the aforementioned goals.

New Price Aggregator v1.3:

0x717584a1DC53DAFddE10b9819601A7082536E79e

New Price Calculator v1.3:

0x8B8BFCEDE1fAa498976437Da23a602789642B903

We will also shortly be implementing a specialized staking contract that will allow Uniswap SYN/ETH LP to stake UNIV2 tokens for ETH rewards in the same way SYN stakers earn staking rewards. After this users can expect the addition of a 3X YFI/USD and 3X LINK/USD trading pairs.

Thanks again everyone for supporting the project. We’re working hard to make 2021 the year of SynLev. Join the discussion on telegram at t.me/synlev. Follow us on twitter @SynLevDefi for the latest updates.

--

--

SynLev

Defi Synthetic Leveraged token ecosystem built on Ethereum and Chainlink oracles