# RAI Dollar Price Stability ## Background RAI Dollar mechanisms are designed to solve the 2 major stability problems with Liquity V1. Liquity V2 inefficiently solves #1 but doesn't address #2. [Detailed background of Liquity stability](https://www.liquity.org/blog/on-price-stability-of-liquity) [Liquity V1 docs](https://docs.liquity.org/liquity-v1) ### Problem 1: Underpeg during high-real interest rates -> lots of trove redemptions ![LUSD Exchange Rates underpeg](https://hackmd.io/_uploads/B1duMmGbgl.png) When other stablecoins have high yield(DAI in DSR), LUSD was minted and sold at a discount for these high yield coints. This created underpeg pressure. The liquity redemption mechanism allows redeeming 1 LUSD for a fixed $1 of collateral. If one can buy LUSD for $0.99 and redeem for $1 of collateral, an arbitrage is possible. Troves are redeemed against in the order of ascending collateraliation ratio. When a trove is redeemed against, it's debt is paid back and the corresponding collateral is given to the redeemer. The prolonged underpeg situation caused constant redemptions against troves, driving up the minimum collateraliation ratio in the system. At one point is up to 500-600%. There is a redemption fee, so w/ heavy underpeg pressure, the market price will settle at $1-fee. ### Problem 2: Overpeg with demand ![LUSD Exchange Rates overpeg](https://hackmd.io/_uploads/SkmNrQzZel.png) This is a common theme for CDP stablecoins. When collateral prices drop, people buy to re-pay their debt. ## RAI Dollar Mechanisms Par Controller: slow acting Interest Rate Controller: faster acting While the market process will respond faster to par changes in underpeg(immediate arb), the rate controller is picked to be faster iot reduce redemption impact on borrowers. ### Par Controller #### Motivation Changing par can increase or decrease a trove's c-ratio, and respectively decrease of increase leverage demand. Redemptions are valued at par. So increase or decrease par can increase/decrease market demand from redemptions. If market > min_c_ratio * par, then immediate arbitrage can happen. Example: -MCR = 110% -par= $1 -market = $1.15 Lock $1 of collateral, mint 0.909 units, sell for 0.909*1.15=$1.045. Thusm decreasing par can reduce upper bound of market price. #### Par Control: Overview **direct-acting PI Control**: if error > 0: par increases elif error < 0: par decreases **process variable**: market TWAP **input error**: $1-market **control variable**: par **bias**: $1.00, control variable at zero error #### Par Control: additional details **control bounds**: [$0.85, $1.15] **control max absolute rate of change**: $0.01/4hours? **decaying integral**: after overpeg and subsequence par decrease >$1, par slowly creeps back up to $1. **integral clamping**: don't accumulate integral at control bounds or rate of change bounds **noise-barrier**: avoid par changes at smaller errors, (abs(error) < eps_1) ---> error = 0 **noise barrier ramp**: avoid a jump when crossing noise-barrier let: 0 > eps_1 > eps_2 -(abs(error) < eps_1) ---> error = 0 -(abs(error) < eps_2) ----> error = scale_down(error) -(abs(error) >= eps_2) ----> error = error ### Interest Rate Controller #### Motivation Primarily for underpeg scenario: raise interest rates when underpeg will increase demand from 1) buy and re-pay since borrow rate is too high 2) buy stable and locked in stability pool, which accrues some high % of interest fees. When overpeg, lowering rates to 0% can increase supply but history has shown CDP debt demand can be inelastic to rates. #### Rate Control Overview: **direct-acting PI Control**: if error > 0: rate increases elif error < 0: rate decreases **process variable**: market TWAP **input error**: $1-market **control variable**: interest rate **bias** = 0.5% annual, output at zero error #### Rate Control: additional details **control bounds**: [0.25%, 50%] **control max absolute rate of change**: 1%/4hours? **integral clamping** if bound rate is reached, don't keep accumulating error) **noise barrier** to avoid rate changes at smaller errors 0 > eps_1 > eps_2 **noise barrier ramp**: similar to above ### SP Revenue Share This is the default revenue share for loan interest paid by borrowers. | Entity | Allocation | | -------- | -------- | | Fee Token Stakers, staking of "Fee Token" | 25% | | SP Stakers, stakers of RD | 75% | Increased revenue flowing to SP stakers increases market demand for RD. In times of under-peg, the system will proportionately increase the SP allocation of revenue as follows. | Market Price | Fee Token Allocation | SP Allocation | -------- | -------- | --------- | | >= 0.997 | 25% | 75% | | < 0.997 |20% | 80% | | < 0.995 |15% | 85% | | < 0.993 |10% | 90% | | < 0.990 |0% | 100% | This prioritizes borrowers over fee stakers in an under-peg scenario by reducing the effective borrow rate that is required to return to peg. The fee stakers effectively forgo revenue to lower the borrow rate required to return to peg. ### Redemption Fee(same as Liquity) [Liquity Redemption Fee](https://docs.liquity.org/liquity-v1/faq/lusd-redemptions) Immediate redemption fee is a function of what % of supply is being redeemed. That redemption fee persists, but decays at a half-life of 12 hours. So market_floor = $1-fee, and will rise as the fee decays. ## Main actors influence on Market ### Borrowers par decrease -> lower c-ratio, somewhat more demand for leverage -> more minting/selling -> lower market price par increase: vice versa rate decrease -> cheaper loans ->more demand for leverage -> more minting/selling -> lower market price rate increase: vice versa market increase: if market gets very high(market > MCR * par), mint/sell arb is possible and market will come down > MCR * par ### Stability Pool Stakers rate increase -> more % yield in stability pool -> more market demand -> higher market price rate decrease: vice versa par increase/decrease: no dirrect affect. maybe if par affects market or future expected value of market ### Redemption Arb par increase: RD can be redemed for a higher $ of collateral ->market price increase par decrease: vice versa rate increase/decrease: no direct affect ## Exogenous Variables collateral prices risk-free interest rate