BOB
  • πŸ‘‹BOB Stablecoin
  • BOB Info
    • πŸ—ΊοΈBOB Ecosystem
      • Mellow Protocol Vaults
    • 🦊MetaMask
      • Swap BOB with Metamask Swap
    • πŸ”BOB Swap
    • πŸ¦„Uniswap v3
    • πŸ™‹β€β™€οΈBOB FAQ
  • BOB CDP
    • ℹ️About
    • πŸ’‘Use Cases
    • πŸ‘¨β€πŸŽ€System actors
    • πŸ“šSystem configurations
    • 🏦Vault health
    • 🏘️User flow examples
    • πŸ‘¨β€πŸ’»Technical docs
      • Position valuation (technical)
      • Liquidations
      • Deployment addresses
      • Smart Contracts
        • NFTVaultRegistry
        • NFTVault
        • UniV3Oracle
        • ChainlinkOracle
        • DebtMinter
        • SurplusMinter
    • πŸ™‹β€β™‚οΈCDP FAQ
  • BOB DAO
    • πŸ§‘β€πŸ€β€πŸ§‘Governance
      • BOB DAO
      • Protocol Governance
        • GP 0: Increase SAFE membership
        • GP 1: Bob Swap beta testing infrastructure
        • GP 2: Upgrade Contracts to v1.0.0
        • GP 3: Enable Bob Swap for Public Use
        • GP 4: Increase Multisig & Upgrade BOB contract on all networks
        • GP 5: Enable Bob Swap on Ethereum Mainnet
        • GP 6: Upgrade zkBob to support direct deposits
        • GP 7: Increase Multi-chain Inventory and Update Bob Swap
        • GP 8: Extend pool limits for KYC'd users
        • GP 9: Deactivate Kyberswap inventory pairs [Emergency Measure]
        • GP 10: Reallocate previous Kyberswap inventory
        • GP 11: Add 24 hour timelock to BOB contract on Optimism
        • GP 12: Raise Polygon limits
        • GP 13: Launch BOB CDP
        • GP 14: Migrate BOB pool to USDC on Polygon
        • GP 15: KYB tiers on Optimism
        • GP 16: Remove excess inventory on Arbitrum and BNB Smart Chain
        • GP 17: Remove excess inventory on Optimism and Ethereum
        • GP 18: Remove excess inventory on Polygon
        • GP 19: Accrued Revenue Allocation
        • GP 20: Migrate BOB pool to USDC on Optimism
        • GP 21: BOB inventory reduction
    • πŸ“‹Inventory
      • Inventory Actions
  • BOB Resources
    • 🧩Visual Assets
    • ⛓️Links
Powered by GitBook
On this page
  1. BOB CDP
  2. Technical docs

Position valuation (technical)

All Uniswap V3 NFTs deposited as collateral are evaluated independently. The total collateral value is equal to the sum of all NFTs collateral values.

C=βˆ‘ciC = \sum{c_i}C=βˆ‘ci​

Each Uniswap V3 position contains 2 ERC20 tokens, whose ratio changes during market volatility. Protocol relies on the Chainlink oracle for obtaining prices of individual tokens, with a possibility of manually setting fallback prices in the event Chainlink outage.

The collateral value is calculated using the following approach:

C=βˆ‘ci=βˆ‘px(ax+fx)+py(ay+fy)C = \sum{c_i} = \sum{p_x(a_x + f_x) + p_y(a_y + f_y)}C=βˆ‘ci​=βˆ‘px​(ax​+fx​)+py​(ay​+fy​)

Where:

  • pxp_xpx​is a normalized token price returned from Chainlink

  • axa_xax​ is an amount of token xxx in Uniswap position, derived from the amount of Uniswap liquidaty and price ration py/pxp_y/p_xpy​/px​

  • fxf_xfx​ is an amount of accumulated LP fees within position

Borrower max debt limit is calculated using collateral-specific borrow thresholds:

Cb=βˆ‘tb,ici=βˆ‘tb,i(px(ax+fx)+py(ay+fy))C_b = \sum{t_{b,i}c_i} = \sum t_{b,i}({p_x(a_x + f_x) + p_y(a_y + f_y))}Cb​=βˆ‘tb,i​ci​=βˆ‘tb,i​(px​(ax​+fx​)+py​(ay​+fy​))

Where:

  • tb,it_{b,i}tb,i​ - is a borrow threshold set by governance for collateral iii

Borrower is not immediately liquidated once max debt limit is exceeded, instead higher liquidation limit is used for determining if position is subject to liquidation.

Cb≀Cl=βˆ‘tl,ici=βˆ‘tl,i(px(ax+fx)+py(ay+fy))C_b \leq C_l = \sum{t_{l,i}c_i} = \sum t_{l,i}({p_x(a_x + f_x) + p_y(a_y + f_y))}Cb​≀Cl​=βˆ‘tl,i​ci​=βˆ‘tl,i​(px​(ax​+fx​)+py​(ay​+fy​))

Where:

  • tb,i≀tl,it_{b,i} \leq t_{l,i}tb,i​≀tl,i​ - is a liquidation threshold set by governance for collateral iii

Price manipulation safety

It’s important to note that evaluated collateral value of Uniswap V3 positions does not depend on the current spot price in the Uniswap V3 pool, and instead is purily based on Chainlink oracle responses. This makes it impossible to manipulate price valuations using sandwiching or other attacks, however it introduces small differences between valuations in BOB CDP and in Uniswap UI.

In practice, this means that BOB CDP valuations can be up to ~0.1% (based on conducted backtesting) smaller than numbers shown in Uniswap UI, making such differences barely noticable.

PreviousTechnical docsNextLiquidations

Last updated 2 years ago

πŸ‘¨β€πŸ’»