Libraries Overview

VinuSwap includes numerous helper libraries for common operations.

Core Libraries

These libraries are used within the core pool contract.

Library
Purpose

TickMath

Tick ↔ sqrtPrice conversions

SqrtPriceMath

Price-related calculations

SwapMath

Compute swap step amounts

Position

Position state management

Tick

Tick state management

TickBitmap

Efficient tick lookup

Oracle

TWAP observation management

FullMath

512-bit math operations

UnsafeMath

Gas-optimized math

LowGasSafeMath

Safe math with low gas

SafeCast

Safe type conversions

Periphery Libraries

Library
Source
Purpose

periphery/libraries/Path.sol

Multi-hop path encoding

periphery/libraries/PoolAddress.sol

Deterministic address computation

periphery/libraries/LiquidityAmounts.sol

Token ↔ liquidity calculations

periphery/libraries/OracleLibrary.sol

TWAP helpers

periphery/libraries/CallbackValidation.sol

Callback security

PositionKey

periphery/libraries/PositionKey.sol

Position storage key derivation

PositionValue

periphery/libraries/PositionValue.sol

Position value calculations

NFTDescriptor

periphery/libraries/NFTDescriptor.sol

NFT metadata generation

NFTSVG

periphery/libraries/NFTSVG.sol

SVG generation utilities

TransferHelper

periphery/libraries/TransferHelper.sol

Safe token transfers

BytesLib

periphery/libraries/BytesLib.sol

Byte array utilities

HexStrings

periphery/libraries/HexStrings.sol

Hex string conversion

ChainId

periphery/libraries/ChainId.sol

Chain ID helpers

SqrtPriceMathPartial

periphery/libraries/SqrtPriceMathPartial.sol

Partial price math

TokenRatioSortOrder

periphery/libraries/TokenRatioSortOrder.sol

Token ordering

VinuSwap Custom Libraries

Library
Source
Purpose

VinuSwapPoolTicksCounter

periphery/libraries/VinuSwapPoolTicksCounter.sol

Enhanced tick counting

Usage Examples

Path Library

PoolAddress Library

LiquidityAmounts Library

CallbackValidation Library

TransferHelper Library

Last updated