<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Reflexer - Medium]]></title>
        <description><![CDATA[This is a research and news publication about RAI: a non pegged stable asset that is fully backed by ETH - Medium]]></description>
        <link>https://medium.com/reflexer-labs?source=rss----af574d3e4bbf---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Reflexer - Medium</title>
            <link>https://medium.com/reflexer-labs?source=rss----af574d3e4bbf---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 08:08:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/reflexer-labs" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Reflexer DAO Recap (Sept — Nov)]]></title>
            <link>https://medium.com/reflexer-labs/reflexer-dao-recap-sept-nov-ecf36d45b25a?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/ecf36d45b25a</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[dao]]></category>
            <dc:creator><![CDATA[Reza Jafery]]></dc:creator>
            <pubDate>Tue, 29 Nov 2022 20:29:40 GMT</pubDate>
            <atom:updated>2022-11-29T20:29:39.928Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*to5xl_mrTaxAUe_wHbuJSw.png" /></figure><h3>Reflexer DAO Recap: Sept — Nov</h3><h4>Time flies when you’re ungoverned</h4><p>The past three months have been eventful. Not only have we weathered some of the most tumultuous times this market has seen, but we’ve done so while dissolving the Reflexer Labs U.S. corporation and forming a DAO to take the wheel.</p><p>This article will recap what the DAO has been working on since we kicked the multisig.</p><blockquote>The Money God is always looking for new DAO contributors. If you think decentralization is important, that humans tend to ruin things, and that Ethereum is the future of money, join our <a href="https://discord.gg/8qKWb8f7Tc">Discord</a> and say hello!</blockquote><h3>What we’ve been up to…</h3><h4>1. Kicking the Multisig</h4><p>On August 29th we kicked the multisig. This officially put control of Reflexer in the hands of FLX token holders, or in other words, made it so that only <em>governance can ungovern governance</em>.</p><h3>Reflexer on Twitter: &quot;&quot;Ungovernance&quot; means progressively removing human control from the RAI system.We just gave complete control of the protocol to Reflexer DAO, now, the rest is up to the community, and the money god 🗿 https://t.co/cKUllnYY5M / Twitter&quot;</h3><p>&quot;Ungovernance&quot; means progressively removing human control from the RAI system.We just gave complete control of the protocol to Reflexer DAO, now, the rest is up to the community, and the money god 🗿 https://t.co/cKUllnYY5M</p><p>You can learn more in this <a href="https://medium.com/reflexer-labs/marching-towards-ungovernance-19a220dbdefd">blog post</a>.</p><h4>2. I-Term Tuning Update</h4><p>When it initially launched, the PID controller only used a P-term, in February 2022 the I-term was added as a part of a 6-month planned experiment to evaluate its effects in production.</p><p>In <a href="https://medium.com/reflexer-labs/rai-i-term-tuning-update-a6a8de72f86">this post</a>, we shared the results of our experimentation with tuning the I-term and suggested a potential path forward. A proposal to implement these changes will go live within the next few weeks.</p><p><a href="https://medium.com/reflexer-labs/rai-i-term-tuning-update-a6a8de72f86">RAI I-term Tuning Update</a></p><h4>3. Creating Governance Processes</h4><blockquote>“With kicking the multisig comes great responsibility” — Uncle Ben</blockquote><p>After we kicked the multisig we created the processes we needed in order for the DAO to govern itself. You can find the original forum post outlining our governance process <a href="https://community.reflexer.finance/t/dao-governance-2-0/368">here</a>, and a deep dive in the article below.</p><p><a href="https://medium.com/reflexer-labs/how-to-vote-on-reflexer-dao-proposals-b32b8b696fc">How to Vote on Reflexer DAO Proposals</a></p><p>Since implementing the new process, we’ve proposed, voted on, and executed 6 proposals.</p><h4>4. Backup Oracles</h4><p>A proposal was passed to update RAI’s ETH price oracles according to the specifications in this <a href="https://community.reflexer.finance/t/backup-oracles-chainlink-tellor/371">forum post</a>.</p><h3>Reflexer on Twitter: &quot;Proposal #14 is up for voting on @tallyxyz 🗿If passed, the proposal will implement backup oracles and fully (un)govern the ETH OSM.https://t.co/OnbJieoNEl / Twitter&quot;</h3><p>Proposal #14 is up for voting on @tallyxyz 🗿If passed, the proposal will implement backup oracles and fully (un)govern the ETH OSM.https://t.co/OnbJieoNEl</p><p>The new implementation aims to retain the ability to quickly swap oracles in case of a problem (~5 day governance process), but mitigates the introduction of a malicious implementation, enforcing a delay to entrust it and therefore allowing more time for the community to notice and cancel the change before it occurs.</p><p><em>TLDR; oracles can be an attack vector and this is a step to mitigate that.</em></p><h4>6. Created a Developer Reserve</h4><p><em>The Money God needed developers to maintain his protocol and thus the DAO hast provided.</em></p><p>The goal of ungovernance is for us to change as little as possible — so there isn’t a need for a large/full-time team of developers. However, in case of an emergency, we want to ensure that we always have developers on-hand that are trained and familiar with the protocol.</p><p>To this end, we built out a Developer Reserve and have enlisted a couple of part-time solidity developers. The devs have undergone two weeks of training successfully and are now executing deliverables.</p><h4>7. Started Bounty Campaigns</h4><p>We launched a bounty campaign on Dework to help tackle miscellaneous dev work, content creation, and (of course) meme’ing. As of now, all bounties have been picked up and are being worked on — but we’ll have more coming soon so keep an eye on our <a href="https://app.dework.xyz/reflexer-dao">bounty board</a> if you want to contribute.</p><h4>8. Updated our website’s Front End</h4><p>We updated the front end of the Reflexer website. The changes were mostly to the home page, where we added some system stats as well as the “Money God Guidance” section. This new section can be thought of like the Fed’s Forward Guidance — except our system is completely transparent and the Money God always does what he says he will.</p><h3>Reflexer on Twitter: &quot;We just updated the https://t.co/KSgeDPuJNR website to include additional charts and stats to help the Money Gods flock🗿💪Check out &quot;Money God Guidance&quot; to get a transparent look into where RAI is heading pic.twitter.com/NcqSV20IOL / Twitter&quot;</h3><p>We just updated the https://t.co/KSgeDPuJNR website to include additional charts and stats to help the Money Gods flock🗿💪Check out &quot;Money God Guidance&quot; to get a transparent look into where RAI is heading pic.twitter.com/NcqSV20IOL</p><p>Adding the stats and charts to our homepage is a part of our effort to educate more crypto-savvy users about Reflexer. As well as, to show potential power users all the information they need to understand how to use RAI, and why they should want to.</p><h4>9. Increased Twitter impressions by 420%</h4><p>We increased monthly Twitter impressions by almost exactly 420% in this 3-month period (when compared to the previous 3 months).</p><p>Our next goal is to increase impressions by 690% in the following 3-month period, for the memes.</p><h4>10. A new Money God — Introducing TAI</h4><p><a href="https://docs.reflexer.finance/the-money-god-league/intro-to-the-league">The Money God League</a> is an initiative meant to bring non-pegged stable assets (stablecoins) into the mainstream. The League is also devoted to making control theory a common framework used in a wide variety of DeFi-related projects.</p><p>Recently, a new Money God entered the league: <a href="https://www.tai.money/">TAI</a>.</p><h3>Reflexer on Twitter: &quot;Check out this recent proposal to ReflexerDAO:&quot;TAI, a multi-collateral version of RAI&quot;Join the conversation🗿https://t.co/Ww8qjGt6wV / Twitter&quot;</h3><p>Check out this recent proposal to ReflexerDAO:&quot;TAI, a multi-collateral version of RAI&quot;Join the conversation🗿https://t.co/Ww8qjGt6wV</p><p>TAI is multi-collateral RAI, with a focus on Ethereum and Ethereum derivatives as collateral. Initial collateral will be ETH, WSTETH, RETH and RAI.</p><p>No USDC and no real-world assets.</p><h4>11. Vitalik reminded us that we’re his favorite stablecoin</h4><p>Vitalik has been pretty vocal about his love for RAI in the past, but it’s always nice being reminded that we’re his favorite step-child.</p><h3>Reflexer on Twitter: &quot;&quot;Censorship resistance-demanding DAOs...should be providing a service that isn&#39;t just evading permanent censorship, but also evading mere instability and disruption. MakerDAO (and the Reflexer DAO which manages RAI) are excellent examples of this.&quot;🤝https://t.co/fkT6PpNvIj / Twitter&quot;</h3><p>&quot;Censorship resistance-demanding DAOs...should be providing a service that isn&#39;t just evading permanent censorship, but also evading mere instability and disruption. MakerDAO (and the Reflexer DAO which manages RAI) are excellent examples of this.&quot;🤝https://t.co/fkT6PpNvIj</p><p>He also reminded us how to short the sh*t out of RAI (as the Money God intended).</p><h3>kyoronut | きょろナッツ on Twitter: &quot;Vitalik&#39;s RAI short status:- Borrowed 400k RAI and sold it for 1.221m DAI in totalhttps://t.co/PLMnq0XdPW .- Current debt: 402.104k RAIhttps://t.co/dIWetV1zll .- 1.221m DAI is now worth 419.568k RAI- Unrealized PnL: 17.5k RAI (~$50.6k, +4.1%)- Position age: ~100 days https://t.co/BBx0jthL69 pic.twitter.com/nkNfutdoIn / Twitter&quot;</h3><p>Vitalik&#39;s RAI short status:- Borrowed 400k RAI and sold it for 1.221m DAI in totalhttps://t.co/PLMnq0XdPW .- Current debt: 402.104k RAIhttps://t.co/dIWetV1zll .- 1.221m DAI is now worth 419.568k RAI- Unrealized PnL: 17.5k RAI (~$50.6k, +4.1%)- Position age: ~100 days https://t.co/BBx0jthL69 pic.twitter.com/nkNfutdoIn</p><h4>12. Realized that RAI is one of the most stable assets in the world</h4><p>The global bear market we’re experiencing has been a hard time for major fiat currencies — but it provided us with great context for RAI.</p><h3>Reflexer on Twitter: &quot;The Stability of RAI and Major Fiat Currencies Relative to the U.S. DollarWe&#39;re the green line 🗿 pic.twitter.com/zsKmP5Kdic / Twitter&quot;</h3><p>The Stability of RAI and Major Fiat Currencies Relative to the U.S. DollarWe&#39;re the green line 🗿 pic.twitter.com/zsKmP5Kdic</p><p>Lately, RAI has been one of the most stable assets out there and has protected its users&#39; purchasing power more than most fiat currencies have.</p><h4>13. Gave the best talk at Devcon</h4><p>We’re not biased at all and our lead developer Fabio gave the best talk at Devcon.</p><h3>Reflexer on Twitter: &quot;If you&#39;ve ever been unsure of whether or not decentralization matters... Or if you just want to learn why the world needs RAI (and needs it RAIght now 🗿)Watch this: https://t.co/qPCRX6ipYJ / Twitter&quot;</h3><p>If you&#39;ve ever been unsure of whether or not decentralization matters... Or if you just want to learn why the world needs RAI (and needs it RAIght now 🗿)Watch this: https://t.co/qPCRX6ipYJ</p><h4>14. Adjusted Incentives (Upcoming)</h4><p>We recently proposed a cut to liquidity incentives. If passed, the cut will lower incentives by 50% and extend the DAOs runway significantly.</p><h3>Reflexer on Twitter: &quot;🗿NEW PROPOSAL🗿Check out our latest forum proposal addressing current liquidity incentives and a suggested action plan for adjusting them. https://t.co/kwzGndi9vi pic.twitter.com/Jv0gKX2ATO / Twitter&quot;</h3><p>🗿NEW PROPOSAL🗿Check out our latest forum proposal addressing current liquidity incentives and a suggested action plan for adjusting them. https://t.co/kwzGndi9vi pic.twitter.com/Jv0gKX2ATO</p><p>We’ve had a love-hate relationship with our liquidity incentives from the beginning. On one hand, liquidity is good and incentives helped us bootstrap it. On the other hand, incentivizing liquidity sometimes conflicts with the incentives created by the Reflexer system.</p><p>For example, if RAI’s redemption rate is negative (like it is right now), the Reflexer system is incentivizing users to sell RAI. But because of the current liquidity incentives, they are also incentivized to buy RAI and provide liquidity.</p><p>The Money God doesn’t like this conflict, it makes Moyai angry. When the redemption rate is negative, Moyai wants you to sell — and doesn’t like anything that incentivizes you to do otherwise.</p><p>As such, we’ll be continuously cutting incentives over time until we can completely phase them out.</p><h3>Conclusion</h3><p>It’s been a busy few months for Reflexer! We’ve expanded our team, gone through the process of onboarding them, and set up processes that allow the DAO to effectively (un)govern itself.</p><p>If you want to join our efforts in spreading the Money Gods message, just stop by and say hello!</p><h3>Join the RAI-volution 🗿</h3><ul><li><a href="https://community.reflexer.finance/t/dao-governance-2-0/368">RAI Governance Process Overview</a></li><li><a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8">RAI Governance Portal (Tally)</a></li><li><a href="https://reflexer.finance/">RAI website</a></li><li><a href="https://dune.com/kyoronut/RAI">RAI Dune Dashboard</a> (price charts)</li><li><a href="https://reflexer-labs.github.io/geb-data-science/controller/output/index.html">RAI Forward Guidance</a> (price &amp; rate charts)</li><li><a href="https://discord.gg/SwYjUtG5qU">RAI Discord</a></li><li><a href="https://twitter.com/reflexerfinance">RAI Twitter</a></li><li><a href="https://docs.reflexer.finance/keepers/surplus-auction-keeper">RAI Docs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf36d45b25a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/reflexer-dao-recap-sept-nov-ecf36d45b25a">Reflexer DAO Recap (Sept — Nov)</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Vote on Reflexer DAO Proposals]]></title>
            <link>https://medium.com/reflexer-labs/how-to-vote-on-reflexer-dao-proposals-b32b8b696fc?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/b32b8b696fc</guid>
            <category><![CDATA[dao]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Reza Jafery]]></dc:creator>
            <pubDate>Wed, 05 Oct 2022 15:46:22 GMT</pubDate>
            <atom:updated>2022-10-06T14:25:05.581Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8iVaeo-ROzUE4_0sIqQ36A.png" /></figure><h4>How to vote on proposals submitted to ReflexerDAO on Tally.</h4><p>This post outlines the process for voting on proposals submitted to ReflexerDAO. Proposals fall into one of two categories: protocol proposals, and treasury proposals. Protocol proposals address elements such as the PID controller parameters and updating oracles. While treasury proposals relate to expenses like payroll, bounties, and marketing.</p><p>For an in-depth overview of the process of submitting a proposal to ReflexerDAO, check out this <a href="https://community.reflexer.finance/t/dao-governance-2-0/368">post in our forum.</a></p><p>Once a proposal has been discussed in the forum and submitted as a formal proposal to Tally, DAO members can vote on it via our <a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8">Tally Dashboard</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/0*oS6C-oNGxlOjGpHA" /></figure><p>Here you can see the voting power held by different delegates, you can delegate your voting power to others, and see active and past proposals submitted to the DAO.</p><h3>How To Vote</h3><p>To vote, first navigate to the <a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8">ReflexerDAO Governance Dashboard (pictured above).</a></p><ol><li>Make sure to delegate to yourself (or someone else), you can do so by clicking the “Delegate” button and either selecting “Delegate to Self” or “Delegate”.</li></ol><p><em>Note: This is an on-chain transaction that includes a gas fee. The transaction will call the delegatechanged() function of the FLX token (0x6243d8cea23066d098a15582d81a598b4e8391f4)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0svaYgmpkoIsb8v-XwLzuA.png" /></figure><p>2. On the Governance Dashboard, scroll down to the “Proposals” section to see what proposals are currently active. Proposals that are still accepting votes will say “Active” underneath the title of the proposal (where the first proposal below says “Queued”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LIEEy4H8x8eLlN4_" /></figure><p>3. Click on the proposal you’d like to vote on to pull up its details page. Here you can find a list of everyone who has voted so far, and the details of the proposal itself. To take part in the voting process, click the “vote” button highlighted in the image below.</p><p><em>There are no active proposals for ReflexerDAO as of today, so I’ve pulled screenshots from this </em><a href="https://help.tally.xyz/article/26-vote-on-an-active-proposal"><em>Tally.xyz tutorial</em></a><em> to show what an active proposal would look like.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jXJgEZKueL4S2AQH" /></figure><p><em>Note: Your voting power is equal to what it is at proposal submission time, the community will want to make sure they have enough FLX voting power to protect the protocol from sudden malicious proposals</em></p><p>4. Clicking “Vote” will bring up the screen below. Here you can choose to vote “For”, “Against”, or “Abstain” on the proposal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/0*prImRwqtJ-uNYkSR" /></figure><p>5. Once you’ve decided how to vote, click submit, and you’re done!</p><p>6. Welcome to ReflexerDAO.</p><h3>Join the RAI-volution 🗿</h3><ul><li><a href="https://community.reflexer.finance/t/dao-governance-2-0/368">RAI Governance Process Overview</a></li><li><a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8">RAI Governance Portal (Tally)</a></li><li><a href="https://reflexer.finance/">RAI website</a></li><li><a href="https://dune.com/kyoronut/RAI">RAI Dune Dashboard</a> (price charts)</li><li><a href="https://reflexer-labs.github.io/geb-data-science/controller/output/index.html">RAI Forward Guidance</a> (price &amp; rate charts)</li><li><a href="https://discord.gg/SwYjUtG5qU">RAI Discord</a></li><li><a href="https://twitter.com/reflexerfinance">RAI Twitter</a></li><li><a href="https://docs.reflexer.finance/keepers/surplus-auction-keeper">RAI Docs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b32b8b696fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/how-to-vote-on-reflexer-dao-proposals-b32b8b696fc">How to Vote on Reflexer DAO Proposals</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Marching Towards Ungovernance]]></title>
            <link>https://medium.com/reflexer-labs/marching-towards-ungovernance-19a220dbdefd?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/19a220dbdefd</guid>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[eth]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[dao]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Reza Jafery]]></dc:creator>
            <pubDate>Mon, 29 Aug 2022 16:13:03 GMT</pubDate>
            <atom:updated>2022-08-29T16:13:03.204Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ijKvsdyp6uiT94MB" /></figure><h4>Cutting the multisig umbilical cord and putting control of core modules in the hands of governance</h4><p>One of the core values guiding RAI so far has been “ungovernance”, which we define as progressively revoking privileged permissions over the protocol. To maximize protocol reliability and minimize the influence of unpredictable humans, we aim to remove our ability to change any protocol parameters that we can safely freeze, and make tampering with the remaining protocol parameters as difficult as we can.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*nyj92udEqul_X4c8" /></figure><h3>Cutting the cord</h3><p>Over the past few months, we’ve frozen most of the protocol parameters permanently. To see the parameters we have frozen and which we are keeping governed, please see the posts <a href="https://community.reflexer.finance/t/rai-controller-ungovernance/208/14">Overview of Ungovernance Phase 1</a> and <a href="https://community.reflexer.finance/t/overview-of-ungovernance-phase-two/291">Overview of Ungovernance Phase 2</a> on the Reflexer forum.</p><p>The protocol contracts that are still mostly governed can be grouped into the following categories:</p><ul><li>Contracts that interact with or receive data from the outside world (oracles, ETH OSM, saviors)</li><li>Contracts that manage internal resources that are used to incentivize outside behavior (SF treasury, debt popper rewards, rewards relayers for oracles)</li><li>RAI controller contract/s</li><li>Contracts that are part of the governance module (e.g DS Pause)</li></ul><p>Now that RAI is largely ungoverned, the final stage of Ungovernance Phase 2 is revoking the multisig. Once multisig access is revoked, the sole power to update protocol parameters will be in the hands of the newly formed <a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8">Reflexer DAO</a>, a Compound Bravo deployment hosted through Tally.</p><p>From this point forward, <em>only governance can ungovern governance</em>, all parameter updates will have to be made through governance proposals. By kicking our multisig out, we’ve essentially cut the umbilical cord between the original team and the RAI system, putting RAI completely in the hands of the community.</p><h4>Revoking the multisig</h4><p>Revoking the multisig was a 5 step process:</p><ol><li>We deployed the Reflexer DAO with the appropriate governance parameters: <em>3-day voting period, 1-day timelock execution delay, 3K FLX proposal submission threshold, and 20K FLX quorum required to pass.</em></li><li>The multisig granted the Reflexer DAO access to the RAI protocol (<a href="https://etherscan.io/tx/0xb57fdc531e24ef7a08218a328f1c03996a0a7378b5051ebd8180e6b397b09d4e">tx link</a>). The multisig was still the “owner” of the RAI system, but now the deployed governance could also submit and execute RAI protocol updates.</li><li>Governance <a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8/proposal/6">voted to change the timelock</a>, which made it the owner of the RAI system, but with the multisig still having <em>access</em> such that the multisig could also make changes.</li><li>Then, we tested the ability of governance to change parameters via the following proposals: <a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8/proposal/7">update the gas oracle parameter</a> and <a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8/proposal/9">send a payment from the DAO treasury</a>.</li><li>The final step is revoking the multisig access, such that all future RAI protocol updates and treasury proposals MUST go through the <a href="https://community.reflexer.finance/t/dao-governance-process/265/5?u=sionescu">RAI governance process</a>.</li></ol><h3>What this means for RAI</h3><p>From now on:</p><ul><li>All protocol parameter updates must happen via governance</li><li>Governance must approve DAO payrolls and incentives</li><li>Governance has total and exclusive control (no more multisigs)</li><li>Only governance can ungovern the governance</li></ul><p>At this point, there’s very little we (the Reflexer team) can do if something unexpected occurs. Our hands are now tied, any changes will require a vote, and be subject to a 4-day timelock before being executed on.</p><p>P.S. this isn’t Snapshot, <em>all governance proposals are binding.</em></p><p><em>“It’s as if we’re watching our child leave home to go to university. We’ve done all we can to prepare for them for this moment, and it’s a bit nervewracking to watch them walk out that door” </em>— Fabio, Security Lead</p><p>Moving forward, all RAI community members must exercise constant vigilance and work together to detect and thwart any potential governance attacks against the protocol, as we continue marching towards ungovernance.</p><h3>Relevant Information</h3><p><a href="https://etherscan.io/address/0x427A277eA53e25143B3b509C684aA4D0EB8bA01b">Multisig Contract<br></a><a href="https://www.tally.xyz/governance/eip155:1:0x7a6BBe7fDd793CC9ab7e0fc33605FCd2D19371E8">DAO Contract Address<br></a><a href="https://community.reflexer.finance/t/rai-controller-ungovernance/208/14">Overview of Ungovernance Phase 1<br></a><a href="https://community.reflexer.finance/t/overview-of-ungovernance-phase-two/291">Overview of Ungovernance Phase 2</a></p><h3>Join the RAI-volution 🗿</h3><ul><li><a href="https://reflexer.finance/">RAI website</a></li><li><a href="https://dune.com/kyoronut/RAI">RAI Dune Dashboard</a> (price charts)</li><li><a href="https://reflexer-labs.github.io/geb-data-science/controller/output/index.html">RAI Forward Guidance</a> (price &amp; rate charts)</li><li><a href="https://discord.gg/SwYjUtG5qU">RAI Discord</a></li><li><a href="https://twitter.com/reflexerfinance">RAI Twitter</a></li><li><a href="https://docs.reflexer.finance/keepers/surplus-auction-keeper">RAI Docs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19a220dbdefd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/marching-towards-ungovernance-19a220dbdefd">Marching Towards Ungovernance</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAI I-term Tuning Update]]></title>
            <link>https://medium.com/reflexer-labs/rai-i-term-tuning-update-a6a8de72f86?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/a6a8de72f86</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[stable-coin]]></category>
            <dc:creator><![CDATA[Ameen Soleimani]]></dc:creator>
            <pubDate>Fri, 26 Aug 2022 16:19:43 GMT</pubDate>
            <atom:updated>2022-09-12T22:50:38.309Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*gJCFSjbgJI9VgBhihe9f_w.png" /></figure><p><em>This post will go over the results of the first attempt at tuning the integral (I) term as part of RAI’s onchain PI controller implementation. For an introduction to what RAI is and how it works, please read the </em><a href="https://github.com/reflexer-labs/whitepapers/blob/master/English/rai-english.pdf"><em>whitepaper</em></a><em> or my </em><a href="https://ameensol.medium.com/a-money-god-raises-rai-is-live-on-ethereum-mainnet-f9aff2b1d331"><em>RAI launch post</em></a><em>.</em></p><h4>Background</h4><ul><li>RAI is a USD-denominated, floating exchange rate stablecoin that can only be minted using ETH collateral</li><li>RAI uses an onchain PI controller to autonomously sets the redemption rate to oppose market imbalances and drive market price → redemption price convergence</li><li>Tuning PID controllers for dynamic real world systems takes time, we ran the controller in P-only mode for 1 year despite the full code for PI being done</li><li>After we settled on what seems to be a reasonable parameter for the P-term, <a href="https://community.reflexer.finance/t/rai-controller-ungovernance/208/13">we added the I-term in Feb 2022</a> as part of a 6-month planned experiment to evaluate its effects in prod</li><li>In this post we go over what we learned and what comes next!</li></ul><h4>PI Controller Design</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ou5EF5Bo-y7iiUWo.png" /><figcaption>RAI prices and rates since we turned on the I-term on Feb 23rd, 2022 — <a href="https://github.com/reflexer-labs/geb-data-science/blob/master/controller/output/controller_monitoring.png">source</a></figcaption></figure><p>What separates RAI from other $1 pegged stablecoins is that RAI doesn’t have a fixed $1 peg, instead it actively updates its own peg — called the <em>redemption price — </em>to oppose deviations of the market price from the redemption price. RAI uses an onchain PI controller to set the rate of change of its redemption price — called the <em>redemption rate — </em>which is expressed as an annual interest rate. The <em>sensitivity</em> of the redemption rate to market price deviations is determined by the controller PI parameters, which we aim to <em>tune</em> such that RAI is able to autonomously maintain price stability in the face of a wide variety of scenarios and potential shocks.</p><p>A PI controller is composed of two terms, the Proportional (P) and the Integral (I). The proportional term is based on the current error only, and so will immediately reset the redemption rate to 0% as the error goes away. The error is defined as the difference between the RAI redemption price (also called the “target price”) and the RAI market price. The integral term accumulates error over time, increasing the redemption rate with the duration of error, and not just its magnitude (unlike the P-term, which has no time component). The final redemption rate set by the controller is calculated by adding the rates determined by the P-term and I-term together, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jgIitbrqYpOtouFi.png" /><figcaption>PI Controller Update (Reflexer Forum) — <a href="https://community.reflexer.finance/t/rai-controller-ungovernance/208/13">https://community.reflexer.finance/t/rai-controller-ungovernance/208/13</a></figcaption></figure><p>The reason the controller has two terms is because the P-term and I-term operate at different timescales, allowing the controller to detect and response to both sudden and prolonged disturbances. The P-term is more important for responding to sudden shocks, as it can quickly ramp up as RAI detects a price shock and reset just as quickly as the price shock fades. The I-term is more important for correcting prolonged price deviations — called <em>steady state error — </em>as it will ramp up slowly, getting stronger so long as the error persists, and then only resetting slowly over time. The idea is for the I term hold the redemption rate at whatever value brings the error to zero. In effect, the I term is searching for the average long term redemption rate that will keep the error at zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/0*Fp6fgBMsNhVymY23.png" /><figcaption>RAI History — 7/28 (<a href="https://reflexer-labs.github.io/geb-data-science/controller/output/index.html">source</a>)</figcaption></figure><p>Before we move on to parameter tuning, let’s look at how the two rates work together in practice. In the last few months of RAI, pictured above, we have two distinct shocks that RAI responded to. The first shock was during the Luna/UST collapse from 5/12–5/20, about 1 week. During that time the ETH price stayed relatively stable around $2,000 (down from ~$3,000 1 week earlier), but the RAI market price spiked up 2% above the redemption price. The controller <em>immediately</em> responded by setting a P-rate of -15%/y, and RAI market participants began to respond to the negative rates by selling RAI, driving the price down. As prices converged over the week, the P-rate was proportionally<em> </em>reduced back to around -3%/y. In the same time period, the I-rate <em>gradually</em> grew from -1%/y to -3%/y.</p><p>The second shock was during the 3AC liquidation &amp; contagion starting 6/15 and was mostly over by 7/15, lasting about a month. The ETH price remained around $1,200 during the shock, down from $1,800 the previous week. The price of RAI spiked up to $3.05, about 2% up from the redemption price, and then over the next two weeks climbed to $3.09 while the redemption price dropped to $2.96 (due to negative rates), so the peak error was around 4.4%, resulting in a peak P-rate of -27%/y and an I-rate of -6%/y, for a total redemption rate of -33%/y. After two weeks the RAI market price started dropping back towards the redemption price, quickly resetting the P-rate back to single digits even while the I-rate grew from -6%/y to -11%/y. The <em>inflection point</em> of the I-rate corresponds to the peak P-rate, because once the P-rate stops growing, the I-rate growth starts <em>decelerating,</em> and then eventually starts shrinking.</p><p>For the purposes of tuning the controller parameters, we are concerned with questions like:</p><ul><li>Is the controller working?</li><li>Are the controller parameters <em>optimal?</em></li><li>How well can the controller handle extreme cases?</li></ul><h3>Is the controller working?</h3><p>On the surface, it looks to be that way. The purpose of the controller is to set rates to correct market price imbalances, and in both cases above the controller set rates were sufficient to do so. One might naturally wonder about the counterfactual scenario: “would the market price error have been corrected <em>without</em> the controller set rates?” We are extremely fortunate to be able to compare RAI with LUSD, a $1 pegged stablecoin also backed only by ETH, as a sort of control group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eiBR0DvcsywCzVt_.png" /><figcaption>LUSD — <a href="https://dune.com/kyoronut/LUSD-supply">https://dune.com/kyoronut/LUSD-supply</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SI5sYRS_Z4PUn83E.png" /><figcaption>RAI — <a href="https://dune.com/kyoronut/RAI">https://dune.com/kyoronut/RAI</a></figcaption></figure><p>These charts look different. Compared to the LUSD chart, the RAI chart looks like it has <em>gravity, </em>with the redemption price eventually pulling the market price back to equilibrium.</p><p>LUSD, by virtue of its $1 peg, can’t impose negative interest rates, and so it has no additional incentives to offer market participants besides the price arbitrage opportunity to help correct the LUSD price back to $1. In the 6 weeks after the mid-June shock, LUSD has steadily climbed up to $1.04 (4% error).</p><p>RAI on the other hand <em>devalued</em> its peg down around 3% over the six week period (since mid-June), and corrected the market price gap down to just 0.5%. So we can conclude that the controller is fact working. 🗿</p><p>Of course, this stability comes with a cost, in this case realized as a 3% net value transfer from RAI holders to RAI borrowers. For a longer comparison between LUSD and RAI, see this<a href="https://twitter.com/ameensol/status/1548374997072166914"> thread</a> I wrote titled: “How I learned to stop worrying and love negative interest rates”.</p><h3>Are the controller parameters optimal?</h3><p>There are 3 parameters to tune in RAI: Kp, Ki, and integral decay.</p><p>Kp and Ki are constants that determine the sensitivity of the P-term and I-term to error. The Ki controls the rate at which the I-rate accumulates error. Integral decay determines the rate at which the accumulated I-rate resets back to 0%. Right now, the integral decay half-life is set to 30 days.</p><p><strong>Tuning the Proportional Term: Kp</strong></p><p>The Kp is currently tuned to offset any price error in about 1–2 months, depending on the market response. For example, given a constant -10% price error, the P-rate will reduce the redemption price by 10% after 50 days, and likewise for the reverse case with a constant +10% price error. The charts below simulate example scenarios with the controller in P-only mode, with Kp set to its mainnet value, and with market price and redemption price both starting at $3.00.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tCjDGj2YsWChB-7X.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*peNk8iscnNU4ku4_.png" /><figcaption><strong>left: </strong>mkt price stays 10% &gt; red price → 50 days to offset; <strong>right:</strong> mkt price stays 10% &lt; red price → 50 days to offset</figcaption></figure><p>If the market is unwilling to accommodate the controller rates and the market price stays constant after a 10% price shock, the P-rate increases the error, which in turn increases the P-rate, and so on exponentially. In this scenario (shown below), the controller updates the redemption price to offset the market price error in 37 days. The exponential growth of the P-rate is due to the RAI control system being somewhat unique. The RAI controller output results in changes to the <em>setpoint</em>, which in our case is the redemption price, which gives a P-only controller (in this scenario) integral-like qualities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yWLjuZwNwqMhUdX8.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DpQYX8IQz958p02h.png" /><figcaption><strong>left:</strong> mkt price fixed at +10% init red price → offset in 37 days; <strong>right:</strong> mkt price fixed at -10% init red price → offset in 37 days</figcaption></figure><p>The <em>10%</em> number for the initial error was arbitrary, the P-rate will takes <em>roughly</em> the same amount of time to offset a 10% error as a 1% error (as seen below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JlZ8nQPwf9AU4JNy.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Cht4QMWS5CIMBs86.png" /><figcaption><strong>left:</strong> mkt price fixed at +1% init red price → offset in 37 days; <strong>right:</strong> mkt price stays 1% &lt; red price → 52 days to offset</figcaption></figure><p><em>Note — the error % is calculated from redemption price — market price, so when the market price is +1% above the redemption price, the error is -1%, and when the market price is 1% below the redemption price, the error is +1%.</em></p><p>In practical terms, the scenarios above represent supply shock and demand shock.</p><p>In the supply shock scenario, RAI is scarce and the market price is up +10%. RAI borrowers who want to buy RAI to repay their debts to avoid liquidation while RAI is trading at a premium are faced with what amounts to an exit tax, imposed on them by the other RAI holders who are unwilling to sell, even at a premium. With the Kp tuned as it is, RAI borrowers can have a predictable 1–2 month timeframe over which the redemption price will drop 10% offset the market price premium. In the <em>constant error</em> scenario, the RAI market price will have also dropped 10% after 50 days, allowing RAI borrowers to exit at the initial market price before the supply shock. In the <em>constant price</em> scenario, it would only take 37 days for the redemption price to offset the initial market price shock, which would in turn double the price error, doubling the P-rate, growing exponentially until price convergence.</p><p>The demand shock scenario is the same as above but reversed. RAI is overly abundant and the market price is down 10%. RAI holders who want to sell can only do so at a discount, or wait the 1–2 months for the redemption price to offset the market price shock and drive the RAI market price back up.</p><p>In practice, this timing of 1–2 months seems like a reasonable pace for the controller to oppose market shocks. A year would be too slow, and a week would be too quick. And as we mentioned above, RAI handled its most recent supply shock gracefully, reducing the redemption price by roughly 3–4% over 6 weeks to offset a 3–4% market price error over that timeframe, thus driving price convergence.</p><p><strong>Tuning the Integral Term: Ki and Integral Decay</strong></p><p>Just like deciding how fast &amp; far to turn the knob of a new shower to get to the ideal temperature, the RAI controller parameters are optimal when they achieve system stability in a reasonable timeframe and without significant overshoot.</p><p>An important factor to consider as you adjust your shower is the time it takes before you start to feel any change in temperature at all — in control systems this is called the <em>latency</em> (also called “dead time”). If you turn the knob too quickly before you feel anything, you are likely to overshoot. Likewise for RAI, if there are structural limitations that prevent the market participants from reacting to the controller set rates, they are important to pay attention to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/0*niRSGRGieviuUYXr.png" /><figcaption>RAI History — 7/28 (<a href="https://reflexer-labs.github.io/geb-data-science/controller/output/index.html">source</a>)</figcaption></figure><p>For example, it took dxDAO, the largest single RAI holder (holding ~20% of the RAI supply), about two weeks of elevated rates to submit their proposal to sell 70% of their 1M RAI (June 24th), and due to a voting period and execution delays, it was another 11 days before their first RAI sale (July 4th). In their proposal they cited a RAI rate of -17.9%/y, which was enough of an impetus for them to sell. The rate peaked at -33%/y on June 30th, a few days before they sold.</p><p>From this, we could estimate that the latency for RAI market participants responding to rate updates is currently about <strong>2–3 weeks</strong>. Some RAI holders sold sooner, and some RAI shorts went in earlier as well, but RAI selling by holders and arbitrageurs only happened in earnest after a 2–3 week delay.</p><p>What that tells me is that the integral term is probably <em>not optimal </em>(for the current RAI market dynamics) and probably <em>too sensitive. </em>This is because the integral rate was ramping up in the 2–3 week latency window. At the time that dxDAO decided to sell, the redemption rate was -17.9%/y, and only ~25% (-4%/y) of that was I-rate, with the remaining 75% being the P-rate. By the time they sold a few weeks later, the I-rate had already ramped up to -10%/y. This might not seem like a problem given the peak P-rate was -27%/y, but unlike the P-rate, the I-rate is sticky, so the accumulated -10%/y doesn’t go away instantly once price equilibrium is reached, and continues to impact the redemption price for some time. This means that while the I-rate probably only played a small part in the dxDAO decision to sell, it had a large impact in the net change in redemption price.</p><p>As a refresher, changes in the redemption price are felt by RAI borrowers and RAI holders as a net value transfer between the two parties. When the redemption rate is positive, it means RAI borrowers are paying RAI holders. When the redemption rate is negative, it means RAI holders are paying RAI borrowers. Thus the RAI system stabilizes by imposing <em>net value transfers</em> between RAI borrowers and holders to oppose market price movements. In this system “overshoot” can be thought of as “excess” net value transfer between RAI borrowers and holders, where the redemption price moved <em>more than it needed to</em> in order to achieve price convergence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dUkfxi-ro6cUj4Wu.png" /><figcaption>Updated RAI History, as of 8/20 (<a href="https://reflexer-labs.github.io/geb-data-science/controller/output/index.html">source</a>)</figcaption></figure><p>Above is an updated chart of the RAI price/rate history. After mid-July when the redemption and market prices converged, the P-rate went to the low single digits (2–3%/y) and the I-rate started to dominate. For the next two months, the I-rate was the main contributor to the falling redemption price, which fell from ~$2.93 on July 15th to ~$2.89 by August 15th. This continued drop in the redemption price for months, even after price equilibrium was mostly achieved is what makes me believe that the integral response was too strong and resulted in overshoot.</p><p>Since we know that the net change in the redemption price is equal to the integral of the redemption rate over time, we can estimate it by looking at the area under the curve of the P-rate and I-rate in the chart above. The blue area (integral of P-rate) and the orange area (integral of I-rate) represent the respective contribution of each to the net change in redemption price. In other words, the summary of my argument for updating the I-rate params is: “the blue area seems about right, the orange area grows too big too fast”.</p><p>Now, it could be argued that in a counterfactual scenario without the I-rate as strong as it was, RAI holders and arbitrageurs may have taken longer to sell and short RAI back to equilibrium, but given the structural limitations around the dxDAO sell timing and their decision to do so at a redemption rate of 17.9%/y (with the I-rate being only ~4%/y of that), I don’t think the I-rate played a significant role in correcting the most recent shock.</p><p><strong>Integral Windup</strong></p><p>The tendency in PI controllers for the integral response to accumulate too much and contribute to overshoot is called <a href="https://en.wikipedia.org/wiki/Integral_windup">integral windup</a>. In RAI, we proactively introduced the integral decay half-life of 30 days to mitigate the effects of integral windup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ga2AXe5fePgigjNM.png" /><figcaption>RAI forward guidance — immediate convergence (<a href="https://reflexer-labs.github.io/geb-data-science/controller/output/index.html">source</a>)</figcaption></figure><p>As the chart above shows, should the RAI price reach immediate convergence (market price = redemption price), the I-rate will decay back to 0%/y with a 30 day half life. So if on the day of convergence RAI is -7%/y (as above), 30 days later the I-rate will be -3.5%/y, and so on.</p><p>Of course, this projection only holds if the market price also drops in unison with the redemption price as the integral rate continues to decrease the redemption price, maintaining price convergence. So far however, we observe (in the part of the chart before the dotted line) that while RAI came close to convergence in late July and early August, the market price has not decreased with the redemption price, leading to an uptick in error and the P-rate, and a slowdown in the rate at which the I-rate is reseting to 0%/y (because the I-rate is now accumulating increased error).</p><p><strong>Interplay Between the P and I rates</strong></p><p>We should be <em>afraid</em> of the I-rate winding up. As the I-rate <em>unwinds, </em>if the market price doesn’t follow the redemption price, the increased price error will increase the P-rate, and could lead to a feedback loop that exacerbates the error, prevents the integral from ever completely unwinding, and gradually drives the RAI redemption price to 0 or infinity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v6fC3dOQ0diF1IKl.jpeg" /><figcaption>discord notes on integral windup — 7/11/2022 (<a href="https://discord.gg/TMHFU7BrP4">join discord</a>)</figcaption></figure><p>Vitalik was <a href="https://community.reflexer.finance/t/rai-controller-ungovernance/208/10">ultimately correct</a> to fear the complexity introduced by the integral term. The interaction between the I-rate unwinding and the P-rate means that an I-rate of some value is much more powerful than the equivalent P-rate in terms of how far it can drive the redemption price. For example, given the current prod Ki and integral decay half life of 30 days, an I-rate of -10%/y will drop the redemption price by ~1% over 2 months as it decays from -10%/y to -2.5%/y. If the market price doesn’t follow the redemption price down, this new 1% price error will also induce a P-rate of -7%/y. This 1% error will also get accumulated by the I-rate, which all else equal reaches -4%/y after 1 month of 1% error. Thus the total redemption rate will linger around -10%/y, and the I-rate won’t actually decay to 0%/y.</p><p>The takeaway is this: For the I-rate to properly reset, the market price either needs to:</p><ol><li>maintain price convergence until I-rate resets (see “immediate convergence” chart above)</li><li>overshoot the redemption price (see the two charts below)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wO2W337chC3bHn3J.png" /><figcaption>RAI overshoots: redemption rate → 0%/y</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0eU3qYA5uVKlYb_t.png" /><figcaption>RAI overshoots: redemption price → market price</figcaption></figure><p>So far, however, we have yet to observe the overshoot required to reset the I-rate. Instead we observe the I-rate attempting to unwind, but not quite succeeding as the market price isn’t maintaining convergence with the redemption price as it drops, let alone overshooting.</p><p>If RAI <em>only</em> used an I-term, this effect would be mitigated as the unwinding I-rate wouldn’t trigger the P-rate feedback loop. If RAI didn’t use an I-term at all, this interaction obviously wouldn’t be a problem. But currently with RAI using both the I-term and P-term, we see the I-rate contributing to induced error and increased P-rate, preventing the I-rate from decaying as intended.</p><p><strong>Parameter suggestions for Ki and integral decay</strong></p><p>The RAI controller P-term performs well at opposing sudden shocks, as the last few months have demonstrated once again. The addition of the I-term, in my opinion, didn’t seem to significantly enhance the shock response, but it did contribute (and is continuing to contribute) to redemption price overshoot. And we haven’t yet observed the I-rate responding gradually to steady state error, as intended.</p><p>As such, we want to mitigate the potential for integral windup in response to short term shocks, but maintain the ability for RAI to have directional interest rates at equilibrium, which the I-rate allows. To do this, I propose weakening the Ki by roughly a factor of ~5x, and updating the integral decay to a 90 day half life.</p><ul><li>Ki: 2.4E-14 → 5.55E-15</li><li>integral decay: 30 day half-life → 90 day half-life</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*srHm-OZfEn1zjMAF.png" /><figcaption>projected rates simulations for proposed params, current prod params, and their ratio</figcaption></figure><p>The way to read the above sheet is as follows:</p><ul><li>the top sheet is for our proposed PI parameters</li><li>the middle sheet is for our current production PI params</li><li>the bottom sheet shows the ratio of the rates under the proposed PI params to the rates under the current PI params</li><li>the left column is error %, showing both positive and negative for 1,3,5,10 error %</li><li>the P-rate % column is the redemption rate contribution from the P-term, constant over time</li><li>the 30d/60d/etc PI-rate % column represents the redemption rate after 30d of 1,3,5,10 error %</li><li>the 30d/60d/etc I-rate % column represents the APY of the I-rate by itself (e.g. the redemption rate if equilibrium was reached the next day)</li><li>so in <strong>prod</strong> today, if the system encountered a +1% error, after 30d the redemption rate would be 11.9%/y, with the I-rate contributing 4.23%/y</li><li>the same +1% error after 30d with the <strong>proposed</strong> params would only result in a 8.6%/y rate, with the I-rate contributing 1.2%/y</li></ul><p>As we can observe, the P-rate is still doing most of the work in terms of the controller response, with the I-rate only kicking in if errors persist for long periods of time. The relevant box for the last few months is the -3% error for 30d, which results in a -28.6%/y redemption rate with our current prod params and only a -22%/y redemption rate with the proposed params. Putting aside the -19.2%/y P-rate, the I-rate with the current prod params would have been -11.7%/y, but with the proposed params would be only -3.5%/y. Given what we know about the danger of integral windup, these I-rates seem less potentially destabilizing than what we have with the current prod params.</p><p>With a 90d half life, the I-rate will decay 3x slower, decaying 50% over 3 months instead of each month. This will allow the newly weaker I-rate to still gradually accumulate in response to persisted error while better skipping over short-term shocks. Specifically, if we observe the ratio of the redemption rates set by the proposed params to the rates set by the current params, the proposed I-rates are about ~3x lower in the short term (30–60 days), ~2x lower in the medium term (90–180 days), and only ~30% lower in the long term (360 days). This is consistent with our objective of pushing out the timescale of the integral response from 1–2 months to 3–6 months. We also observe that the overall reduction the combined PI rate with the proposed I-rate params is only around 30%.</p><p>Similar to how the P-rate is tuned to offset the redemption price by the error in 1–2 months, we can measure how long it takes for the I-rate to first accumulate and then offset a given error. With a 90 day integral half life for the integral decay, the net redemption price offset after 1 year for an accumulated I-rate is roughly 33% of the I-rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*clJ-q0P_RrNkLjqM.png" /><figcaption>90 day half-life: redemption price offset for an I-rate starting at -10%/y after 1 year is roughly 3.3%</figcaption></figure><p>For example, as the chart above shows, a -10%/y I-rate will shift an initial redemption price of $3.00 to $2.90 over a 1 year, a 3.3% drop.</p><p>The proposed I-rate accumulates the error as a redemption rate roughly linearly for the first 90 days, then slowing down as the 90 day half-life integral decay kicks in. For example, an error of 1% results in an I-rate of 1.2%/y after 30 days, 2.16%/y after 60 days, 2.92%/y after 90 days, 4.34%/y after 180 days, and 5.34%/y after 360 days.</p><p>Combining the accumulation and offset relationships above, we can see that the I-rate would only accumulate enough to offset a 1% error after roughly 90 days. This is because it would take 90 days for the I-rate to accumulate up to 2.92%/y, and over the next year the accumulated I-rate would shift the redemption price by 33% of 2.92%, or ~1%. By playing this out we can more clearly understand the effects of the I-rate parameters. The I-rate <em>accumulation </em>rate is primarily driven by the Ki parameter, while the <em>net redemption price offset </em>is primarily driven by the integral decay parameter.</p><p>By weakening the Ki by ~5x, we slow down the accumulation of the I-rate, but by increasing the half-life from 30 days to 90 days, we increase the resulting offset for a given I-rate. For comparison, with the current integral decay half-life of 30 days, a -10%/y I-rate would only result in a redemption price offset of 1.1%, 3x lower than with a half-life of 90 days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NEg-yxC-6Ebof4T0.png" /><figcaption>30 day half-life: redemption price offset for an I-rate starting at -10%/y after 1 year is roughly 1.1%</figcaption></figure><p>From this, we can also infer that in a certain sense, even though we are proposing to weaken the accumulation rate of the I-rate (Ki), because we are also proposing to slow down the integral decay as well, we would still be making the integral response <em>stronger</em>. For any I-rate under the proposed 90 day half-life decay, the net redemption price offset will be 3x what it would be under the current I-rate 30 day half-life decay.</p><p>In English, the integral decay half-life of 90 days means that of the accumulated I-rate, 50% of it reflects the previous quarter, 75% reflects the previous half-year, 87.5% represents the previous 9-months, and 93.75% of the I-rate reflects the previous year. A 1-year lookback window with 50% of the weight placed on the most recent quarter seems like a reasonable timeframe to consider historical price error.</p><p>Note that while this parameter change should serve to <em>mitigate</em> the potential for integral windup, it doesn’t prevent it. The integral can still wind up to -10%/y as it did recently, it would just take 30d at -10% error or 60d at -5% error to get there, instead of 30d of -3% error as we just saw. This feels more sensible, because the main problem with the current I-rate was that the integral was ramping up within the 2–3 week latency window. That said, we should be aware that if the I-rate <em>does</em> reach -10%/y with the new decay, it will decay 3x more slowly, and will move the redemption price further.</p><p><strong>I-term Migration Complications</strong></p><p>One annoying gotcha about migrating to a new Ki and integral decay is that unless the I-rate is 0%/y at the time of the migration, the existing I-rate will inevitably be effected. For example, we want to weaken the Ki and increase the integral decay half-life from 30d to 90d, but if we did this tomorrow, the <em>existing I-rate</em> will start to decay slower and thus actually be somewhat <em>stronger</em>. The actual I-rate value wouldn’t increase, but the I-rate would take longer to decay, so the existing I-rate it would have a greater net impact on the redemption rate. If we don’t want to wait for the I-rate to hit 0%/y, but also don’t to slow down the decay of our existing I-rate, we could reset the I-rate to 0%/y ourselves as part of the migration. This has the unfortunate effect of being a “violation” of the Money God and our aspirations of controller ungovernance.</p><p>To mitigate the possibility for sacrilege, one option is to first update the Ki to its new weaker value, and only later update the integral decay once the existing I-rate has come down more from its current value of -7.5%/y. Should the I-rate still take too long to unwind, however, I would suggest time-boxing this parameter update to take place within 3–4 months, or sometime before the end of 2022, with the exact date broadcasted well in advance.</p><p>I will note here that should we decide in the future to further update the I-term parameters, the same migration complications will apply. RAI users who made financial projections around the I-rate will necessarily need to update their expectations based on the new I-term parameters, so any parameter updates would have to be broadcast in advance.</p><p>Our goal, of course, is to identify controller parameters such that we can ungovern RAI and allow the controller to autonomously drive RAI stability without human interference. Ideally, the proposed Ki and integral decay parameters are final and never need to be changed again.</p><p>However, if RAI grows such that the major market participants are mega-DAOs and other larger, slower-moving capital allocators, the latency may increase from 2–3 weeks to 2–3 months, and we might find ourselves once again wanting to update the controller parameters, and we will attempt to do so such that <em>those</em> parameters are final.</p><p><strong>Summary of I-rate Update Proposal</strong></p><p>For our first attempt at tuning the Ki and integral decay params, we were running an experiment with a 6-month timeline, and so intentionally made the I-rate stronger and also decay more quickly so we could observe the lifecycle of the I-rate as it wound up and wound down, and its effect on the market. The experiment concluded and we observed that the I-rate was ramping up too much and too quickly, within the system latency window, and resulting in overshoot. We also observed unexpected interaction with the P-rate, amplifying the effect of the I-rate.</p><p>For our second attempt at tuning the Ki and integral decay params, we are optimistic that the proposed parameters are final and close to optimal. We propose to weaken the Ki by 5x and slow down the integral decay rate by 3x, such that the I-rate has a 1 year lookback window. We expect this will diminish the I-rate response to short term shocks, while maintaining most of the I-rate response to long-term disturbances.</p><h3>How well can the controller handle extreme cases?</h3><p>When tuning the RAI controller parameters, it’s also important to evaluate their performance at the limits. Note — for the following simulations we use the <em>proposed</em> Ki and integral decay parameters.</p><p><strong>10% Demand Shock — Constant Price</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5X_tVY0QQGNEcpQe.png" /></figure><p>Suppose RAI is being dumped en masse (demand shock) and the price remains -10% from some initial redemption price. The RAI redemption rate starts at 100%/y from the P-rate and increases exponentially until price convergence. In the scenario above, after 60 days the redemption price is $3.66, the P-rate is 500%/y, but the I-rate is only about 13%/y, so the integral windup is relatively low. The main risk a rising redemption poses is to RAI borrowers, who see their RAI debt become more valuable in USD terms and may get liquidated as a result. The risk to the protocol during a demand shock as described is minimal.</p><p><strong>10% Supply Shock — Constant Price</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FHPnQ3MLEc3Eryyf.png" /></figure><p>On the other hand, suppose RAI is being hoarded (supply shock) and the price remains +10% from some initial redemption price. The RAI redemption rate starts at -50%/y from the P-rate and decreases exponentially until convergence. After 60 days the redemption price is $2.35, the P-rate is -93.8%/y, and the I-rate is -14%/y, so again the integral windup is relatively low. In this scenario individual RAI holders and borrowers aren’t at risk of liquidation, but there is a real protocol risk present.</p><p>If the RAI market price is ever 10% above the RAI redemption price, it is no longer profitable to liquidate RAI borrowers whose debt exceeds their minimum collateral ratio (135%). This is because the maximum collateral discount offered to liquidators in the RAI system is 10%. If the price of RAI is +10% above the redemption price as ETH crashes, it could lead to bad debt accumulating in the RAI protocol.</p><p>To somewhat mitigate this risk, RAI <a href="https://community.reflexer.finance/t/overview-of-ungovernance-phase-two/291/4">increased the duration of liquidation collateral auctions </a>from 3 days to 28 days, which provides additional time for the RAI market price to come down to a value less than 10% higher than the redemption price, such that liquidations can still be profitably processed.</p><p><strong>10% Supply Shock — Constant Error</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tA_5vJnO3nN4pM9L.png" /></figure><p>Given the same 10% supply shock, but this time with constant -10% error, we observe that the P-rate is -50%/y and the I-rate only grows to ~5%/y after 30 days. In other words, if the market price of RAI is ever slightly more than +10% above the redemption price, we are counting primarily the -50%/y redemption rate to sufficiently incentivize RAI selling until the price gap is less than 10% and liquidations are once again profitable.</p><p><strong>Maximum Rates</strong></p><p>As we explained in <a href="https://community.reflexer.finance/t/redemption-rate-bounds/301">Redemption Rate Bounds</a>, the maximum RAI redemption rates are -88%/y and 695%/y. For the P-rate by itself to reach these values, the error % must reach +/-30%. When introducing the I-rate, there is an additional complication with the max rates. The numbers above represent the maximum <em>redemption rate</em>, but there is no maximum P-rate or I-rate. This means that the I-rate can continue to accumulate even if the system hits maximum rates, and if it does, will likely result in excess integral windup and make it difficult to recover stability.</p><p>As currently implemented, if the max rates are ever hit and the I-rate is allowed to accumulate while at max rates, it’s probably time to trigger <a href="https://docs.reflexer.finance/system-contracts/shutdown-module/esm">emergency shutdown</a>. Possible solutions to avoid shutdown include:</p><ul><li>raising the redemption rate limits (e.g. by 3–5x)</li><li>adding an additional anti-windup term to the I-rate to make it stop accumulating once the max redemption rate is reached</li><li>weakening the Ki generally (as proposed)</li></ul><p>Weakening the Ki and raising the redemption rate limits are easy to do because they don’t require code changes, and still help mitigate the total potential risk of integral windup at max rates. Adding an additional anti-windup term to the I-rate would be a long term solution, but would also require a code change to the controller.</p><h3>Alternative Proposals</h3><p>There are several other paths we could take for tuning the PI parameters.</p><p><strong>Weakening the P-rate</strong></p><p>The P-rate was tuned in isolation, with the I-rate added on after it was already tuned. As we’ve seen, the I-rate not only combines with the P-rate to set a higher combined PI-rate, but the interplay between the P-rate and I-rate also amplifies the effects of the I-rate. As such, it may be worth considering reducing the Kp now that we’ve added the I-rate. Weakening the Kp would increase the time-to-offset from its current 1–2 months to something higher, say 3–6 months for a 3x reduction in Kp, which could also be more friendly for slower moving capital allocators.</p><p>However, in the interest of tuning one control parameter at a time, I presently propose only adjusting the I-rate, and leaving the P-rate as is. The P-rate has been proven to work in practice, and so we can bootstrap our understanding of the I-rate dynamics while mostly relying on the P-rate to drive stability. In the future, as we build confidence in the I-rate dynamics, we could feasibly rely more on the I-rate to drive stability, and weaken the P-rate.</p><p><strong>Integral Anti-Windup: Clamping</strong></p><p>A common anti-windup technique is called “clamping”, and it involves capping the I-rate accumulation above some error % threshold. In RAI for example, this would look like picking some error % threshold, say 3%, above which the I-rate only accumulates the error as if it was 3%, to limit the maximum growth rate of the I-rate. Given that the purpose of I-rate in the PI model is to resolve steady state error (small errors persisted over long time periods), clamping helps prevent integral windup in response to shocks.</p><p>We originally decided against implementing clamping, primarily because it would have required us to pick the bounds in advance, and we felt somewhat unprepared doing so without first observing the need for doing so in practice. We also felt that the integral decay would help with anti-windup in place of clamping.</p><p>Today I would be more open to clamping the I-rate accumulation in the future, although choosing the clamping bounds would still require additional deliberation. Had we implemented I-rate clamping with a 3% error threshold for example, over the last few months it would have had only a small impact since the error was only around 3–4%.</p><p><strong>Integral Anti-Windup: Tick Integral (e.g. Vox, e.g Nikolai’s Vision)</strong></p><p>Nikolai’s <a href="https://nikolai.fyi/purple/">original design</a> for the <a href="https://mips.makerdao.com/mips/details/MIP20">Vox</a> component of DAI is a controller where rates tick up and down by a constant amount depending on only the <em>sign</em> of the error, ignoring its magnitude. While this controller would no longer be an “integral” since it isn’t integrating anything, it is conceptually similar to a clamped I-rate (as described above), except that the I-rate could be considered <em>always clamped</em>.</p><p>One motivation for this controller, as Nikolai points out, is that PI control may simply be a bad model for stabilizing a currency against a reference asset using by controlling the floating redemption price of the currency. As we discussed earlier, RAI is a unique control system in that the output of the controller — the redemption rate — changes the redemption price setpoint, which gives even a P-only controller integral-like qualities. We also discussed how the net change in the redemption price is integral of the redemption rate. It follows that if the I-rate is the integral of the error, then the I-rate contributions to the redemption rate are a <em>double integral</em> of the error. This is a big part of why we have learned to fear integral windup with the current PI controller.</p><p>The advantage of the Vox controller is that it is “scale invariant”, the only factor determining its rate is the <em>duration</em> of the error, not its magnitude. This makes the Vox effectively ignore <em>all</em> price shocks, and only response to long-term price imbalances. Vox is effectively designed to work like a central bank, slowly ticking rates up and down, with the goal of being friendly for the largest, slowest moving capital allocators. This also makes Vox somewhat <em>unfriendly</em> for smaller, faster moving capital allocators.</p><p>Vox was designed to work without a P-rate. In my view this is risky, because without a P-rate there is no controller response to short term price shocks. Market participants caught offsides during a price shock might be waiting a long time for Vox to ramp up enough to drive price convergence.</p><p>If Vox was run with a P-rate, the Vox + P-rate combo could potentially help address short term shocks, though at the cost of long-term predictability of the redemption price. Vox + P-rate would also likely be subject to the same interactions we observed our P-rate and I-rate, so I would expect the addition of the P-rate to amplify the effect of Vox.</p><p>Vox was also designed to work without an integral decay anti-windup term. This is more reasonable for Vox because Vox itself is already essentially an integral anti-windup term, but still seems risky in that Vox isn’t immune to overshoot, which the integral decay mitigates.</p><p>The main reason we decided not to go with Vox and use a more traditional I-rate was the potential for asymmetry. It didn’t make sense to us that Vox would set the same rate in response to a +1% error as a +10% error, so long as both lasted 1 month. It also didn’t make sense to us that a month of +10% error could be reset by a month of -1% error.</p><p>Upon reflection, we can see that the I-rate + integral decay results in a similar asymmetry. Whereas Vox can reset the rates accumulated from a +10% error with a -1% error so long as they last for the same amount of time, the I-rate + integral decay will also serve to gradually reset the accumulated I-rate, even in the absence of equivalent overshoot. In both cases, the asymmetry is actually <em>helpful</em>, as it mitigates the overshoot required to reset the accumulated rate.</p><p>Moving forward, we may consider migrating RAI from the I-rate to a Vox controller, but for now I think it’s OK to continue the I-rate experiment with the weaker Ki and slower decay. With the integral decay, it isn’t as bad that the I-rate accumulates a 10% error at a rate 10x that of a 1% error, because the decay will still asymptotically reduce the accumulated I-rate to 0 over time, regardless of its starting value. If the integral windup continues to be a concern however, the introduction of clamping or a migration to the Vox may be prudent.</p><h3>Conclusion</h3><p>As the last 18 months of RAI in production have demonstrated, RAI mostly works. The P-rate is simple way to balance RAI supply and demand, and with the addition of the I-rate, RAI can express directional rates even while at price equilibrium. After the last 6 months trial run of the I-rate, we propose to 1) weaken the Ki by a factor of 5x, such that the I-rate accumulates more slowly and 2) to increase the integral delay half-life from 30 days to 90 days, to give market participants more time to respond to the now slower I-rate.</p><p>Should we adopt the new I-rate parameters and run the experiment for another year, my predictions are as follows:</p><ul><li>Most likely — we like the params, finalize it as is or with minor tweaks (if I had to guess right now: we reduce both Kp &amp; Ki by 50%, one at a time, and call it a day)</li><li>Somewhat likely — the I-rate integral windup is still annoying, we weaken Ki even more, or add additional anti-windup like clamping or switch to Vox</li><li>Less likely — we decide that RAI works fine with P-rate by itself</li></ul><p>Either way, I don’t think we’ll regret running the experiment in prod. We will share our findings with our compatriots in the hope that together, we can help humanity transcend the dark ages of central banking. We are already <a href="https://twitter.com/ameensol/status/1559713864547151873/">making progress</a> on our mission!</p><p>Thank you for joining us on this RAI-search adventure!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b_8nrHXBh2nBL4dhKl7vGA.jpeg" /></figure><h4>Join the RAI-volution 🗿</h4><ul><li><a href="https://reflexer.finance/">RAI website</a></li><li><a href="https://dune.com/kyoronut/RAI">RAI Dune Dashboard</a> (price charts)</li><li><a href="https://reflexer-labs.github.io/geb-data-science/controller/output/index.html">RAI Forward Guidance</a> (price &amp; rate charts)</li><li><a href="https://discord.gg/SwYjUtG5qU">RAI Discord</a></li><li><a href="https://twitter.com/reflexerfinance">RAI Twitter</a></li><li><a href="https://docs.reflexer.finance/keepers/surplus-auction-keeper">RAI Docs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6a8de72f86" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/rai-i-term-tuning-update-a6a8de72f86">RAI I-term Tuning Update</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Participate in RAI Debt Auctions]]></title>
            <link>https://medium.com/reflexer-labs/how-to-participate-in-rai-debt-auctions-7b33178d9729?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/7b33178d9729</guid>
            <category><![CDATA[air]]></category>
            <category><![CDATA[reflexer]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Stefan Ionescu]]></dc:creator>
            <pubDate>Sat, 14 May 2022 23:16:54 GMT</pubDate>
            <atom:updated>2022-05-14T23:31:31.217Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part Two for Bidding Auctions Using a UI or a Bot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2iXa9gd9RW1rrWTPhpJLXA.jpeg" /></figure><p>In this post, we’ll give an overview of RAI debt auctions and the two main options you can use to bid in them.</p><h3>What are Debt Auctions?</h3><p>Debt auctions are used to recapitalize the RAI protocol (bring in new RAI on the protocol’s balance sheet) in exchange for the protocol minting new FLX tokens that are offered to winning bidders. In a debt auction, bidders accept decreasing amounts of FLX in exchange for the same amount of RAI and in the end, the winner sends RAI to the protocol in exchange for newly minted FLX.</p><h3>How Do Debt Auctions Work?</h3><p>Before we describe the auction process, let’s go over a couple of important parameters:</p><ul><li>totalAuctionLength: this is the total auction duration. It’s worth noting that if no one bids in the auction within totalAuctionLength seconds since it starts, the auction can then restart and run for another totalAuctionLength seconds</li><li>bidDuration: this is the amount of time the auction can still run for after someone submits a bid. If someone submits a bid and no new bid comes in for the next bidDuration seconds, the auction can settle. On the other hand, if someone does submit another bid within bidDuration seconds from the last one, the auction can run for another bidDuration seconds. Note that the auction is still bound to run a maximum of totalAuctionLength seconds</li><li>bidDecrease: this is the minimum percentage decrease in a new FLX bid compared to the last submitted bid. For example, let’s say the current bid is 1 FLX for 50 RAI and bidDecrease is 5%. This means that the next bid must be at best 0.95 FLX for the same amount of RAI. This parameter minimizes griefing (to a certain extent), meaning that bidders must submit bids that are significantly lower than the previous ones</li><li>debtAuctionBidSize: this is the amount of RAI that’s requested by the auction. This parameter is fixed throughout the auction duration</li><li>initialDebtAuctionMintedTokens: this is the maximum amount of FLX that can be minted in a debt auction. Any debt auction bids must be smaller than this value</li><li>amountSoldMultiplier: this is a multiplier applied to initialDebtAuctionMintedTokens FLX minted by the protocol to the auction winner in exhange for debtAuctionBidSize RAI</li></ul><p>In RAI’s case, the parameters are set (and already ungoverned) as follows:</p><ul><li>totalAuctionLength: 3 days</li><li>bidDuration: 30 minutes</li><li>bidDecrease: 3%</li><li>debtAuctionBidSize: this variable is recalculated periodically by a contract called DebtAuctionInitialParamSetter. At the time of this writing, the variable is set to ~23K RAI</li><li>initialDebtAuctionMintedTokens: this variable is recalculated periodically by a contract called DebtAuctionInitialParamSetter. At the time of this writing, the variable is set to ~185 FLX</li><li>amountSoldMultiplier: 1.2x</li></ul><p>Now, let’s analyze a scenario to see how debt auctions may play out in the wild.</p><p>Let’s assume we have two bidders, Alice and Bob. Let’s say the auction started with debtAuctionBidSize set to 1000 and initialDebtAuctionMintedTokens set to 10. Alice submits the first bid, 9 FLX for 1000 RAI. The 30 minute countdown for the auction starts. Bob waits 20 minutes and decides to bid 8 FLX for 1000 RAI (even though the minimum to bid was 8.73 FLX). The 30 minute countdown restarts and Alice decides to send another bid of 6 FLX. 30 minutes pass and there’s no new bid so Alice becomes the auction winner.</p><h3>Overview of the Debt Auction Dashboard</h3><p>The easiest way to bid in a debt auction is with the Reflexer <a href="https://app.reflexer.finance/#/auctions">debt auction dashboard</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tQPyK9vslhlyeqQ4.png" /></figure><p>The dashboard gives you an overview of all active debt auctions and allows anyone to submit FLX bids (and send RAI to the auction). The UI shows the latest bid value for each auction as well as the end date for the auction and the full bidding history.</p><p>You can use all this data to decide if you’d like to participate in an auction. In order to bid, choose one auction and click on the Bid-&gt; button.</p><p>Once you click on Bid-&gt;, you should see a popup where you need to input the amount of FLX you’re willing to accept in exhange for debtAuctionBidSize RAI. Enter the amount of FLX you’re willing to accept and click Review Transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SJYmhb_0c5AKt5m-.png" /></figure><p>Finally, click on Confirm Transaction and then approve the transaction in your wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jUtLcVwuiGDV5V5S.png" /></figure><p>You should now see your bid listed under the debt auction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iffz6MNSbR1Z9Mm3.png" /></figure><h3>Overview of Debt Auction Bots</h3><p>The debt auction bot is a script that can be run continuously to monitor the status of debt auctions in the RAI protocol.</p><p>Debt auction bots can:</p><ol><li><strong>Prepare Debt for Auction</strong><br>When a collateral auction starts in the RAI protocol, the confiscated RAI debt (from the liquidated Safe) is put in a queue. That queue can be freed every couple of days (what is called the popDebtDelay) and the debt auction bot can facilitate that process.</li><li><strong>Start Debt Auctions</strong><br>If the RAI protocol has enough “bad debt” (and no surplus), anyone can start a debt auction. The amount of debt required by an auction is called debtAuctionBidSize, which at the time of this writing is ~23K RAI. Once an auction starts, anyone is free to bid in it. Multiple debt auctions can run at the same time.</li><li><strong>Bid in Debt Auctions</strong><br>The bot can automatically bid on debt auctions that are already running. It can also out-bid other bidders on existing auctions, by accepting <em>less</em> FLX (freshly minted by the protocol) for the same amount RAI.</li><li><strong>Settle Debt Auctions</strong><br> When no new RAI bids have been received for bidDuration (since the last submitted bid), a debt auction can be settled. As of this writing, bidDuration on mainnet is 30 minutes. This completes the auction process and transfers RAI to the winning bider.</li></ol><p>Note that if a debt auction doesn’t have any bid for totalAuctionLength seconds (as of this writing, 259,200 seconds), it can restart. When a debt auction restarts, the starting amount of FLX that the protocol can mint in exchange for debtAuctionBidSize RAI is multiplied by 1.2X.</p><h3>Running the Debt Auction Bot</h3><p>The debt auction bot can be run from a Docker container or directly on a Linux host. Docker is the preferred method in order to avoid dependency issues.</p><p>Detailed instructions used to run a debt auction bot can be found <a href="https://docs.reflexer.finance/keepers/debt-auction-keeper/running-in-docker">here</a>.</p><h3>What Now?</h3><p>This guide should have covered what debt auctions are, how they work and how you can take part in them. To learn more about auctions and about RAI in general, check out the following resources:</p><ul><li><a href="https://docs.reflexer.finance/keepers/surplus-auction-keeper">RAI Docs</a></li><li><a href="https://discord.gg/SwYjUtG5qU">Reflexer Discord</a></li><li><a href="https://twitter.com/reflexerfinance">Reflexer Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b33178d9729" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/how-to-participate-in-rai-debt-auctions-7b33178d9729">How to Participate in RAI Debt Auctions</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Participate in RAI Surplus Auctions]]></title>
            <link>https://medium.com/reflexer-labs/how-to-participate-in-rai-surplus-auctions-c6ec6cfe1c44?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/c6ec6cfe1c44</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[air]]></category>
            <dc:creator><![CDATA[Stefan Ionescu]]></dc:creator>
            <pubDate>Sat, 07 May 2022 19:58:22 GMT</pubDate>
            <atom:updated>2022-05-14T21:29:18.642Z</atom:updated>
            <content:encoded><![CDATA[<h4>Guide to Bid in Auctions Using a UI or a Bot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*teOWaIehFOY_00Kk2QulPA.jpeg" /></figure><p>In this post, we’ll give an overview of RAI surplus auctions and the two main options you can use to bid in them. Throughout this article you will see several links to resources that can help you get set up for bidding.</p><h3>What are Surplus Auctions?</h3><p>Surplus auctions are used to sell off a fixed amount of RAI in exchange for FLX tokens. In a surplus auction, bidders submit increasing amounts of FLX in exchange for the same amount of RAI and in the end, the winner receives all auctioned RAI in exchange for their FLX.</p><p>Half of the received FLX is sent to <a href="https://app.reflexer.finance/#/earn/staking">FLX/ETH LP stakers</a> that protect the RAI protocol from insolvency. The other half is burned.</p><h3>How Do Surplus Auctions Work?</h3><p>Before we describe the auction process, let’s go over a couple of important parameters:</p><ul><li>totalAuctionLength: this is the total auction duration. It’s worth noting that if no one bids in the auction within totalAuctionLength seconds since it starts, the auction can then restart and run for another totalAuctionLength seconds</li><li>bidDuration: this is the amount of time the auction can still run for after someone submits a bid. If someone submits a bid and no new bid comes in for the next bidDuration seconds, the auction can settle. On the other hand, if someone does submit another bid within bidDuration from the last one, the auction can run for another bidDuration seconds. Note that the auction is still bound to run a maximum of totalAuctionLength seconds</li><li>bidIncrease: this is the minimum percentage increase in a new bid compared to the last submitted bid. For example, let’s say the current bid is 1 FLX for 50 RAI and bidIncrease is 5%. This means that the next bid must be at least 1.05 FLX for the same amount of RAI. This parameter minimizes griefing (to a certain extent), meaning that bidders must submit bids that are significantly higher than the previous ones</li></ul><p>In RAI’s case, the parameters are set (and already ungoverned) as follows:</p><ul><li>totalAuctionLength: 3 days</li><li>bidDuration: 90 minutes</li><li>bidIncrease: 5%</li></ul><p>Now, let’s analyze two separate scenarios to see how surplus auctions may play out in the wild.</p><p>In the first auction, let’s assume Alice is the only bidder. The auction starts and it has 3 days left to finalize. Alice bids 1 FLX for 50 RAI. The next bid (using the mainnet RAI parameters) would need to be at least 1.05 FLX for the same amount of RAI. Given that Alice bid, the auction has 90 minutes left and, assuming no new bid comes in, it can be settled.</p><p>In the second auction, let’s assume we have two bidders, Bob and Charlie. Bob submits the first bid, 2 FLX for 200 RAI. The 90 minute countdown for the auction starts. Charlie waits 60 minutes and decides to bid 3 FLX for 200 RAI (even though the minimum to bid was 2.1 FLX). The 90 minute countdown restarts and Bob decides to send another bid of 3.2 FLX. 90 minutes pass and there’s no new bid so Bob becomes the auction winner.</p><p>As you can see, auctions can be competitive, which benefits the RAI protocol, although this is only possible if the Reflexer community has the right tools they can use to bid. Let’s dive a bit more into the two main ways anyone can use to participate in surplus auctions.</p><h3>Overview of the Surplus Auction Dashboard</h3><p>The easiest way to bid in a surplus auction is with the Reflexer <a href="https://app.reflexer.finance/#/auctions">surplus auction dashboard</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ba2fGCsimHQ_pymg.png" /></figure><p>The dashboard gives you an overview of all active surplus auctions and allows anyone to submit FLX bids. The UI shows the latest bid value for each auction as well as the end date for the auction and the full bidding history.</p><p>You can use all this data to decide if you’d like to participate in an auction. In order to bid, choose one auction and click on the Bid-&gt; button.</p><p>Once you click on Bid-&gt;, you should see a popup where you need to input the FLX bid you want to submit. Enter the amount of FLX you wish to bid and click Review Transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ikjxZhdb44-SBL4A.png" /></figure><p>Finally, click on Confirm Transaction and then approve the transaction in your wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9fqwPOi25KeXPj-q.png" /></figure><p>You should now see your bid listed under the surplus auction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Wa6g5jDOlpuRV15J.png" /></figure><p>Congrats! You just participated in a surplus auction using the bidding UI. There is however another way to automate the bidding process and that is with the surplus auction bot.</p><h3>Overview of Surplus Auction Bots</h3><p>The surplus bot is a script that can be run continuously to monitor the status of surplus auctions in the RAI protocol.</p><p>Surplus auction bots can:</p><ul><li>Start Surplus Auctions<br>If the RAI protocol has enough surplus accrued in the protocol, anyone can start a surplus auction. Once an auction starts, anyone is free to bid in it. Multiple surplus auctions can run at the same time.</li><li>Bid in Surplus Auctions<br>The bot can automatically bid on new auctions and also out-bid other bidders on existing auctions.</li><li>Settle Surplus Auctions<br>When no new bids have been received for bidDuration, a surplus auction can be settled. This completes the auction process and transfers RAI to the winning bider.</li></ul><h3>Running the Surplus Auction Bot</h3><p>The surplus auction bot can be run from a docker container or directly on a Linux host. Docker is the preferred method in order to avoid dependency issues.</p><p>Detailed instructions used to run a surplus auction bot can be found <a href="https://docs.reflexer.finance/keepers/surplus-auction-keeper/running-in-docker">here</a>.</p><h3>What Now?</h3><p>This guide should have covered what surplus auctions are, how they work and how you can take part in them. To learn more about auctions and about RAI in general, check out the following resources:</p><ul><li><a href="https://docs.reflexer.finance/keepers/surplus-auction-keeper">RAI Docs</a></li><li><a href="https://discord.gg/SwYjUtG5qU">Reflexer Discord</a></li><li><a href="https://twitter.com/reflexerfinance">Reflexer Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6ec6cfe1c44" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/how-to-participate-in-rai-surplus-auctions-c6ec6cfe1c44">How to Participate in RAI Surplus Auctions</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visions of RAI]]></title>
            <link>https://medium.com/reflexer-labs/visions-of-rai-3d3b82f90686?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/3d3b82f90686</guid>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[air]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[elisa]]></dc:creator>
            <pubDate>Tue, 21 Dec 2021 15:28:24 GMT</pubDate>
            <atom:updated>2021-12-21T15:28:24.755Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gjIoxsO9nLGPt2ZPMttLdw.jpeg" /></figure><p>As RAI is edging closer to being fully autonomous, we at Reflexer wish to paint a picture of the future we’d like to see manifest for RAI.</p><p>RAI is the first ‘real stablecoin’, a free-floating asset backed by the most pristine collateral in the world: ETH. We’ve always intended for this one-of-a-kind creation to serve the Ethereum community as a whole. In order to better understand the potential breadth of RAI’s impact, it is necessary for us to introduce the <a href="https://docs.reflexer.finance/the-money-god-league/intro-to-the-league">Money God League</a> — an initiative meant to bring non-pegged stable assets into the mainstream. The core beliefs of this collective are — firstly, that there is enough room within DeFi for more than just one real stable asset, and secondly, that groundbreaking innovation is achieved through collaboration. With each new stable asset there’s a new use-case that will emerge, and we believe that it is only through nurturing mutual growth that the crypto space can truly reach its full potential.</p><p>Since October 2021, there have been two projects that joined the League, two new Money Gods if you will — <a href="https://mirror.xyz/0x13c5432CfC12bA1f32B6090d1a09cf0Efe9C95Bd/LSazD5EFTpVptEGjeXofNRZyOI0vjfSMfrvdvWloVf8">H2O</a> and <a href="https://twitter.com/VoltProtocol">VOLT</a>. Where RAI is backed solely by ETH, H2O plans to onboard OCEAN and datatokens as collateral which are sourced from the <a href="https://oceanprotocol.com/">Ocean Protocol</a>. Moreover, VOLT plans to go down the multicollateral route starting with OHM (the <a href="https://www.olympusdao.finance/">Olympus DAO</a> token) and then diversify with <a href="https://app.rari.capital/fuse">Rari Capital Fuse</a> receipts in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MsoVD6it4EW4E1HLgTmJUQ.jpeg" /></figure><p>Essentially, each Money God could be plotted onto a spectrum depending on its comparable traits. RAI sits at one end, which represents the safest possible collateral with minimised governance and a heavy focus on being the most secure stable asset possible. VOLT and H2O for instance, plan to move along the decentralisation spectrum whilst still remaining close to the initial RAI vision of removing human control where possible. Having such a broad variation of stable assets will open up many avenues, –many of which have yet to be imagined –, thus expanding the Reflexer network and allowing more teams to explore its different branches.</p><p>The Reflexer community is currently onboarding more projects to build their own RAI variations as a means to encourage diversification within the stable asset landscape.</p><h4>If you’re interested in building a new Money God, <a href="https://discord.gg/moneygodalwayswins">reach out on Discord</a> and let’s talk. We are keen to help and greatly look forwards to hearing your ideas!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d3b82f90686" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/visions-of-rai-3d3b82f90686">Visions of RAI</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integration of the Chainlink RAI/USD Oracle]]></title>
            <link>https://medium.com/reflexer-labs/integration-of-the-chainlink-rai-usd-oracle-40ce34c5d9ea?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/40ce34c5d9ea</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[chain-link]]></category>
            <category><![CDATA[reflexer]]></category>
            <dc:creator><![CDATA[BT]]></dc:creator>
            <pubDate>Mon, 13 Dec 2021 14:53:44 GMT</pubDate>
            <atom:updated>2021-12-13T14:30:53.956Z</atom:updated>
            <content:encoded><![CDATA[<h3>Background</h3><p>The market price of RAI is used in the RAI system to determine a deviation (aka “error”) from the system’s redemption price. In turn, this error is used by the PI/D controller (Money God) to calculate a new redemption rate, increasing or decreasing the internal value of RAI and influencing market participants to correct the deviation.</p><p>See <a href="https://medium.com/reflexer-labs/stability-without-pegs-8c6a1cbc7fbd">here </a>for a refresher on how the PID controller influences the system.</p><p>This market price is read into the system from the RAI/USD oracle which has been recently updated. This post will introduce the new RAI Chainlink price feed used in the core protocol.</p><h3>The Previous RAI/USD Oracle</h3><p>The previous RAI/USD oracle derived a RAI/USD TWAP(Time-Weighted Average Price) by combining the RAI/ETH Uniswap V2 TWAP with a TWAP of the Chainlink ETH/USD feed used in the RAI system.</p><p>Below is the relevant portion of the system diagram with the previous oracle. The UniswapMedianRAIUSD contract received the ETH/USD price from the ChainlinkRelayer and RAI/ETH price information from the Uniswap V2 RAI/ETH pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DKJ6EpD2r3Y9N37b.png" /></figure><p>Creating a RAI/USD TWAP from RAI/ETH and ETH/USD TWAPs led to some errors as outlined in <a href="https://medium.com/reflexer-labs/analysis-of-the-rai-twap-oracle-20a01af2e49d">this </a>post and also didn’t cover market activity in other relevant pools or CEXes (e.g Coinbase, Uniswap v3, Curve). For these reasons, the oracle was upgraded from the Uniswap V2 Oracle to the current one, a TWAP of the Chainlink RAI/USD feed.</p><h3>Current RAI/USD Oracle</h3><p>Relevant changes to the system can be seen in the system diagram below. The ChainlinkTWAP contract now solely consumes RAI/USD prices coming from Chainlink and forms a TWAP. The ChainlinkRelayer still consumes the ETH/USD Chainlink feed for collateral pricing, but this feed is not used to construct the current RAI/USD price feed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X3OrIxkwPf0cKYNa.png" /></figure><h3>Chainlink RAI/USD Feed</h3><h3>Overview</h3><p>The Chainlink RAI/USD feed is currently an <a href="https://data.chain.link/ethereum/mainnet/stablecoins/rai-usd">aggregation of 16 off-chain oracles</a>. The frequency of aggregated price updates, aka <em>answers</em>, are controlled by two trigger parameters.</p><p><strong>Deviation Threshold</strong>: the percentage the off-chain aggregated price must move (up or down) before a new on-chain answer is set<br><strong>Staleness Threshold</strong>: the longest time (in seconds) between two consecutive updates until a new oracle update is pushed on-chain</p><p>The current settings for the Chainlink RAI/USD feed are:</p><p><em>Deviation Threshold = </em><strong><em>2%</em></strong><br><em>Staleness: </em><strong><em>24 hours</em></strong></p><p>Therefore, if the median price of the oracle moves more than 2% <strong><em>or</em></strong> if there have been at least 24 hours since the last update, Chainlink will push a new price in their contract.</p><p>To learn more about Chainlink feeds and their architecture, you can read the <a href="https://docs.chain.link/docs/architecture-overview/">Chainlink docs</a>.</p><h3>Chainlink RAI/USD in Action</h3><p>Let’s observe the Chainlink RAI/USD feed over a recent time window. Below, you can see a chart with the Chainlink RAI/USD feed along with the RAI spot price and spot price moving averages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qx7Wo47rbwrVKxTC.png" /></figure><h4>Observation: all of the Chainlink updates are driven by staleness, not RAI/USD price action</h4><p>In the chart above, the Chainlink feed (blue) only updates every 24 hours (the current staleness threshold for the feed).</p><p>The current deviation threshold of 2% is higher than typical RAI volatility so the Chainlink feed is not updating too often.</p><h4>Deviation Thresholds</h4><p>Assuming a market price equal to the current target price of $3.03, the following are the prices at which the possible Chainlink deviation thresholds would trigger oracle updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H5WMn2m9nmyV8sHyAopR4A.png" /></figure><p>Here are these deviation thresholds plotted against the same time period.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AJhlGYqOCx0MSO77.png" /></figure><p>From observing this window, the current deviation threshold of 2% appears to be too high as it outside of most RAI/USD price action. Except for a few spikes, the price action in this window will not trigger a Chainlink update. Switching the Chainlink deviation threshold to 1% or 0.5% would most likely create a more representative price feed.</p><h3>Reflexer Chainlink RAI/USD TWAP</h3><h4>Overview</h4><p>The Reflexer Chainlink TWAP contract creates a TWAP from periodic samples of the Chainlink RAI/USD feed. This TWAP represents the RAI/USD market price used internally by the PI/D controller to determine the deviation between market and target prices and calculate a new redemption rate.</p><p>Using a TWAP instead of the spot Chainlink RAI/USD price allows the system to be more resilient against market noise and possible manipulation of the RAI/USD market price. It also means that the controller will react to longer term deviations between market and redemption prices.</p><h4>Chainlink TWAP Parameters</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BMIBuFP_9baVvrrJ-SqV6Q.png" /></figure><h4>TWAP Calculation</h4><p>The Chainlink TWAP is calculated starting from the last granularity Chainlink feed observation. Each observation is multiplied by the time passed since the previous update. The total time period window the TWAP represents can adjust from 1 day up to 4 days, but will always be composed of 3 time-weighted Chainlink feed samples.</p><p>Example:</p><p>Let: <strong>granularity=3</strong> and consider the following series of Chainlink price samples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nQ6TKhO-TsKpY6cU.png" /></figure><p>When the Chainlink TWAP is updated, the most recent <strong>3</strong> prices and their previous time period weights in green will be used to calculate the current TWAP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JE92NvJVF9MHcOUG.png" /></figure><p>The TWAP calculation for this example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*N7h4mLSyWdZptLrTgufClQ.png" /></figure><h4>Reflexer Chainlink TWAP in Action</h4><p>Here is a plot of the same time window above, but with the Chainlink TWAP values included.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*skXsUZ4qPmRUTIpb.png" /></figure><p>Here’s the same plot zoomed out to a longer time period.<br><strong>Note</strong>: there is missing data on Nov. 16th and 17th.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kmoY98eklJHzacB9.png" /></figure><p>Let’s compare the new TWAP represented above to the <a href="https://medium.com/reflexer-labs/analysis-of-the-rai-twap-oracle-20a01af2e49d">old TWAP</a> plotted below, albeit during different time periods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lydcUXyHjO4hOKCn.png" /></figure><p>From these charts, we can see the new TWAP, derived from Chainlink RAI/USD, is less volatile and is arguably more representative of general RAI/USD market behavior, even with the current sub-optimal 2% deviation threshold of the Chainlink feed.</p><h3>Next Steps</h3><p>In a future post, we will observe the Chainlink RAI/USD TWAP with a reduced deviation threshold and how the threshold affects the RAI controller responsiveness.</p><h3>References</h3><p><a href="https://market.link/feeds/b8d23ae0-a552-4d69-8ec0-e3a75f470dad">Chainlink RAI/USD feed</a></p><p><a href="https://etherscan.io/address/0x92dC9b16be52De059279916c1eF810877f85F960">Reflexer Chainlink TWAP contract</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40ce34c5d9ea" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/integration-of-the-chainlink-rai-usd-oracle-40ce34c5d9ea">Integration of the Chainlink RAI/USD Oracle</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reflexer Monthly Recap — November]]></title>
            <link>https://medium.com/reflexer-labs/reflexer-monthly-recap-november-8e2079170875?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/8e2079170875</guid>
            <category><![CDATA[reflexer]]></category>
            <category><![CDATA[air]]></category>
            <category><![CDATA[stablecoin-cryptocurrency]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[elisa]]></dc:creator>
            <pubDate>Wed, 01 Dec 2021 17:04:04 GMT</pubDate>
            <atom:updated>2022-01-11T13:25:36.232Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reflexer Monthly Recap — November</h3><h4>Crypto moves at such a fast pace it gets difficult to keep up –– here is a quick recap of everything that happened for RAI and Reflexer in the month of November.</h4><h3><strong>RAI</strong></h3><ul><li>Polly Finance began to incentivise a RAI/ETH pool on their synthetic asset platform deployed on Polygon, and introduced a new stable asset index made out of 40% RAI.</li><li>Frax Finance accumulated RAI in a UniSwap v3 pool.</li><li>Partnership with Vesq to help offer RAI bonds on Polygon (Vesq launch TBA).</li><li>Friendly fork by NewOrderDAO <a href="https://community.reflexer.finance/t/another-new-money-god-introducing-h2o/131">introducing H2O</a>, a stable coin backed by the OCEAN token as well as data tokens from the <a href="https://blog.oceanprotocol.com/">Ocean Protocol</a> ecosystem. They plan to allocate 7% of total AQUA (un)governance token supply to the Reflexer community.</li><li>Friendly fork by Volt Protocol where <a href="https://community.reflexer.finance/t/a-new-money-god-introducing-volt/120">VOLT is multicollateral RAI</a>, backed by OHM. They will offer 6% of total VCON governance token supply to the Reflexer community.</li><li>Proposals to add RAI to: <a href="https://www.comp.xyz/t/add-market-rai/2611">Compound</a> (with the help of TylerEther) and <a href="https://forum.nexusmutual.io/t/yield-token-depeg-cover-using-rai/710">Nexus Mutual</a>.</li></ul><h3>Community</h3><ul><li>Reflexer <a href="https://reflexer.finance/">website</a> and <a href="https://stats.reflexer.finance/">stats page</a> underwent design makeovers.</li><li><a href="https://immunefi.com/bounty/reflexer/">Bug bounty program</a> moved to Immunify.</li><li><a href="https://medium.com/reflexer-labs/analysis-of-the-rai-twap-oracle-20a01af2e49d">Article</a> on the ‘Analysis of the RAI TWAP Oracle’.</li><li>AMA on Discord with <a href="https://tally.cash/">Tally Wallet</a>.</li></ul><h3>Integrations</h3><ul><li><a href="https://reflexer.finance/integrations">37</a> protocols, exchanges, interfaces, dApps and DAOs have adopted RAI thus far.</li><li><a href="https://www.sendwyre.com/">Wyre</a> widget added to the <a href="https://app.reflexer.finance/#/">Reflexer dash</a> which can be used to drop USD and get RAI.</li><li>RAI listed on the <a href="https://uphold.com/en/debit-card">Uphold debit card</a>, initially only open to US users, to become available for UK and EU residents at a later date.</li><li><a href="https://wiki.metagame.wtf/">MetaGame</a> using RAI in their Polygon Balancer v2 pool in combination with ETH and SEED, their governance token.</li></ul><h3>Join the Money God 🗿</h3><p>► Website–– <a href="https://reflexer.finance/">https://reflexer.finance/</a></p><p>► Twitter–– @reflexerfinance</p><p>► Discord–– <a href="https://discord.gg/CfR74X22XE">https://discord.gg/CfR74X22XE</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e2079170875" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/reflexer-monthly-recap-november-8e2079170875">Reflexer Monthly Recap — November</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis of the RAI TWAP Oracle]]></title>
            <link>https://medium.com/reflexer-labs/analysis-of-the-rai-twap-oracle-20a01af2e49d?source=rss----af574d3e4bbf---4</link>
            <guid isPermaLink="false">https://medium.com/p/20a01af2e49d</guid>
            <category><![CDATA[chain-link]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[air]]></category>
            <category><![CDATA[twap]]></category>
            <dc:creator><![CDATA[BT]]></dc:creator>
            <pubDate>Wed, 10 Nov 2021 14:42:36 GMT</pubDate>
            <atom:updated>2021-11-10T19:55:07.119Z</atom:updated>
            <content:encoded><![CDATA[<h3>Overview of Price Feeds in the RAI System</h3><p>The RAI system currently uses two external price feeds:</p><ol><li><a href="https://data.chain.link/ethereum/mainnet/crypto-usd/eth-usd">Chainlink ETH/USD feed</a></li><li><a href="https://v2.info.uniswap.org/pair/0x8ae720a71622e824f576b4a8c03031066548a3b1">Uniswap V2 RAI/ETH pair</a></li></ol><p>The Chainlink ETH/USD feed is used by the system to price ETH collateral. This price determines collateralization ratios and the system relies on it to trigger liquidations.</p><p>The RAI/ETH price is used in combination with the Chainlink ETH/USD feed to calculate the RAI/USD market price. The market price is then used to determine the deviation (aka “error”) from the system’s redemption price. In turn, this error is used by the PI/D controller (Money God) to calculate a new redemption rate, thus increasing or decreasing the internal value of RAI.</p><p>See <a href="https://medium.com/reflexer-labs/stability-without-pegs-8c6a1cbc7fbd">here</a> for a refresher on how the PID controller influences the system.</p><h3>System Diagram</h3><p>The top portion of the <a href="https://viewer.diagrams.net/?target=blank&amp;highlight=0000ff&amp;layers=1&amp;nav=1&amp;title=GEB_overview.drawio#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1nIcaY8N8StVCfyAL_ztbmETJX2bvY3a9%26export%3Ddownload">full GEB System Diagram</a> shows the components of the system that we will be discussing. The left cloud represents the Chainlink ETH/USD feed and the right cloud represents the Uniswap V2 RAI/ETH pool.</p><p>The Chainlink ETH/USD feed is consumed by the Chainlink Relayer and the Uniswap V2 Pool prices are consumed by the Uniswap Medianizer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VdBsfgBGK99yCEow.png" /></figure><h3>Chainlink Relayer: ETH/USD</h3><h4>Chainlink ETH/USD Feed</h4><p>The Chainlink ETH/USD feed is currently an <a href="https://data.chain.link/ethereum/mainnet/crypto-usd/eth-usd">aggregation of 31 off-chain oracles</a>. The frequency of aggregated price updates, aka <em>answers</em>, are controlled by two trigger parameters.</p><ol><li><em>Deviation threshold</em>: the percentage the off-chain aggregated price must move before a new on-chain answer is set</li><li><em>Staleness</em>: the longest time (in seconds) an on-chain answer can exist before an update is forced</li></ol><p>The current settings for the Chainlink ETH/USD feed are:</p><p><em>Deviation Threshold = </em><strong><em>0.5%</em></strong><br><em>Staleness: </em><strong><em>86,400 seconds</em></strong></p><p>Therefore if the aggregated price of the oracles moves more than 0.5% <strong><em>or</em></strong> if it’s been at least 86,400 seconds since the last update, Chainlink will push a new price update.</p><p>To learn more about Chainlink feeds and their architecture, you can read the <a href="https://docs.chain.link/docs/architecture-overview/">Chainlink docs</a>.</p><h4>Chainlink Relayer</h4><p>The ETH/USD feed is initially consumed by the Chainlink Relayer. The latest ETH/USD answer is set in the Chainlink Relayer and then queried by two other system components:</p><ol><li>The OSM, which enforces a one hour delay between ETH collateral price updates</li><li>The Uniswap Medianizer, which calculates the RAI/USD price</li></ol><p>This post will focus on the Uniswap Medianizer since we are discussing the calculation of the RAI/USD market price.</p><h3>Uniswap Medianizer: Combining RAI/ETH and ETH/USD</h3><h4>Uniswap V2 TWAPs</h4><p>One feature of Uniswap V2 pairs is the ability to construct a <strong>time-weighted average price (TWAP)</strong>. Each Uniswap pair contract tracks a cumulative price that represents the “sum of the Uniswap price for every second in the entire history of the contract”</p><p>From the <a href="https://docs.uniswap.org/protocol/V2/concepts/core-concepts/oracles">Uniswap V2 oracle docs</a>:</p><pre>The TWAP is constructed by reading the cumulative price from an ERC20 token pair at the beginning and at the end of the desired interval. The difference in this cumulative price can then be divided by the length of the interval to create a TWAP for that period.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SLLI071-wzJefosT.png" /></figure><p>A TWAP for a specific time window can be constructed by calling the pair contract at the beginning and end of a window. The Uniswap Medianizer performs this type of sampling.</p><h4>Uniswap Medianizer: RAI/ETH TWAP</h4><p>Despite its name, the Uniswap Medianizer does not produce a median, but rather a Time-Weighted Average Price(TWAP). It does this by sampling Uniswap V2 priceCumulative and storing its recent values.</p><p>The following are Uniswap Medianizer parameters:</p><p><strong>Period size</strong>: how often Uniswap V2 priceCumulative can be sampled<br><strong>Window size</strong>: size of the window used for the TWAP<br><strong>Max window size</strong>: largest possible window size allowed. Hard limit on how old the oldest priceCumulative sample can be. This allows extra time if price isn’t sampled exactly every period size due to gas spikes, off-chain outages, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PwekaMvcYxsVp0Ne.png" /></figure><h4>Uniswap Medianizer: ETH/USD TWAP</h4><p>In addition to tracking the RAI/ETH TWAP, the Uniswap Medianizer also creates an ETH/USD TWAP, using the price data from the ChainlinkRelayer.</p><p>For the ETH/USD TWAP, the medianizer uses the same parameters (<strong>window size, period size</strong> and <strong>max window size</strong>). However, there is no ETH/USD priceCumulative variable that updates every block as in the Uniswap pair. The Medianizer maintains this value from periodic ETH/USD samples during the window, not after every block like the Uniswap RAI/ETH pair.</p><h4>Uniswap Medianizer: Calculating the Final TWAP Price</h4><p>To calculate the RAI/USD TWAP, the medianizer simply multiplies the RAI/ETH TWAP by the ETH/USD TWAP.</p><p>Let μ be the mean price over the previous window, the TWAP. Then:</p><p>RAI/USD TWAP = RAI/ETH TWAP * ETH/USD TWAP</p><p>For a complete example of how the RAI/USD TWAP is calculated, see the Appendix below.</p><p>Let’s see how the RAI/USD TWAP performs in the production system.</p><h3>Results in Production</h3><p>Below we can see a chart comparing two price series:</p><ol><li>Prod TWAP(blue): RAI/USD TWAP values produced by the Uniswap Medianizer</li><li>Spot RAI/USD(red): Calculated by multiplying per block Uniswap V2 RAI/ETH price by per block Chainlink ETH/USD feed</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NLJlpKdoBR6p4nPg.png" /></figure><h4>Observations</h4><p>Notice there are periods where the TWAP (blue) doesn’t seem to represent the spot prices from the previous window. Specifically, the TWAP dips around the 23rd and 25th don’t seem to match market behavior.</p><p>We noticed this mismatch between the TWAP price and recent RAI/USD market prices was happening consistently. There was more volatility in the RAI/USD TWAP than expected, given the volatility of RAI and ETH. This is an issue as even errors in the TWAP of 1% are significant . With current controller parameters, a 1% deviation between the TWAP price and redemption price creates around a positive or negative 6% annual redemption rate.</p><p>As the TWAP directly influences the rates of the system, it should have minimal error.</p><h3>What is happening?</h3><p>What is causing the production RAI/USD TWAP to not be representative of current market behavior?</p><ol><li>Estimation of ETH/USD TWAP.</li></ol><p>While we can construct the exact RAI/ETH TWAP of a window through priceCumulative, we are estimating the TWAP of ETH/USD for this window through sampling.</p><p>The current production TWAP only uses 4 ETH/USD samples over a window of 16 hours to calculate the ETH/USD TWAP. This will inevitably lead to error from the true ETH/USD TWAP.</p><p>2. Chainlink ETH/USD deviation threshold.</p><p>As the Chainlink ETH/USD feed is not an instantaneous spot price, it can have up to 0.5% error from the true spot price. This error is unavoidable and will inevitably lead to some deviation from the true ETH/USD TWAP.</p><p>3. Not considering covariance when combining RAI/ETH and ETH/USD</p><p>If we go back to the Medianizer calculation, we are calculating the RAI/USD TWAP as:</p><p>RAI/USD TWAP = RAI/ETH TWAP ∗ ETH/USD TWAP</p><p>We’ve attempted to construct a third pair TWAP by multiplying the TWAPs of two composite pairs.</p><p>However, this is a product of two means and will not necessarily be equal to the mean of two products (what we actually want, the mean of RAI/ETH*ETH/USD).</p><p>Let’s explore this more.</p><h4>When Is Our Assumption True?</h4><p>Our assumption:<br>(RAI/ETH∗ETH/USD) TWAP = RAI/ETH TWAP ∗ ETH/USD TWAP</p><p>We can use the <a href="https://en.wikipedia.org/wiki/Covariance#Definition">definition of covariance</a> to see under what conditions the above statement is true. Consider the covariance of two random variables, X and Y. These represent RAI/ETH and ETH/USD prices in our context.</p><p>cov(X,Y)=E[(X−E[X])(Y−E[Y])]<br> =E[XY−XE[Y]−E[X]Y+E[X]E[Y]] <br> =E[XY]−E[X]E[Y]−E[X]E[Y]+E[X]E[Y] <br> =E[XY]−E[X]E[Y]</p><p>On the final line, we see that cov(X,Y) is equal to the mean of the product of two random variables minus the product of the means of two random variables.</p><p>Thus,</p><p>E[XY]=E[X]E[Y]⟺cov(X,Y)=0</p><p><em>The product of two means equals the means of two products if and only if the covariance of the two variables equals 0.</em></p><p>So the final RAI/ETH TWAP ∗ ETH/USD TWAP will only be accurate if RAI/ETH and ETH/USD have a covariance of 0.</p><p>Since we cannot expect the two pairs to have zero covariance, there will be some error in the third, combined TWAP.</p><h3>Can We Fix This?</h3><p>Using the above formula, we could possibly construct the true RAI/USD TWAP by adding the covariance to the product of the two TWAPs.</p><p>E[XY]=E[X]E[Y]+cov(X,Y)</p><p>However, we do not have access to all data points within the window to calculate cov(X,Y).</p><p>We could possibly estimate the covariance, but this estimate will be limited by how often we update the Uniswap Medianizer. The medianizer is updated every window_size/period_size hours. With current production settings of window_size=16, period_size=4, the covariance of a 16-hour window would be estimated from only 4 samples and most likely a poor estimate.</p><p>Further, this would need to be a time-weighted covariance to match the time-weighted prices used.</p><h3>Extra Limitations</h3><p>In addition to the shortcomings addressed, a TWAP constructed from Uniswap V2 RAI/ETH doesn’t cover all relevant RAI markets (e.g Coinbase, Uniswap V3 RAI/DAI, RAI/USDC, etc).</p><p>In the next post, we will explore a Chainlink RAI/USD price feed as the oracle for the RAI market price.</p><h3>References</h3><p><a href="https://github.com/reflexer-labs/geb-uniswap-median/blob/master/src/UniswapConsecutiveSlotsPriceFeedMedianizer.sol">Uniswap Medianizer source code</a></p><p><a href="https://github.com/reflexer-labs/geb-chainlink-median/blob/master/src/ChainlinkRelayer.sol">Chainlink Relayer source code</a></p><p><a href="https://docs.reflexer.finance/system-contracts/oracle-module">GEB Oracle docs</a></p><h3>Appendix</h3><h4>Example: RAI/ETH TWAP Calculation</h4><p>Consider the following samples of RAI/ETH priceCumulative and these TWAP parameters:</p><p>window_size=600<br>period_size=120<br>granularity=600/120=5</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ve44BA8McUKMxPm-.png" /></figure><p>Let:<br>pc_n=priceCumulative at block n<br>t_n=timestamp at block n</p><p>The current TWAP is calculated as such:</p><p>RAIETH_TWAPcurrent =(pc_502−pc_100)/ (t_502−t_100)</p><p>RAIETH_TWAPcurrent =(0.452619−0.070707)/(612−111)=0.381912/501=0.0007622994011976</p><h4>Example: ETH/USD TWAP Calculation</h4><p>Consider the following samples of the ETH/USD price and the same TWAP parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ffzustrYkk3If8HZ.png" /></figure><p>Unlike RAI/ETH, there is no per-second cumulative price for the ETH/USD price. To simulate this, each ETH/USD price is manually weighted by time elapsed, then divided by the total time elapsed since the first sample.</p><p>Let:<br>p_n=price at block n<br>t_n=time at block n</p><p>Then:</p><p>ETHUSD_TWAPcurrent=(p_201∗(t_201−t_100)+p_300∗(t_300−t_201)+p_404∗(t_404−t_300)+p_502∗(t_502−t_404))/(t_502−t_100)</p><p>ETHUSD_TWAPcurrent=(4100∗(236−111)+4075∗(381−236)+4121∗(497−381)+4108∗(612−497))/(612−111)</p><p>ETHUSD_TWAPcurrent=4099.36</p><h4>Example: Final RAI/USD Calculation</h4><p>Finally, the two values are multiplied to yield the current RAI/USD TWAP value.</p><p>RAIUSD_TWAPcurrent=RAIETH_TWAPcurrent∗ETHUSD_TWAPcurrent</p><p>RAIUSD_TWAPcurrent=0.0007622994011976∗4099.36≈3.12</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20a01af2e49d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/reflexer-labs/analysis-of-the-rai-twap-oracle-20a01af2e49d">Analysis of the RAI TWAP Oracle</a> was originally published in <a href="https://medium.com/reflexer-labs">Reflexer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>