Pool Creation

Guide for creating and initializing VinuSwap pools after contract deployment.

Creating Pools

Pools are created through the Controller (which owns the Factory).

Via Controller

async function createPool(
    controller: Contract,
    tokenA: string,
    tokenB: string,
    fee: number,
    tickSpacing: number,
    feeManager: string
) {
    const tx = await controller.createPool(
        tokenA,
        tokenB,
        fee,
        tickSpacing,
        feeManager
    );

    const receipt = await tx.wait();
    const event = receipt.events.find((e: any) => e.event === 'PoolCreated');
    const poolAddress = event.args.pool;

    console.log('Pool created:', poolAddress);
    return poolAddress;
}

Common Pool Configurations

Pair Type
Fee (bps)
Tick Spacing
Use Case

Stable-Stable

100

1

Stablecoin pairs

Stable-Major

500

10

USDT/WVC

Standard

3000

60

Most pairs

Volatile

10000

200

Long-tail assets

Example Pool Creation Script

Initializing Pools

Price Encoding

Convert human-readable price to sqrtPriceX96:

Simple Price Encoding

Initialize via Controller

Initialize Directly on Pool

Setting Protocol Fees

Protocol fees determine what portion of swap fees go to the protocol.

Fee Protocol Values

Value
Protocol Share
LP Share

4

25%

75%

5

20%

80%

6

16.7%

83.3%

7

14.3%

85.7%

8

12.5%

87.5%

9

11.1%

88.9%

10

10%

90%

0

0% (disabled)

100%

Set via Controller

Verifying Pool Creation

Check Pool Exists

Full Verification Script

Adding Initial Liquidity

After creating pools, add initial liquidity:

Next Steps

Last updated