---
# System prepended metadata

title: FAQ on HomoraV2

---

# FAQ on HomoraV2

## UniswapV3 on HomoraV2

### UniswapV3 in general
1. A definition of UniV3?
    - UniswapV3 is a DEX allowing users to provide liquidity in a specific price range to gain more swap fee than UniswapV2. 
    - By doing this, the liquidity of the pool is more concentrated than UniswapV2 (more liquidity at a price).

2. How does UniV3 work?
    - UniswapV3 splits the price range into intervals. 
    - When users provide liquidity, the number of liquidity is added equally within a given tick range and users get an NFT token to represent a position *(Opening from NonfungiblePositionManager contract)*.
        - Users can add/remove liquidity in their position but cannot change the tick range. To change the tick range, you have to open a new position. 
    - Swapping tokens uses liquidity in the current tick (also changes the spot price) until the spot price moves outside the tick.

3. How does user get the product fee?
    - From UniswapV3 Document, swap fees are distributed pro-rata to all in-range liquidity at the time of the swap. 
        - If the spot price moves out of a position’s range, the given liquidity is no longer active and does not generate any fees. 
        - If the spot price reverses and reenters the position’s range, the position’s liquidity becomes active again and will generate fees.
    - Swap fees are not automatically reinvested (unlike UniswapV2); users must manually collect their fees.

### Spell and Wrappers (on Homora side)

1. What features that homora support?
    - Add/Remove liquidity.
    - Harvest (collect fee).
    - Close position (remove all liquidty and collect fee).
    - Reinvest (collect fee and add liqudity).

2. What happen if spot price is outside position's price range?
    - The position still exists. User can add/remove liqudity to reduce debt. However, we don't allow to borrow more on the position whose price range isn't over the spot price.

3. How to calculate position's value?
    - We use the fair price obtained from oracles to calculate the fair balance of token0 and token1 that the position holds and convert them into the position's value.

4. Does a liquidator gets the swap fee?
    - No, because the swap fee does not accrue like UniswapV2, and the collateral value does not reflect the swap fee. So, when liquidating the position, the collateral that the liquidator receives should be only the liquidity (exclude fee).

5. Who is the owner the UniswapV3 NFT position?
    - Wrapper contract.

6. What is the relationship between the number of wrapper that the position holds and the actual liquidity of the position?
    - It is 1-to-1. If the position holds 1000 tokens of wrapper, it mens that the position holds 1000 liquidty.

### Optimal Swap
1. How to calculate optimal swap?
    - The concept is that we try to swap every tick and see if the converted liquidity decreases. If yes, we halt the process because we exchange too many tokens.
    - However, crossing every tick is too slow. So, we calculate a range (consecutive ticks having the same liquidity) instead of a tick.

2. Is optimal swap inefficient?
    - It is a limitation of the uniswapV3 (liquidity on ticks is different). Calculating this on the transaction is inefficient (too much gas). So, we process it off-chain and control it with the slippage.


## Verifying contract

1. Contract code in [public repo](https://github.com/AlphaFinanceLab/alpha-homora-v2-contract) is not align with ABI file in gitbook.
    - The latest version of Homora contracts are in private repo. The ABI should be up to date. If not, feel free to contact us.

2. Is there any spot where we can see the verified contracts? Notice on production many contracts aren’t verified.
    - Unfortunately, there isn't. It's intended that we don't verify the contracts, for security reasons (to be on a safer side). 
    - However, the component flow + implementation should follow closely to the public repo. The diff is mainly supporting new pool types, more checks, gas opts, etc.