Introducing Proto RAI

Stefan Ionescu
Reflexer
Published in
6 min readOct 29, 2020

A stepping stone in on-chain control theory

After months of research and building, we’re excited to unveil our first, full Ether backed asset called Proto RAI!

What is Proto RAI?

Proto RAI (PRAI) is an unaudited mainnet demo of our upcoming reflex index called RAI. PRAI is managed and repriced by a primitive version of our on-chain, autonomous PID controller. Check our whitepaper for a description of the controller and for the system as a whole.

The purpose of this demo is to test and improve our tooling and smart contracts, bootstrap an initial group of keepers that liquidate undercollateralized positions as well as gather live data which can help us update our market model and simulations. This is why in the first couple of weeks we will focus exclusively on developers. After we finish our initial audits we will invite more people to join.

If you would like to monitor the system, you can use this simple dashboard.

How Do I Create PRAI?

In order to create PRAI, you need to deposit Wrapped ETH into a smart contract and open a new position which we call a “Safe”.

At this stage we do not have a webapp to facilitate the creation of PRAI although we encourage developers to use our Typescript and Python libraries as well as our CLI in order to interact with the system. This video guide and our documentation walk you through using the Typescript library with proxy contracts in order to generate PRAI backed by (W)ETH.

We advise everyone to exercise caution and avoid using large amounts of Ether when they test the system. Do not risk more than you can afford to lose.

What Can I Do with PRAI?

Currently you can trade PRAI for ETH using this Uniswap V2 pool. Please be aware that the pool does not have a lot of liquidity.

Key System Parameters

There are several system parameters that everyone should be aware of:

  • Debt ceiling: 10200 PRAI. This is the maximum amount of PRAI that can be issued at the moment using Safes
  • Minimum collateralization ratio: 150%
  • Initial PRAI redemption price: $2.015. We chose this number because it symbolizes the year when Ethereum launched (2015).
  • Liquidation penalty: 11%. This is needed in order to avoid auction grinding attacks.
  • Collateral auction fixed discount: 5%. This is the discount at which the system sells ETH (confiscated when liquidating a Safe) compared to Ether’s last recorded market price in the OSM. The discount is meant to incentivize keepers to participate in collateral auctions and recapitalize the system. You can read more about the collateral auction mechanism here.
  • Minimum amount of PRAI that must be generated by a Safe: 85 PRAI. This ensures that the total amount of debt confiscated (in the case of a liquidation) is greater than the gas cost incurred for doing so and thus keepers have an incentive to liquidate Safes.
  • Maximum amount of PRAI that can be generated by a Safe: 255 PRAI. This is a temporary limit meant to make it more expensive to hit the current (and small) debt ceiling in one transaction.
  • (W)ETH annual stability fee/borrow rate: 1.5%
  • Minimum & maximum 24H redemption rate: -/+20%

What if Something Goes Wrong?

In case of a fatal bug or a black hat draining all (or part of) the system collateral, we will announce on Discord, Telegram and Twitter that we are shutting down the protocol. We will also coordinate next steps with the community on Discord.

Bumpy Start

After we deployed the system, we discovered that we did not properly set authorized addresses inside the ERC20 PRAI contract. Because of this, we were not able to add new authed accounts or remove old ones.

We decided to disable the original CoinJoin contract which allows users to transfer PRAI between the core system and the ERC20 contract. Users (mostly bots that traded in the old Uniswap pool) who hold old PRAI tokens can now call the old CoinJoin in order to join() tokens inside the system. They can then use the latest CoinJoin and Coin contracts in order to get new PRAI tokens and trade using the new Uniswap PRAI/ETH pool.

We also had to disable the old treasury and abandon the initial Uniswap v2 PRAI oracle in favor of new versions that are integrated with the latest Coin/CoinJoin.

Next Steps

We are planning to run this demo for at least 3 months, at which point we will trigger Global Settlement. We will then gather all the mainnet data and analyze it in order to re-evaluate our models and further tune the controller.

We may decide to extend the duration of the demo although at this point the community can assume that it will only be a temporary system.

As outlined above, in case an exploit is found or someone manages to game the controller, we will need to shut down earlier than planned. Whatever happens, we will announce the shutdown on all our channels so that the community is kept up to date.

General FAQ

How does the PID controller currently work?

At this moment the PID is disabled because we launched earlier than initially planned and did not yet finish our initial R&D. We plan to start the controller in the next 2–4 weeks and will inform the community about this change beforehand.

Where can I find the controller code?

For now we are keeping the controller code (as well as the simulations/market model) closed source. As we move forward, we will let the community know when we plan to release details about our research.

All the other contracts are open-source and you can find their addresses here.

What is the status of your PID research?

We have the basic smart contract and simulation infrastructure in place which can help us choose initial parameters for the controller as well as validate the behavior of our Solidity implementation compared to the Python models.

The next steps consist in stress testing our models, building a system that allows us to visualize on-chain data in real time and analyzing the data coming from this demo in order to inform our design revisions.

When do you expect to open-source the remaining code and research?

When we’ll launch and announce RAI we will also publish a schedule where we say exactly when we will open-source the remaining Solidity code as well as start to publish articles about our research and show our models.

What are the risks of using Proto RAI?

There are several risks associated with using PRAI:

  • A bug in the controller that destabilizes the system (e.g sets the redemption price to zero) and puts everyone’s collateral in danger of liquidation
  • Bugs that result in funds being stuck in the protocol or a malicious actor draining all or part of the collateral
  • Uniswap V2 PRAI/ETH market manipulation that can influence the controller in order to set unusually large values for the redemption rate. This can lead to PRAI being internally repriced at a rate that makes the market and redemption prices completely diverge

You can find our more about system risks in our documentation. Every sub-section is continuously updated with more edge cases and undesirable scenarios that users should be aware of.

How do you plan to minimize the above mentioned risks?

We have several ongoing initiatives:

  • There are boundaries for the redemption rate so that it cannot be set to unexpected values
  • We are currently auditing the core contracts. The process will take several weeks although we plan to fix outstanding issues as they arise
  • The PRAI/USD feed coming from the Uniswap oracle must pass through a filter that enforces a delay between consecutive updates and also bounds price changes
  • Our Uniswap oracle integration does not use the spot price but rather the PRAI/ETH TWAP over the last 12 hours in order to make manipulation as expensive as possible

Where can I find out more about the project?

Join our Discord channel!

Do you have a bug bounty program?

Right now we do not have a bug bounty program although we plan to create one after we finish the first round of smart contract audits.

Is there a governance or protocol token?

There isn’t any token apart from Proto RAI (PRAI) which can be found at this address. PRAI holders do not have governance rights.

Do you have yield farming/liquidity mining?

We do not have any yield farming or liquidity mining initiative.

Where can I find the deployed smart contracts?

The latest contract addresses can be found here. You can also see the full deployment history in our changelog.

How do you change protocol parameters?

We’re using a multisig deployed at this address.

Resources

Whitepaper: https://github.com/reflexer-labs/whitepapers
Documentation: https://docs.reflexer.finance/
Video Guide on How to Create PRAI: https://www.youtube.com/watch?v=6rD7MjUaJUA
Stats Dashboard: https://stats.reflexer.finance/
Mainnet Subgraph: https://thegraph.com/explorer/subgraph/reflexer-labs/prai-mainnet
Uniswap PRAI/ETH Pool: https://info.uniswap.org/pair/0xEBdE9F61e34B7aC5aAE5A4170E964eA85988008C
Discord: https://discord.gg/QYBEw6Z
Twitter: https://twitter.com/reflexerfinance

--

--