Pool
The pool contract is the main contract responsible for maintaining the pool's current price, current liquidity, and all deposited liquidity. It also determines output amounts for swaps and handles liquidity burning.
Interface
get_pool_data
get_pool_data
Returns pool data.
Arguments
None
Returns
slice
Token0 vault address
slice
Token1 vault address
int
LP fee
int
Protocol fee
int
Referral fee
slice
Protocol fee address
int
Token0 protocol fee earned
int
Token1 protocol fee earned
int
Sqrt price X128
int
Current lower tick
int
Current upper tick
int
Current tick
int
Current liquidity
int
Is initialized
int
Is active
int
Tx count
int
Global fee growth in token0 X128
int
Global fee growth in token1 X128
int
Min tick (pool index)
int
Seconds
int
Seconds per liquidity cumulative X128
get_tick_data
get_tick_data
Returns entire pool tick data.
Arguments
None
Returns
dict
All tick data
Tick Format
Int32
Tick
Cell
Tick data
Tick Data Contents
Int128
Liquidity delta at tick
Uint128
Gross liquidity at tick
Uint256
Fee growth in token0 above tick X128
Uint256
Fee growth in token1 above tick X128
^Cell
Tick seconds data
β Uint256
: Seconds
β Uint256
: Cumulative sec/liquidity X128
get_nft_address_by_index
get_nft_address_by_index
Returns NFT position address for a given index.
Arguments
int
Position index
Returns
slice
User LP wallet address
get_simulate_swap
get_simulate_swap
Simulates a swap and returns result.
Arguments
int
Is token0 in
int
Amount in
Returns
int
Exit code
int
State was altered
int
Refund amount
int
Other token output
int
Is fwd (ignore)
int
Fwd amount (ignore)
int
Number of ticks crossed
get_amounts_for_liquidity
get_amounts_for_liquidity
Get required token amounts to provide liquidity.
Arguments
int
Liquidity
int
Lower tick
int
Upper tick
Returns
int
Amount0 required
int
Amount1 required
Messages
Add Liquidity
Uint32
Opcode
Uint64
Query ID
Int32
Low tick
Int32
High tick
Coins
Amount0
Coins
Amount1
Address
User address
Uint128
Liquidity
^Cell
Farm data
Uint1
Should stake
Maybe Uint32
Farm index
Swap
Uint32
Opcode
Uint64
Query ID
Address
Destination user address
Address
User address
Coins
Amount in
Coins
Desired amount out
Uint1
Is exact in
Uint1
Has referral address
Maybe ^Cell
Referral address cell
β Address
Referral address
^Cell
Custom DEX data
β Coins
Custom forward amount
β Uint1
Has custom payload
β Maybe ^Cell
Custom payload
Coins
Refund forward payload
Uint1
Has refund payload
Maybe ^Cell
Refund payload
Burn Liquidity
Uint32
Opcode
Int32
Low tick
Int32
High tick
Uint128
Liquidity
Uint64
Position index
Burn Notification
Uint32
Opcode
Uint64
Query ID
Int32
Low tick
Int32
High tick
Uint128
Liquidity
Address
User address
Uint64
Position index
Stake Liquidity
Uint32
Opcode
Uint64
Query ID
Int32
Low tick
Int32
High tick
Uint128
Liquidity
Uint256
Tx count
^Cell
Farm data cell
β Uint64
Farming rewards start time
β Uint64
Farming rewards end time
β Address
User address
β Uint64
Position index
β Uint32
Farm index
Unstake LP
Uint32
Opcode
Uint64
Query ID
Int32
Low tick
Int32
High tick
Uint128
Liquidity
Uint256
Tx count
Uint32
Farm index
Uint1
Should restake
^Cell
Farm data cell
β Uint256
Position sec/liquidity growth inside X128
β Uint64
Start timestamp
β Uint64
End timestamp
Stake LP
Uint32
Opcode
Uint64
Query ID
Address
User address
Uint64
Position index
Int32
Low tick
Int32
High tick
Uint128
Liquidity
Uint256
Tx count
Uint32
Farm index
Stake Notification
Uint32
Opcode
Uint64
Query ID
Uint32
Farm index
Uint64
Position index
Address
Response address
Collect Protocol Fees
Uint32
Opcode
Uint64
Query ID