SONEX V3 Contract Deployments and Liquidity Guide

Introduction

SONEX currently supports V3 contract deployments exclusively, offering advanced features to enable seamless pool creation, liquidity provisioning, and trading. This guide explains the deployed contracts, their functions, and how to interact with them for pool creation and liquidity management.


Contract Addresses

Below is the complete list of SONEX V3 contract addresses:

Type

Contract Address

UniswapV3Factory

FACTORY_MULTICALL

PROXY_ADMIN

TRANSPARENT_UPGRADABLE_PROXY

TICK_LENS

SWAP_ROUTER

SWAP_ROUTER_V2

NFT_DESCRIPTOR

POSITION_DESCRIPTOR

NonfungiblePositionManager

QUOTER

QUOTER_V2


Key Features

1. createAndInitializePoolIfNecessary (Contract: NonfungiblePositionManager)

Creates a new pool if it does not exist, then initializes if not initialized

Note:

  • This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool.

Parameter:

  • token0:The contract address of token0 of the pool.

  • token1:The contract address of token1 of the pool.

  • fee:The fee amount of the v3 pool for the specified token pair.

  • sqrtPriceX96:The initial square root price of the pool as a Q64.96 value.

Return:

  • pool:Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessar

  function createAndInitializePoolIfNecessary(
    address token0,
    address token1,
    uint24 fee,
    uint160 sqrtPriceX96
  ) external returns (address pool)

2. Mint (Contract: NonfungiblePositionManager)

Creates a new position wrapped in a NFT. ( Adds liquidity )

Note :

  • Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized a method does not exist, i.e. the pool is assumed to be initialized.

Parameter :

  • struct INonfungiblePositionManager.MintParams:The params necessary to mint a position, encoded as MintParams in calldata.

Return :

  • tokenId:The ID of the token that represents the minted position.

  • liquidity:The amount of liquidity for this position.

  • amount0:The amount of token0.

  • amount1:The amount of token1.

  function mint(
    struct INonfungiblePositionManager.MintParams params
  ) external returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1)

3. getPool (Contract: UniswapV3Factory )

Use the getPool function in the FACTORY contract to check if a pool already exists.

Parameter:

  • tokenA:The contract address of either token0 or token1.

  • tokenB:The contract address of the other token.

  • fee:The fee collected upon every swap in the pool, denominated in hundredths of a bip.

Return:

  • pool:The pool address.

  function getPool(
    address tokenA,
    address tokenB,
    uint24 fee
  ) external view returns (address pool)

4. decreaseLiquidity(Contract: NonfungiblePositionManager)

Decreases the amount of liquidity in a position and accounts it to the position (remove Liquidity)

Parameter:

  • struct INonfungiblePositionManager.DecreaseLiquidityParams : tokenId The ID of the token for which liquidity is being decreased,

Return:

  • amount0:The amount of token0 accounted to the position's tokens owed.

  • amount1:The amount of token0 accounted to the position's tokens owed.

function decreaseLiquidity(
   struct INonfungiblePositionManager.DecreaseLiquidityParams params
) external returns (uint256 amount0, uint256 amount1)

5. burn(Contract: NonfungiblePositionManager)

Burns a token ID, which deletes it from the NFT contract.

Note :

  • The token must have 0 liquidity and all tokens must be collected first.

Parameter:

  • tokenId:The ID of the token that is being burned.

function burn(
   uint256 tokenId
) external

6. positions (Contract: NonfungiblePositionManager)

Returns the position information associated with a given token ID.

Note :

  • Throws if the token ID is not valid.

Parameter:

  • tokenId:The ID of the token that represents the position.

Return:

  • nonce:The nonce for permits.

  • operator:The address that is approved for spending.

  • token0:The address of the token0 for a specific pool.

  • token1:The address of the token1 for a specific pool.

  • fee:The fee associated with the pool.

  • tickLower:The lower end of the tick range for the position.

  • tickUpper:The higher end of the tick range for the position.

  • liquidity:The liquidity of the position.

  • feeGrowthInside0LastX128:The fee growth of token0 as of the last action on the individual position.

  • feeGrowthInside1LastX128:The fee growth of token1 as of the last action on the individual position.

  • tokensOwed0:The uncollected amount of token0 owed to the position as of the last computation.

  • tokensOwed1:The uncollected amount of token1 owed to the position as of the last computation

function getPool(
   address tokenA,
   address tokenB,
   uint24 fee
) external view returns (address pool)

Last updated