GEB Docs
  • Introduction to GEB
  • Community Resources
  • FLX Mechanics
  • FAQ
  • RAI
    • RAI Use-Cases
    • Multi-chain RAI
    • RAI Integrations
  • The Money God League
    • Intro to The League
  • Ungovernance
    • Governance Minimization Guide
  • Risk
    • GEB Risks
    • PID Failure Modes & Responses
  • Incentives
    • RAI Uniswap V2 Mint + LP Incentives Program
    • RAI Uniswap V3 Mint + LP Incentives Program (Inactive)
    • FLX Staking
    • RAI / ETH Uniswap V3 Oracle LP Incentives Program
  • Contract Variables Translation
    • Core Contracts Naming Transition
    • Governance Contracts Naming Transition
    • SAFE Management Contract Naming Transition
  • System Contracts
    • Core Module
      • SAFE Engine
      • Liquidation Engine
      • Accounting Engine
    • Auction Module
      • English Collateral Auction House
      • Fixed Discount Collateral Auction House
      • Increasing Discount Collateral Auction House
      • Debt Auction House
      • Surplus Auction House
    • Oracle Module
      • Oracle Relayer
      • Medianizer
        • DSValue
        • Governance Led Median
        • Chainlink Median
        • Uniswap V2 Median
      • FSM
        • Oracle Security Module
        • Dampened Security Module
        • FSM Governance Interface
    • Token Module
      • Token Adapters
      • System Coin
      • Protocol Token
      • Protocol Token Authority
      • Protocol Token Printing Permissions
    • Money Market Module
      • Tax Collector
    • Sustainability Module
      • Stability Fee Treasury
      • FSM Wrapper
      • Increasing Treasury Reimbursement
      • Mandatory Fixed Treasury Reimbursement
      • Increasing Reward Relayer
    • Automation Module
      • Collateral Auction Throttler
      • Single Spot Debt Ceiling Setter
      • ESM Threshold Setter
    • Governance Module
      • DSPause
    • Shutdown Module
      • Global Settlement
      • ESM
  • Proxy Infrastructure
    • DSProxy
    • Proxy Registry
  • Helper Contracts
    • SAFE Manager
  • GEB.js
    • Getting Started
    • Global Settlement Guide
    • API Reference
      • Geb
      • Safe
      • Proxy Actions
      • Geb Admin
  • APIs
    • API Endpoints
  • Pyflex
    • Getting Started
      • Configuration
      • GEB Basics
    • SAFE Management
      • Opening a SAFE
      • Closing a SAFE
    • Numerics
  • Keepers
    • Keeper Overview
    • Collateral Auction Keeper
      • Running in Docker
      • Running on a Host
      • Liquidations & Collateral Auctions
      • Collateral Auction Flash Swaps
    • Debt Auction Keeper
      • Running in Docker
      • Running on a Host
    • Staked Token Auction Keeper
      • Running in Docker
      • Running on a Host
    • Surplus Auction Keeper
      • Running in Docker
      • Running on a Host
    • Bidding Models
  • Liquidation Protection
    • SAFE Protection
    • Liquidation Protection Guide
    • Uni-V2 RAI/ETH Savior Details
    • Curve V1 Savior Details
Powered by GitBook
On this page
  • Overview
  • Minimum Savior Balance Calculation

Was this helpful?

  1. Liquidation Protection

Curve V1 Savior Details

PreviousUni-V2 RAI/ETH Savior Details

Last updated 3 years ago

Was this helpful?

This is the math and logic that would apply in the case of a Curve V1 saviour integrated with the RAI protocol.

Overview

The Curve V1 savior requires SAFE owners to deposit Curve RAI/3Pool LP tokens. The RAI/3Pool contract can be found .

Upon liquidation, the Curve savior will withdraw all underlying liquidity (RAI + 3Pool tokens) from the LP shares protecting the liquidated SAFE. It will then use the withdrawn RAI to pay back as much debt as possible from the SAFE. The 3Pool tokens aren't used in this process and will need to be withdrawn manually from the savior at a later date.

Minimum Savior Balance Calculation

We reuse the variable naming and debt/collateral liquidation relationship from the .

C+ClpD−Dlp=AccRtarPrpPliq\frac{C + C_{lp}}{D - D_{lp}} = \frac{A_{cc}R_{tar}P_{rp}}{P_{liq}}D−Dlp​C+Clp​​=Pliq​Acc​Rtar​Prp​​

In the curve savior we aren't adding any collateral, therefore Clp=0C_{lp}=0Clp​=0. ForDlpD_{lp}Dlp​ we have to calculate the amount of RAI withdrawn from the pool. We will assume that the USD value of the pool stays 50/50 and that RAI trades close to it redemption price. Therefore for each RAI-3Pool LP token KRAI3PoolK_{RAI3Pool}KRAI3Pool​ we are getting D=KRAI3Pool2PrpD = \frac{K_{RAI3Pool}}{2 P_{rp}}D=2Prp​KRAI3Pool​​RAI which give us the following formula:

2CPrp2PrpD−KRAI3Pool=AccRtarPrpPliq\frac{2CP_{rp}}{2P_{rp}D - K_{RAI3Pool}} = \frac{A_{cc}R_{tar}P_{rp}}{P_{liq}} 2Prp​D−KRAI3Pool​2CPrp​​=Pliq​Acc​Rtar​Prp​​

Which then gives us (after also replacing the liquidation price):

K=2PrpD−2CPliqAaccRtar=2PrpD−2DPrpRliqRtar=2PrpD(1−RliqRtar)K = 2P_{rp}D- \frac{2CP_{liq}}{A_{acc}R_{tar}} = 2P_{rp}D-\frac{2DP_{rp}R_{liq}}{R_{tar}} = 2P_{rp}D( 1 - \frac{R_{liq}}{R_{tar}})K=2Prp​D−Aacc​Rtar​2CPliq​​=2Prp​D−Rtar​2DPrp​Rliq​​=2Prp​D(1−Rtar​Rliq​​)

To this we have to add the $2000 liquidator fee.

To help with the whole calculation, you can use the following spreadsheet:

here
Uni-v2 savior calculation