πŸ€–
Titan
Titan - English
Titan - English
  • πŸ€–Welcome to Titan
  • πŸ’‘ Why use Titan swaps?
  • πŸ› οΈ Products
  • 🚒 Factory
  • How Do I Use Titan?
  • Titan Walkthrough
    • Swapping
    • Depositing Liquidity
    • Withdrawing Liquidity
    • Staking & Unstaking to Earn Rewards
  • πŸ›οΈ Colossus: Concentrated Liquidity AMM
    • πŸ—Ώ Colossus Overview
    • πŸ” Colossus Audits
    • 🧠 Smart Contracts
      • Deployed Contract Addresses
      • Router
      • Vault
      • Pool Manager
      • LP Account
      • Pool
      • Position
      • Farm
    • πŸ‘¨πŸ»β€πŸ’» Common Uses
      • Swap
      • Provide Liquidity
      • Burn Liquidity
      • Harvest Pool Fees
      • Stake position
      • Unstake position
      • Harvest Staking Rewards
    • 🧭 Examples
      • Swap SDK
  • βš™οΈ How to list a pool on Titan
  • ⚑ Titan Swap API
  • πŸ›Bug Bounty
  • πŸ” FAQs
  • πŸ‡·πŸ‡Ί Titan-Русский
Powered by GitBook
On this page
  • Interface
  • get_pool_data
  • get_tick_data
  • get_nft_address_by_index
  • get_simulate_swap
  • get_amounts_for_liquidity
  • Messages
  • Add Liquidity
  • Swap
  • Burn Liquidity
  • Burn Notification
  • Stake Liquidity
  • Unstake LP
  • Stake LP
  • Stake Notification
  • Collect Protocol Fees
  1. πŸ›οΈ Colossus: Concentrated Liquidity AMM
  2. 🧠 Smart Contracts

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

Returns pool data.

Arguments

None

Returns

Data Type
Description

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

Returns entire pool tick data.

Arguments

None

Returns

Data Type
Description

dict

All tick data

Tick Format

Key
Value

Int32

Tick

Cell

Tick data

Tick Data Contents

Data Type
Description

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

Returns NFT position address for a given index.

Arguments

Data Type
Description

int

Position index

Returns

Data Type
Description

slice

User LP wallet address


get_simulate_swap

Simulates a swap and returns result.

Arguments

Data Type
Description

int

Is token0 in

int

Amount in

Returns

Data Type
Description

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 required token amounts to provide liquidity.

Arguments

Data Type
Description

int

Liquidity

int

Lower tick

int

Upper tick

Returns

Data Type
Description

int

Amount0 required

int

Amount1 required


Messages

Add Liquidity

Opcode: 0x33f9243b
Data Type
Description

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

Opcode: 0x6559ce1d
Data Type
Description

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

Opcode: 0xf8f6fc24
Data Type
Description

Uint32

Opcode

Int32

Low tick

Int32

High tick

Uint128

Liquidity

Uint64

Position index


Burn Notification

Opcode: 0x7bdd97de
Data Type
Description

Uint32

Opcode

Uint64

Query ID

Int32

Low tick

Int32

High tick

Uint128

Liquidity

Address

User address

Uint64

Position index


Stake Liquidity

Opcode: 0x5576549b
Data Type
Description

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

Opcode: 0x82acbf5f
Data Type
Description

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

Opcode: 0x80c51caa
Data Type
Description

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

Opcode: 0xbaaf2375
Data Type
Description

Uint32

Opcode

Uint64

Query ID

Uint32

Farm index

Uint64

Position index

Address

Response address


Collect Protocol Fees

Opcode: 0x4ab8bdfa
Data Type
Description

Uint32

Opcode

Uint64

Query ID

PreviousLP AccountNextPosition