# Position valuation (technical)

Last updated

Last updated

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 = \sum{c_i}$

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 = \sum{c_i} = \sum{p_x(a_x + f_x) + p_y(a_y + f_y)}$

Where:

$p_x$is a normalized token price returned from Chainlink

$a_x$ is an amount of token $x$ in Uniswap position, derived from the amount of Uniswap liquidaty and price ration $p_y/p_x$

$f_x$ is an amount of accumulated LP fees within position

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

$C_b = \sum{t_{b,i}c_i} = \sum t_{b,i}({p_x(a_x + f_x) + p_y(a_y + f_y))}$

Where:

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.

Where:

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.

$t_{b,i}$ - is a borrow threshold set by governance for collateral $i$

$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))}$

$t_{b,i} \leq t_{l,i}$ - is a liquidation threshold set by governance for collateral $i$