Core Concepts

This page covers the fundamental concepts behind VinuSwap's concentrated liquidity protocol.

Concentrated Liquidity

Unlike traditional AMMs that spread liquidity uniformly across all prices (0 to ∞), VinuSwap allows liquidity providers to concentrate their capital within custom price ranges.

How It Works

Traditional AMM (x * y = k):
Liquidity spread across entire price range
┌────────────────────────────────────────┐
│████████████████████████████████████████│
└────────────────────────────────────────┘
  $0                                    $∞

VinuSwap Concentrated Liquidity:
Liquidity concentrated in active range
┌────────────────────────────────────────┐
│          ████████████████              │
└────────────────────────────────────────┘
  $0      $1,800    $2,200              $∞
           ▲ Active Range ▲

Benefits

  1. Capital Efficiency: Up to 4000x more capital efficient than traditional AMMs

  2. Higher Fee Earnings: Concentrated capital earns more fees within the active range

  3. Customizable Exposure: LPs choose their price exposure

Trade-offs

  • Liquidity only earns fees when price is within the selected range

  • Positions require more active management

  • Impermanent loss can be higher if price moves outside the range

Ticks and Tick Spacing

VinuSwap discretizes the price space into ticks. Each tick represents a 0.01% (1 basis point) price change.

Tick Math

For example:

  • Tick 0 = price 1.0

  • Tick 100 = price 1.0001^100 ≈ 1.01

  • Tick -100 = price 1.0001^-100 ≈ 0.99

Tick Spacing

Tick spacing determines which ticks can be initialized with liquidity. A tick spacing of 10 means only ticks divisible by 10 can be used as range boundaries.

Tick Spacing
Use Case

1

Stable pairs (0.01% increments)

10

Standard pairs (0.1% increments)

60

Volatile pairs (0.6% increments)

Positions

A position represents a liquidity provider's capital within a specific price range.

Position Parameters

Parameter
Description

owner

Address that owns the position

tickLower

Lower bound of the price range

tickUpper

Upper bound of the price range

liquidity

Amount of liquidity in the position

Position States

Fees

Swap Fees

Fees are collected on every swap and distributed proportionally to in-range liquidity providers.

Protocol Fees

A portion of swap fees can be directed to the protocol through the feeProtocol parameter:

Price Representation

VinuSwap stores prices in Q64.96 fixed-point format as sqrtPriceX96:

Conversion Examples

Oracle

Each pool maintains a time-weighted average price (TWAP) oracle through observations.

Observations

Using the Oracle

Liquidity Math

Adding Liquidity

When adding liquidity to a range, the required token amounts depend on the current price relative to the range:

Liquidity Amount Calculation

Callbacks

VinuSwap uses a callback pattern for efficient token transfers:

Swap Callback Flow

Mint Callback Flow

VinuSwap Extensions

Fee Manager

VinuSwap adds a fee manager system allowing dynamic fee computation:

This enables:

  • Tiered discounts based on token holdings

  • Per-pool fee overrides

  • Custom fee logic

Position Locking

The NonfungiblePositionManager includes position locking:

Locked positions cannot:

  • Decrease liquidity

  • Be burned

But can still:

  • Collect accumulated fees

  • Increase liquidity

Next Steps

Last updated