Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions AIPs/aip-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,45 @@ requires (*optional): N/A
<!--"If you can't explain it simply, you don't understand it well enough." Simply describe the outcome the proposed changes intends to achieve. This should be non-technical and accessible to a casual community member.-->
The current Ampleforth rebasing function predisposes the network to short periods of rapid expansion and long periods of gradual contraction. This document proposes an update to the Ampleforth rebasing policy that would:

* Create symmetry between the speed of supply expansion and contraction.
* Create symmetry between the supply expansion and contraction.
* Limit the protocol's sensitivity to short-lived demand shocks.

The two above considerations should make the Ampleforth protocol a more balanced and robust building block for decentralized finance.

## Abstract
<!--A short (~200 word) description of the proposed change, the abstract should clearly describe the proposed change. This is what *will* be done if the AIP is implemented, not *why* it should be done or *how* it will be done. If the AIP proposes deploying a new contract, write, "we propose to deploy a new contract that will do x".-->
We propose to deploy a new contract that updates the current linear rebasing function with a modified sigmoid-shaped rebasing function.
We propose to deploy a new contract that updates the supply policy replacing linear rebase function with a sigmoid like shaped function.

## Motivation
<!--This is the problem statement. This is the *why* of the AIP. It should clearly explain *why* the current state of the protocol is inadequate. It is critical that you explain *why* the change is needed, if the AIP proposes changing how something is calculated, you must address *why* the current calculation is innaccurate or wrong. This is not the place to describe how the AIP will address the issue!-->

At present, the Ampleforth rebasing function takes a `VWAP` as its input and offsets price differences of `X%` with supply changes of `(X%/rebase_reaction_lag)`. Two things to note about this.
At present, the Ampleforth rebasing function takes a `VWAP` as its input and responds to price differences of `X%` with supply changes of `(X%/rebase_reaction_lag)`. Two things to note about this.

1. Expansion and contraction do not react symmetrically to equal and opposite relative changes in demand.
2. The protocol has capped rates of contraction but uncapped rates of expansion.

### Motivation for Symmetry

A supply policy is asymmetric if the speed of contraction is not equal to the speed of expansion, given identical but opposite changes in relative demand. In the case of Ampleforth, the protocol currently experiences much slower contraction than expansion. Consider the example of an alternating series below:
A supply policy is asymmetric if the magnitude of contraction is not equal to the magnitude of expansion, given identical but opposite changes in relative demand. In the case of Ampleforth, the protocol currently experiences slower contraction than expansion. Consider the example of an alternating series below:

**_Alternating Series Example_**

Imagine Price alternates between $0.5 and $2, every 24hrs, infinitely:
Consider the price alternating between $0.5 and $2, every 24hrs, infinitely:

<p align="center">
<img src="../assets/aip-5/series.png" alt="drawing" width="320"/>
</p>

For fixed-supply assets, the `market_cap` in our example above would simply alternate between two values. However, for any `rebase_reaction_lag` value other than 1, the current Ampleforth supply policy will drift upwards over time.
For fixed-supply assets, the `market_cap` in our example above alternates between two values. However, for any `rebase_reaction_lag` value other than 1, the current Ampleforth supply policy will drift upwards over time.

### Motivation for Capped Expansion Rate

We also propose asymptotic limits on the rates of supply change, in order to reduce the protocol's sensitivity to short-lived, but extreme market conditions.

### Motivation for removing minimum deviation threshold

TODO(naguib)

## Specification
<!--The specification should describe the syntax and semantics of any new feature, there are five sections
1. Overview
Expand All @@ -66,16 +70,16 @@ The smart contract upgrade replaces the current linear rebasing function with a

Below we'll quickly review the basic sigmoid, and then explain the rationale for the "balanced" sigmoid proposed.

#### 1. Basic Sigmoid
The basic sigmoid takes the following shape, note the presence of horizontal asymptotes and maximum slope near the origin:
#### 1. Sigmoid
A sigmoid function takes the following shape, notice the horizontal asymptotes and the maximum slope at the target price($1):

<p align="center">
<img src="../assets/aip-5/basic_sigmoid_latex_thin.jpg" width="700"/>
</p>

**1.1. _Basic Sigmoid Equation and Parameters_**
**1.1. _Sigmoid function and parameters_**

This equation accepts as its input, `x`, the normalized difference between `VWAP` and the price target. It returns, `Y`, the corresponding supply change percentage.
This equation takes, `x`, the normalized difference between `VWAP` and the price target. It returns, `Y`, the corresponding supply change percentage.

```
Y = supply change %
Expand All @@ -86,7 +90,7 @@ x = normalized price deviation
<img src="../assets/aip-5/basic_sigmoid_eq_2.png" alt="drawing" width="380"/>
</p>

It has shaping parameters that determine: lower asymptote, upper asymptote, and the slope of the curve (ie: growth rate) around its origin.
It has shaping parameters that determine: lower asymptote, upper asymptote, and the steepness of the curve (ie: growth rate)

```
L = lower asymptote
Expand All @@ -96,12 +100,12 @@ B = growth rate

#### 2. "Balanced" Sigmoid

Although the basic Sigmoid is a good start, we can improve upon it by scaling supply changes such that they “balance” one another. More specifically:
Although a Sigmoid is a good start, we can improve upon it by modifying the supply changes such that they “balance” one another. More specifically:

* If a demand-change-factor of `A` corresponds with supply-scale-factor `B`.
* We want to enforce that a demand-change-factor of `1/A` corresponds with a supply-scale-factor of `1/B`.
* If price `A` corresponds with supply-change-factor `B`.
* We want to enforce that price `1/A` corresponds with a supply-change-factor of `1/B`.

This way, supply reactions to equal and opposite relative changes in demand, always execute in the same amount of time. For more context, see the alternating series example in the motivation section above.
This way, supply reactions to equal and opposite relative changes in demand, even each other out. For more context, see the alternating series example in the motivation section above.

**2.1. _The "Balancing" Solution_**

Expand All @@ -126,7 +130,7 @@ This way, for every price pair <code>{P, P<sup>-1</sup>}</code> the correspondin

**2.2. _Balanced Sigmoid Equation and Parameters_**

Recall that the basic sigmoid equation accepts a price deviation and returns a supply change percentage. Combining it with the mirroring equation gives the output<sup>*</sup>:
Recall that the sigmoid supply change function takes a price deviation and returns a supply change percentage. Combining it with the inversing function gives the output<sup>*</sup>:

<p align="center">
<img src="../assets/aip-5/piecewise_sigmoid_eq.png" alt="drawing" width="380"/>
Expand All @@ -136,7 +140,7 @@ Recall that the basic sigmoid equation accepts a price deviation and returns a s

#### 3. "Balanced" Sigmoid vs Linear

We expect that the “balanced” sigmoid supply curve will cause the Ampleforth network to react symmetrically to relative demand signals, and eliminate the bias towards prolonged contraction periods.
We expect that the “balanced” sigmoid supply curve will cause the Ampleforth network to react symmetrically to relative demand signals, and eliminate the bias towards prolonged contraction periods.

<p align="center">
<img src="../assets/aip-5/combined_latexchart_withdeviation.png" alt="drawing" width="700"/>
Expand All @@ -149,9 +153,9 @@ This update creates no changes to external APIs. Clients, including exchanges, w

#### Initial Parameter Values

These parameters were set to achieve the outcomes stated above (see motivation)—while keeping the aggregate expansion rate as similar to the current protocol as possible.
These parameters were set to achieve the outcomes stated above (see motivation)—while keeping the aggregate expansion rate as equivalent to the current protocol as possible.

Recall that the contraction curve is derived from the expansion curve through the "balancing" solution above. Thus, we need only verify that the shaping parameters selected, produce an expansion curve that generally resembles the current rebasing function. Thereafter, a balanced contraction curve will follow from the balanced_sigmoid equation as defined above.
Recall that the contraction curve is derived from the expansion curve through the "balancing" solution above. Thus, we need to only verify that the parameters selected, produce an expansion curve that its expansion rate generally resembles the current rebasing function. based on it a balanced contraction curve will follow from the balanced_sigmoid equation as defined above.

The proposed values are:

Expand All @@ -171,8 +175,8 @@ Below we present a chart depicting the balanced_sigmoid_shape alongside the curr

Here we can see that the:

* The Upper asymptote occurs at a price of $2.5 with a scale factor of 1.11
* The Lower asymptote occurs at a price of $0.50 with a scale factor of 0.9
* The Upper asymptote almost reaches a scaling factor of 1.11 at a price of $3.
* The Lower asymptote almost reaches a scaling factor of 0.9 at a price of $0.3

Note that the difference in shape is more pronounced for contraction than for expansion.

Expand Down