FRAX: evaluating the potential and comparing the architecture

FRAX: evaluating the potential and comparing the architecture

Lev Menshchikov (👈contacts)
Special for Oxorio

📝Foreword


Contents

🔎 Introduction
📊 Infographics
🧬 Minting and redeeming
🧬 Stabilization mechanism
🧬 Lending protocol
🧬 Liquidation mechanism
🪐 Comparing with AAVE V2
🪐 Comparing with MakerDAO
🔎 Overview
📚 Additional useful resources


🔎 Introduction

⚡ FRAX is the world’s first fractional-algorithmic stablecoin protocol based on Ethereum but also includes integrations with other popular chains.

⚡ The main features of FRAX:

Fractional-Algorithmic. FRAX is the first stablecoin to have part of its supply floating/unbacked because its supply is partly backed by collateral and partly changeable by algorithms.

Two tokens system. Frax Shares (FXS) is the governance token, while Frax (FRAX) is a stablecoin.

FPI (FRAX Price Index). In the future, the project is going to abandon the dollar peg and become an independent unit of value. And FPI will help the community governance to establish and effectively control the price.

Fully on-chain oracles. FRAX uses Uniswap (ETH, USDT, USDC time-weighted average prices) and Chainlink (USD price) oracles. 

⚡ The price of FRAX, FXS, and collateral are all calculated with a time-weighted average of the Uniswap pair price and the ETH:USD Chainlink oracle. The Chainlink oracle allows getting the true price of USD instead of an average of stablecoin pools on Uniswap.

The protocol has clear aspirations of scalability, robustness, and adaptability.

📌Back to Contents📌


📊 Infographics

📌Back to Contents📌


🧬 Minting and redeeming


◾ All FRAX tokens are entitled to the same proportion of collateral no matter what collateral ratio they were minted at. This system of equations describes the minting function of the Frax Protocol:

The iron rule is that 1 FRAX can always be created or redeemed for $1.

◾ When market conditions change, the Collateral Ratio (CR) changes, and the composition of that $1 also changes.

◾ Like with Seigniorage Shares, the money supply of Frax is elastic. When demand for the FRAX stablecoin increases, the system can expand the money supply beyond the total collateral in the system.

◾ FRAX can also tighten monetary policy when market conditions call for discipline. The Collateral Ratio is continually nudged up and down by the market demand for FRAX. If the Collateral Ratio ever overshoots a safe level, it gradually can be modulated back to the appropriate threshold.

Redeeming FRAX is done by rearranging the previous system of equations for simplicity and solving for the units of collateral, Y, and the units of FXS, Z.

📌Back to Contents📌


🧬 Stabilization mechanism

✨ Terminology

Decollateralize: an action which lowers the CR.

Market Operations: an action which runs in equilibrium and doesn’t change the CR.

Recollateralize: an action which increases CR. Anyone can call the recollateralize function which then checks if the total collateral value in USD across the system is below the current collateral ratio. If it is, then the system allows the caller to add up to the amount needed to reach the target collateral ratio in exchange for newly minted FXS at a bonus rate.

FXS1559: formalized accounting of the balance sheet of the AMO which defines exactly how much FXS can be bought and burned with profits above that CR. It also shows daily interest payments accrued over the CR. (currently in development) 

✨ Arbitrage

◾ The practice of making a profit from price discrepancies is called arbitrage. FRAX can always (theoretically) be redeemed for $1. So, if the market price slips to $0.98, an arbitrageur can buy on the market and then sell back to the protocol for $1.00. Same in reverse.

✨ Share token

◾ FXS is not pegged to anything and ‘floats’ on the open market. Market participants are incentivised to buy FXS tokens because they receive voting rights, rewards from transactions, and price appreciation as more people use FRAX (it theoretically becomes more scarce).

Remember, every time someone buys a new FRAX (at a low CR level), a portion of FXS is burned.

◾ However, the CR should minimise that, because the protocol will require more and more reserve collateral to mint FRAX. In turn, this should reduce the amount of FXS that is created, thus reducing the dilution of FXS value.

✨ Algorithmic Market Operations (AMO)

◾ As a mathematical, automated, and stable programmatical system that is price aware of itself, algorithmic central banking stabilizes price without human input.

◾ Firstly, you need to clearly understand what is Central Bank OMO (Open Market Operations).

◾ FRAX V2 is basically doing the same thing, except the functions are governed by an algorithm instead of a committee (like the banks use).

◾ The AMOs are modular, but they all share core functions, restricted by the rule that anything the AMO does cannot break the FRAX peg.

◾ In comparison to Fei Protocol – an incentive stablecoin that aims to maintain a liquid market in which ETH/FEI trades closely to the ETH/USD price – FRAX functions quite differently.

◾ Where FRAX stabilizes price through its fractional-algorithmic protocol, FEI employs direct incentives (DI) which can actually cause FEI price to lack any stability. The DI of FEI can often punish sellers and reward buyers during times of volatility.

🗿 Advanced description (source - link):

🚩 "The Curve AMO deploys idle and newly minted FRAX into the FRAX3CRV pool. Frax utilizes this AMO not only to earn revenue, but to increase FRAX liquidity and strengthen its peg. Frax also sets and collects admin fees since the AMO contract deployed the FRAX3CRV metapool and owns admin privileges. The AMO also utilizes Convex and StakeDAO to maximize LP rewards."

✨ PIDController

◾ A PIDController dynamically adjusts the CR based on changes in a growth ratio which measures FXS liquidity against the total supply of FRAX. , defined as such:

◾ At its core, the growth ratio measures how much FXS liquidity there is against the overall supply of FRAX. The reasoning is that the higher the growth ratio, the more FRAX that could be redeemed with the less overall percentage change in the FXS supply.

◾ If redeemers were to sell their FXS minted from redeemed FRAX, a higher growth ratio would imply less price slippage on FXS and thus less likelihood of any undesirable negative feedback loops.

◾ The motivation for the growth ratio is to take in the signal of the market cap of FRAX and FXS, such that a change in the collateral ratio can be supported by current conditions. For example, a situation of $5 million of FXS liquidity with 50 million outstanding FRAX is much less fragile than one with the same FXS liquidity but 500 million outstanding FRAX.

◾ In the previous model, looking only at the price of FRAX to change the collateral ratio was sufficient for the protocol's bootstrap phase, but the recent growth and current size of the system merits a change in the model to consider the growth ratio to allow for more accurate feedback. The new system still uses a price band, but only adjusts the collateral ratio up or down when the price of FRAX is outside of the targeted band.

📌Back to Contents📌


🧬 Lending protocol

🔗 Lending AMOs code (mainnet) - link
🔗 Lending AMOs code (crosschain integration) - link

◾ Lending protocol is realised in Lending AMO - a controller that mints FRAX into money markets such as Compound or CREAM to allow anyone to borrow FRAX by paying interest instead of the base minting mechanism.

◾ FRAX minted into money markets don’t enter circulation unless they are overcollateralized by a borrower through the money market so this AMO does not lower the direct collateral ratio (CR).

◾ Essentially the Lending AMO creates a new avenue to get FRAX into circulation by paying an interest rate set by the money market.

◾ The AMO can increase or decrease the interest rate on borrowing FRAX by minting more FRAX (lower rates) or removing FRAX and burning it (increase rates). This is a powerful economic lever since it changes the cost of borrowing FRAX on all lenders. This permeates all markets since the AMO can mint and remove FRAX to target a specific rate.

◾ But this AMO also creates risk as FRAX is backed by collateral held by other protocols, but the protocol is able to moderate this risk by controlling the amount allowed to be minted directly into money markets.

📌Back to Contents📌


🧬 Liquidation mechanism

◾ There is no specific liquidation module, but FRAX has a Hedge module that takes some amount of collateral and perfectly hedges against it with an inverse/short position to create a basis trade of net 0 volatility to minimize significant drops in collateral price.

◾ This AMO would allow FRAX to be backed by more diverse and volatile collateral. For example, we are exploring using Synthetix inverse assets with the asset itself to form perfectly hedged units of collateral (ex: ETH-iETH).

📌Back to Contents📌


🪐 Comparing with AAVE V2

🔗 V2 Lending pool contract (code) - link
🔗 V2 Lending pool description (docs) - link
🔗 V2 Liquidations (docs) - link

◾ Aave is a heavyweight in the DeFi lending space and has built the 3rd largest DeFi lending platform by TVL, as of this writing. With a strong liquidity ratio, healthy collateral spread and pioneering flash loans product, Aave is certainly making its mark in the space.

◾ As for the AAVE token, Aave has committed to using treasury reserves to buy and burn AAVE tokens, which will decrease supply and could push up price. 

◾ Aave has two key products: traditional lending/borrowing and flash loans.

✨ Traditional Lending and Borrowing

⚡Aave’s core business is lending and borrowing platform. Aave currently supports more than 20 cryptocurrencies. This is how the process works:

🚩 A depositor who deposits ETH will receive an aETH token in exchange. This token is interest baring, which means that when the depositor wants to withdraw their deposit, they can return the aETH and receive their original ETH plus the interest collected.

🚩 During the loan period, the ETH will be deposited in a pool from which borrowers can submit collateral in any other currency and borrow ETH. All loans are overcollateralized, which means the value of the collateral must be higher than the received value of the borrowed asset; borrowers can then choose between a fixed and variable interest rate. 

🚩 Loans are also of an indefinite period, which means that a borrower can hold the borrowed asset for as long as they like, provided the price of the collateralized asset remains above a certain level. Aave keeps the spread and charges a 0.00001% fee on all loans at origin.

✨ Flash loans

🚩 Flash loans are uncollateralized loans where the borrowing and repayment both occur within the same block. This is a product that was pioneered by Aave and ~$2.8B worth of flash loans have been completed on the Aave platform to date. There are currently three use cases for flash loans: arbitrage, collateral swap, liquidation.

🚩 The arbitrage use case exists primarily because interest rates across lending platforms are not coordinated, allowing for some opportunity to users to profit from the spread. A flash loan ensures that assumption rates are locked in when making an arbitrage trade. The collateral swap and liquidation use cases exist primarily when the price of a borrower’s collateral is falling below the threshold level.

🚩 Both use cases allow the borrower to cap their losses at a fixed price higher than the official liquidation price. Aave currently charges a fixed 0.09% fee per flash loan transaction.

📌Back to Contents📌


🪐 Comparing with MakerDAO

⚡ You may also look in some extra materials here and here.

In fact, FRAX Lending AMO is MakerDAO’s entire protocol in a single market operations contract.

Brief description of what is DAI.

◾ The cash flow from lending can be used to buy back and burn FXS (similar to how MakerDAO burns MKR from stability fees).

◾ DAI is primarily minted to generate leverage, and Terra stablecoins are primarily minted to participate in the vibrant TeFi ecosystem. Both systems serve valuable use cases, but they also have vulnerabilities. 

◾ Maker CDPs must be over-collateralized, so the total value of assets locked in the protocol should always exceed the total DAI market cap. This makes DAI capital inefficient since it can only scale with the demand for leverage. The protocol has also developed an increasing reliance on USDC as collateral.

◾ The price of DAI is currently stable but endured an extended period of time last year in which its price traded well above $1. This price deviation occurred because of a deflationary deleveraging spiral after its liquidation system broke down due to the March 2020 crash.

✨ MakerDAO CDPs explained

◾ DAI uses game theory and balanced economic incentives to sustain its value. In more technical terms, it all boils down to margin trading using Collateralized Debt Position (CDP). It's a fundamental construct at the heart of the Maker-Dai system.

◾ CDPs receive ether in a pooled form (called PETH) from users and in exchange give the user DAI tokens.

How DAI remains stable.

◾ The CDP then stores this PETH as collateral for the DAI that has been issued. What this means is that the CDP essentially treats the DAI issued as a loan — creating a debt with the PETH given by the user taken as collateral, should the DAI not be returned. This PETH collateral is locked out of the user’s access until the outstanding debt (the issued DAI) is paid back.

◾ When the user wants to get their collateral back — they pay down the debt by sending back the borrowed DAI and also pay interest on their loan in the form of a ‘stability fee’. This fee can only be paid in the MKR token.

✨ The System Stabilizer Module (SSM) explained

⚡ The main source (MakerDAO docs -> SSM) - link

SSM corrects the system when the value of the collateral backing DAI drops below the liquidation level (determined by governance) when the stability of the system is at risk.

How the System Stabilizer Module Interacts with the other DSS Modules.

◾ The SSM creates incentives for Auction Keepers to step in and drive the system back to a safe state by participating in both debt and surplus auctions and, in turn, earn profits by doing so.

◾ The System Stabilizer Module has 3 core components consisting of the Vow, Flop, and Flap contracts:

⚡ The Vow represents the overall Maker Protocol's balance (both system surplus and system debt). The purpose of the vow is to cover deficits via debt auctions and discharge surpluses via surplus auctions.
🔗 Vow contract overview - link
🔗 Vow contract code - link
⚡The Flopper (Debt Auction) is used to get rid of the Vow’s debt by auctioning off MKR for a fixed amount of internal system Dai. When flop auctions are kicked off, bidders compete with decreasing bids of MKR. After the auction settlement, the Flopper sends received internal Dai to the Vow in order to cancel out its debt. Lastly, the Flopper mints the MKR for the winning bidder.
🔗 Flopper contract overview - link
🔗 Flopper contract code - link
⚡The Flapper (Surplus Auction) is used to get rid of the Vow’s surplus by auctioning off a fixed amount of internal Dai for MKR. When flap auctions are kicked off, bidders compete with increasing amounts of MKR. After auction settlement, the Flapper burns the winning MKR bid and sends internal DAI to the winning bidder.
🔗 Flapper contract overview - link
🔗 Flapper contract code - link
How do the Vow, Flop and Flap contracts help the MCD system operate.

📌Back to Contents📌


🔎 Overview

❗❗Warning❗❗

◾ While researching information about this project, I found a screenshot where the guy says that the following code block contains a vulnerability. The project still looks robust, which probably means it has been patched, but please take that into account if you've chosen o integrate the code into your project.

✨ Conclusion

◾ The extent to which Frax reduces the risks inherent to other stablecoins systems, particularly those which utilize endogenous collateral, remains an open research area. Forecasting the dynamics of any crypto asset is difficult, but FRAX and FXS are particularly challenging to model. 

◾ The Core Stability Mechanism, along with the AMOs, are simple and elegant, but simulating how all of the components evolve through time is highly nontrivial since some of these components impact each other nonlinearly.

◾ But having multiple a diversified system of stablecoins (DAI, FRAX, MIM, UST, etc.) with different designs is a value-add to the crypto and web3 ecosystem as it derisks the blockchain ecosystems. FRAX and FXS are built with a long-term mindset and vision to have FRAX integrating into critical DeFi protocols.

📌Back to Contents📌


📚 Additional useful resources

🔗 Useful practical guides and weekly reports - link

🔗 "While Stability Lasts: A Stochastic Model of Stablecoins" - link

🔗 "Preliminary Risk Profile of Adding FRAX to Aave’s Ecosystem" - link

🔗 "A Detailed Study of the $AAVE Platform and Token" - link

🔗 Detailed Messari Article - link

🔗 Deeper mechanism description - link

🔗 DeFiPicks article - link

🔗 DragonFly research - link

🔗 Avalanche Integration Announcement - link



Report Page