RAI System Simulations: Part 1 — SAFE Owners

Money God
Reflexer
Published in
8 min readJun 15, 2021
Just how far down does the Money God go?

RAI is an ETH backed stablecoin that is kept stable with a PID-controller (a Proportional-Integral-Derivative controller). The controller is tuned in a way that it opposes the market forces just the right way to keep RAI stable, similar to how central banks operate with fiat currencies such as EUR and USD. This blog series will use simulations to dive deeper into how the RAI system behaves under different actors and scenarios.

In Part 1, we will see the effect SAFE owners have on the stability of RAI.

In Part 2, we will introduce RAI Traders and see how they further stabilize RAI.

In Part 3, we will see how the RAI system changes under different capital allocations of SAFE owners and RAI Traders.

Keeping RAI Stable

The RAI Money God (the controller mentioned above) uses monetary incentives on RAI users to keep the asset stable. Let’s dive deeper on how RAI’s price is formed in the system.

The system sees RAI/USD, the market price, as a composite of two exchange rates:

Ether’s market price, ETH/USD, is an exogenous factor in the system; it’s something that we cannot control. Ether’s price is decided by investors, the market sentiment, traders, apes, DEFI protocols and other factors that we cannot control. Actions of the RAI system are too small to significantly change ETH/USD.

This leaves us with the RAI/ETH term. In this post, we will show how the RAI/ETH is affected by the primary user of the RAI system, the SAFE Owner.

Ether prices influence on the system

While we cannot control ETH/USD, its movements have significant impacts in the RAI ecosystem.

When ETH/USD goes up, the collateral in RAI SAFEs increases in value. This allows SAFE owners to mint and sell more RAI while maintaining the same collateralization ratio as before (ratio of the SAFE’s RAI minted to its ETH holdings, aka. c-ratio). Safe Owners sell RAI typically to purchase other assets they are bullish on, often ETH, in an effort to amplify their exposure to being long ETH. Minting and selling RAI decreases RAI/ETH.

When ETH/USD goes down, the collateral in RAI SAFEs decreases in value. The SAFE owners will then typically buy RAI and re-pay their debt to stay at a desired c-ratio. This helps avoid the risk of getting liquidated and having to pay a penalty. Buying RAI increases RAI/ETH.

The general pressures on RAI/ETH from SAFE owners are thus inverse to the movements of ETH/USD.

Remembering that:

These inverse pressures on RAI/ETH by SAFE owners help stabilize the price of RAI/USD.

Let’s visualize this concept

Below, you can see a plot of the artificially generated ETH price action for this simulation.

Let’s also create a RAI/ETH Uniswap V2 pool with a RAI price of $3.14, which will also be the starting redemption price. The redempion price is the system’s internal valuation of RAI. The rate of change of the redemption price, the redemption rate, is what the Money God controls to influence RAI actors.

To create a constant product market on Uniswap with 5M of RAI and the starting ETH price of $294.07 from our simulation dataset, we need to supply it with 53,388 ETH to make RAI/USD equal to $3.14.

Simulation with no RAI actors

Now that we have a source of prices for RAI/ETH and ETH/USD, below is the price action of RAI/USD when there are no SAFE owners in the system.

The following RAI/USD chart also includes:

  1. Market Price TWAP: used by the system to provide a stable market price of RAI
  2. Redemption Price

Two observations:

  1. Since there is no market activity on the RAI/ETH pair, it is a constant throughout this simulation.
  2. The RAI/USD market price is 100% determined by the RAI/ETH Pool (there is no secondary market that is considered).

The result is RAI/USD market action is simply proportionate to the changes of ETH/USD. It inherits all the stability and instability of ETH/USD.

Simulation with Leveraging SAFE Owners

To make the RAI/USD market more stable, we start by adding SAFE owners that leverage their minted RAI to buy more ETH. These SAFE owners will mint/buy RAI as mentioned earlier to maintain their c-ratio as ETH/USD fluctuates. These SAFE owners will use their SAFE as a way to leverage and de-leverage long ETH/USD.

The Strategy

  1. When ETH/USD goes up, the SAFE owners will mint RAI, sell it for ETH and lock the ETH back into their SAFE.
  2. When ETH/USD goes down, the SAFE owners will unlock some ETH, buy RAI with it and pay back some of their debt.

A Caveat: We’ve made the SAFE owners somewhat intelligent in how they choose to sell/buy RAI when leveraging and de-leveraging. When they buy/sell RAI, it can move the market price. We’ve limited them so they won’t move the market so much that it creates a redemption rate (and thus price) that is not profitable for their leveraging/de-leveraging activity.

The SAFE owners will start with 20M USD worth of ETH as their collateral and they try to maintain a 290% collateralization ratio on their SAFEs.

Let’s see how the system responds.

The minting/buying of the SAFE owners causes RAI/ETH to move inversely to ETH/USD. This ultimately causes RAI/USD to negate the underlying ETH/USD movement.

While the SAFE owners have brought the market price closer to the redemption price, there is still a significant deviation from the redemption price in the RAI/USD chart.

Let’s see how the SAFE owners fared with their leveraging strategy.

Enter the Money God: The Controller

Controller Logic

As briefly mentioned above, the controller is used to alter the redemption price when the market price has deviated too far.

It moves the redemption price away from the market price, thus making the current market price less attractive. This incentivizes RAI actors to bring the market closer to the redemption price.

Instead of modifying the redemption price directly, the controller modifies redemption rate, which modifies redemption price:

The rate provides users of the RAI protocol information on which direction the redemption price is moving.

How is the redemption rate determined?

The current controller in the RAI system is a P-controller and only uses the difference between the redemption price and market price to determine the rate.

With the P-controller, the redemption rate is proportionate to the difference between the redemption price and the market price. That difference is multipled by a constant parameter, Kₚ, to get the final rate:

Kₚ defines how sensitive the controller is to the difference. The larger the value, the more the controller changes the rate.

TWAP for stability

Since we don’t want the market to be able to manipulate the controller easily, the controller uses the market TWAP instead of the spot price when setting the rate. The above equation becomes:

Summary of the Controller’s Actions

Simulation with Leveraging SAFE Owners and the Controller

When the controller and SAFE owners are present, this is the resulting system behavior:

As we can see, with the controller turned on the system responds to the SAFE owners selling RAI and depressing the RAI market price by gradually increasing the RAI redemption price. This has the secondary effect of decreasing the SAFE owners’ collateral ratios (their debt is more expensive) and thus serves to compensate for their minting and selling RAI. With the controller on, the redemption price increases from $3.14 -> $3.65 while the market price initially dips from $3.14 to around $3, but then increases to around $3.3 by the end of the simulation. This interplay between the SAFE owners seeking leverage in ETH bull scenarios and the controller compensating is part of how RAI achieves stability.

Let’s see how the SAFE owners fared this time, with the controller turned on.

Here is a chart of the redemption rate(converted to Annual Percentage Yield) throughout the simulation.

We can make some observations about this simulation:

  1. The RAI/USD market price opposes ETH/USD in the short term. This is due to the inverse RAI mint/buying from the safe owners to maintain their collateral ratios while still buying additional exposure to ETH.
  2. The redemption price movement then opposes RAI/USD. As the mint/buying of RAI moves the market price, the Money God moves the redemption price away from the market price, in the same direction of ETH/USD.
  3. RAI/USD follows redemption price in the long-term. As the Money God has affected the redemption price, the SAFE owner are aware of this internal re-pricing of RAI and it influences their future valuation of RAI.

Conclusion

As we’ve seen, the result of a simulation with Leveraging SAFE owners and a P-controller is the redemption price of RAI follows ETH/USD over time.

To recap the scenarios above:

  1. With only a RAI/ETH pool, RAI’s market price is perfectly positively correlated with ETH.
  2. With SAFE owners included (and controller off), RAI’s market price is negatively correlated with ETH moves as SAFE owners mint and sell more RAI.
  3. Once we add the controller, the controller compensates for the SAFE owners minting and selling by gradually increasing the redemption price, which influences the SAFE owners to not sell RAI as far below the peg, and so the RAI market price increases along with the redemption price. As a result, the RAI redemption and market prices are both positively correlated with ETH.

In this post, we explored how the SAFE owners’ behavior affects RAI/ETH and ultimately, RAI/USD.

In the next few posts we will see how other RAI users help to stabilize the RAI system.

Follow the Money God 🗿

Website: reflexer.finance

Twitter: @reflexerfinance

Discord: https://discord.gg/CfR74X22XE

--

--