Pool
Ferra is a permissionless liquidity infrastructure where anyone can create and interact with DAMM pools.
Table of Contents
Get Pools
Fetch Ticks
Pool Transaction History
Create Pool
Get Pools
Retrieve pool information from the Ferra DAMM protocol.
Overview
The SDK provides multiple methods to fetch pool data, from basic immutable info to complete pool state with real-time data.
Quick Start
import { dammMainnet, initFerraSDK } from '@ferra-labs/damm'
// Initialize SDK
const sdk = initFerraSDK({
network: 'beta',
fullNodeUrl: 'https://...',
wallet: '0x...'
})
// Get a single pool
const pool = await sdk.Pool.getPool('0x...')
// Get multiple pools
const pools = await sdk.Pool.getPools()Get Single Pool
Fetch complete pool data with current state:
Get Multiple Pools
Basic Usage
With Pagination
Get Pool Immutables
Lightweight method for basic pool info:
Pool Data Structure
Filtering Pools
By Coin Types
Real-time Updates
Error Handling (Get Pools)
Fetch Ticks
Retrieve tick data from a pool. Two methods available:
fetchTicksByRpc (Recommended)
Fetches active ticks directly from the pool's tick manager. Faster and recommended for most use cases:
fetchTicks (Event-based)
Fetches ticks from on-chain events. More comprehensive but slower:
When to Use Which
fetchTicksByRpc
Fast
Active ticks only
Swap calculations, price impact
fetchTicks
Slower
All historical ticks
Full tick analysis
Pool Transaction History
Get transaction history for a pool (swaps, liquidity changes, fee collections):
Custom RPC URL
Use a different RPC for history queries (useful for archive nodes):
Create Pool
Create a new DAMM pool with initial liquidity in a single transaction. The SDK automatically handles coin type ordering according to protocol requirements.
Prerequisites
Valid sender address configured in SDK
Sufficient balance of both tokens
Token metadata (required)
Quick Start
Parameters
coinTypeA
string
✓
Type of coin A
coinTypeB
string
✓
Type of coin B
tick_spacing
number
✓
Tick spacing (determines fee tier)
initialize_sqrt_price
string
✓
Initial sqrt price
uri
string
✓
Pool URI (metadata)
amount_a
number | string
✓
Amount of token A
amount_b
number | string
✓
Amount of token B
fix_amount_a
boolean
✓
Whether to fix token A amount
slippage
number
✓
Slippage tolerance (0.05 = 5%)
collect_fee_mode
number
✓
Fee collection mode
is_quote_y
boolean
✓
Whether coin Y is the quote currency
fee_scheduler_mode
number
✓
Fee scheduler mode
enable_fee_scheduler
boolean
✓
Enable fee scheduler
enable_dynamic_fee
boolean
✓
Enable dynamic fee
activation_timestamp
number
✓
Timestamp for pool activation
tick_lower
number
Lower tick boundary (default: -443636)
tick_upper
number
Upper tick boundary (default: 443636)
metadata_a
string
Coin metadata ID for coin A
metadata_b
string
Coin metadata ID for coin B
Get Available Fee Tiers
Price Calculation
Calculate initial sqrt price:
Tick Spacing Guide
1
~0.01%
Stable pairs (USDC/USDT)
2
~0.02%
Low volatility pairs
10
~0.05%
Correlated pairs
60
~0.30%
Most pairs
200
~1.00%
Exotic/volatile pairs
Error Handling (Create Pool)
Important Notes
Coin types are automatically sorted according to protocol rules
The SDK handles coin selection from your wallet
Remaining coins are automatically returned to sender
Pool creation includes initial liquidity position (NFT)
Last updated