Contract Modules
This document contains detailed descriptions of all public functions in the Turbos CLMM (Concentrated Liquidity Market Maker) protocol.
Table of Contents
Pool Factory Module
Pool Module
Position Manager Module
Swap Router Module
Reward Manager Module
Pool Fetcher Module
Position NFT Module
Partner Module
Pool Factory Module
The Pool Factory is responsible for managing liquidity pool creation, configuration, and access control.
Pool Creation Functions
deploy_pool_and_mint
public entry fun deploy_pool_and_mint<CoinTypeA, CoinTypeB, FeeType>(
pool_config: &mut PoolConfig,
feeType: &Fee<FeeType>,
sqrt_price: u128,
positions: &mut Positions,
coins_a: vector<Coin<CoinTypeA>>,
coins_b: vector<Coin<CoinTypeB>>,
tick_lower_index: u32,
tick_lower_index_is_neg: bool,
tick_upper_index: u32,
tick_upper_index_is_neg: bool,
amount_a_desired: u64,
amount_b_desired: u64,
amount_a_min: u64,
amount_b_min: u64,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Creates a new liquidity pool and simultaneously mints initial liquidity position Parameters:
pool_config
: Pool configuration objectfeeType
: Fee type configurationsqrt_price
: Square root of initial pricepositions
: Position managercoins_a/coins_b
: Tokens to be addedtick_lower/upper_index
: Price range boundsamount_a/b_desired
: Desired token amounts to addamount_a/b_min
: Minimum token amounts to addrecipient
: Recipient addressdeadline
: Transaction deadline
deploy_pool_and_mint_with_return_
public fun deploy_pool_and_mint_with_return_<CoinTypeA, CoinTypeB, FeeType>(
// Same parameters as above function
): (TurbosPositionNFT, Coin<CoinTypeA>, Coin<CoinTypeB>, ID)
Function: Creates pool and mints liquidity, returns NFT and remaining tokens Returns: Position NFT, remaining coin A, remaining coin B, pool ID
deploy_pool
public entry fun deploy_pool<CoinTypeA, CoinTypeB, FeeType>(
pool_config: &mut PoolConfig,
feeType: &Fee<FeeType>,
sqrt_price: u128,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Only creates a new liquidity pool without adding liquidity
get_pool_id
public fun get_pool_id<CoinTypeA, CoinTypeB, FeeType>(
pool_config: &mut PoolConfig,
): Option<ID>
Function: Gets the pool ID for specified token pair and fee type Returns: Pool ID (if exists)
Pool Module
The Pool module is the core of the CLMM protocol, responsible for handling liquidity, swaps, and price calculations.
Version Management Functions
version
public fun version(versioned: &Versioned): u64
Function: Gets current protocol version number
check_version
public fun check_version(versioned: &Versioned)
Function: Checks if protocol version matches
Flash Loan Functions
flash_swap
public fun flash_swap<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
recipient: address,
a_to_b: bool,
amount_specified: u128,
amount_specified_is_input: bool,
sqrt_price_limit: u128,
clock: &Clock,
ctx: &mut TxContext
): FlashSwapReceipt<CoinTypeA, CoinTypeB>
Function: Executes flash swap, returns receipt that needs to be repaid
flash_swap_partner
public fun flash_swap_partner<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
partner: &Partner,
recipient: address,
a_to_b: bool,
amount_specified: u128,
amount_specified_is_input: bool,
sqrt_price_limit: u128,
clock: &Clock,
ctx: &mut TxContext
): FlashSwapReceiptPartner<CoinTypeA, CoinTypeB>
Function: Executes flash swap through partner
repay_flash_swap
public fun repay_flash_swap<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
coin_a: Coin<CoinTypeA>,
coin_b: Coin<CoinTypeB>,
receipt: FlashSwapReceipt<CoinTypeA, CoinTypeB>,
ctx: &mut TxContext
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Repays flash swap, returns remaining tokens
repay_flash_swap_partner
public fun repay_flash_swap_partner<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
partner: &mut Partner,
coin_a: Coin<CoinTypeA>,
coin_b: Coin<CoinTypeB>,
receipt: FlashSwapReceiptPartner<CoinTypeA, CoinTypeB>,
ctx: &mut TxContext
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Repays partner flash swap
flash_swap_pay_amount
public fun flash_swap_pay_amount<CoinTypeA, CoinTypeB>(
swap_receipt: &FlashSwapReceiptPartner<CoinTypeA, CoinTypeB>
): u64
Function: Gets the amount that needs to be paid for flash swap
Tick Related Functions
next_initialized_tick_within_one_word
public fun next_initialized_tick_within_one_word<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>,
tick: I32,
lte: bool,
): (I32, bool)
Function: Finds next initialized tick within one word range
position_tick
public fun position_tick(tick: I32): (I32, u8)
Function: Calculates word position and bit index for position tick
get_tick
public fun get_tick<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>,
tick_index: I32,
): TickInfo
Function: Gets information for specified tick
Position Related Functions
get_position
public fun get_position<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>,
position_key: ID,
): PositionInfo
Function: Gets position information
check_position_exists
public fun check_position_exists<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>,
position_key: ID,
): bool
Function: Checks if position exists
get_position_key_fix
public fun get_position_key_fix<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>,
tick_lower_index: I32,
tick_upper_index: I32,
user_address: address,
): ID
Function: Generates unique identifier for position
get_position_key
public fun get_position_key(
tick_lower_index: I32,
tick_upper_index: I32,
user_address: address,
): ID
Function: Generates position key from parameters
Pool State Query Functions
get_pool_fee
public fun get_pool_fee<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>
): u32
Function: Gets pool fee rate
get_pool_sqrt_price
public fun get_pool_sqrt_price<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>
): u128
Function: Gets pool's current sqrt price
get_pool_current_index
public fun get_pool_current_index<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>
): I32
Function: Gets pool's current tick index
get_pool_liquidity
public fun get_pool_liquidity<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>
): u128
Function: Gets pool's current liquidity
get_pool_balance
public fun get_pool_balance<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>
): (u64, u64)
Function: Gets pool's token balances
get_pool_info
public fun get_pool_info<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>
): PoolInfo
Function: Gets complete pool information
Fee and Reward Query Functions
get_pool_fee_growth_global
public fun get_pool_fee_growth_global<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>
): (u128, u128)
Function: Gets global fee growth
get_position_fee_growth_inside_a
public fun get_position_fee_growth_inside_a<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>,
position_key: ID,
): u128
Function: Gets position's internal fee growth for token A
get_position_base_info
public fun get_position_base_info<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>,
position_key: ID,
): (I32, I32, u128)
Function: Gets position's basic info (tick range and liquidity)
get_reward_info
public fun get_reward_info<CoinTypeA, CoinTypeB, FeeType>(
pool: &Pool<CoinTypeA, CoinTypeB, FeeType>,
reward_index: u64,
): PoolRewardInfo
Function: Gets reward information
Position Manager Module
The Position Manager is responsible for managing liquidity position minting, burning, and liquidity adjustments.
Liquidity Minting Functions
mint
public entry fun mint<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
coins_a: vector<Coin<CoinTypeA>>,
coins_b: vector<Coin<CoinTypeB>>,
tick_lower_index: u32,
tick_lower_index_is_neg: bool,
tick_upper_index: u32,
tick_upper_index_is_neg: bool,
amount_a_desired: u64,
amount_b_desired: u64,
amount_a_min: u64,
amount_b_min: u64,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Mints new liquidity position
mint_with_return_
public fun mint_with_return_<CoinTypeA, CoinTypeB, FeeType>(
// Same parameters as above function
): (TurbosPositionNFT, Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Mints liquidity position and returns NFT and remaining tokens
Liquidity Burning Functions
burn
public entry fun burn<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
nft: TurbosPositionNFT,
amount_a_min: u64,
amount_b_min: u64,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Burns liquidity position and collects tokens
Liquidity Adjustment Functions
increase_liquidity
public entry fun increase_liquidity<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
nft: &TurbosPositionNFT,
coins_a: vector<Coin<CoinTypeA>>,
coins_b: vector<Coin<CoinTypeB>>,
amount_a_desired: u64,
amount_b_desired: u64,
amount_a_min: u64,
amount_b_min: u64,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Increases position's liquidity
increase_liquidity_with_return_
public fun increase_liquidity_with_return_<CoinTypeA, CoinTypeB, FeeType>(
// Same parameters as above function
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Increases liquidity and returns remaining tokens
decrease_liquidity
public entry fun decrease_liquidity<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
nft: &TurbosPositionNFT,
liquidity: u128,
amount_a_min: u64,
amount_b_min: u64,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Decreases position's liquidity
decrease_liquidity_with_return_
public fun decrease_liquidity_with_return_<CoinTypeA, CoinTypeB, FeeType>(
// Same parameters as above function
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Decreases liquidity and returns tokens
Fee Collection Functions
collect
public entry fun collect<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
nft: &TurbosPositionNFT,
amount_a_max: u64,
amount_b_max: u64,
recipient: address,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Collects trading fees generated by position
collect_with_return_
public fun collect_with_return_<CoinTypeA, CoinTypeB, FeeType>(
// Same parameters as above function
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Collects fees and returns coin objects
Reward Collection Functions
collect_reward
public entry fun collect_reward<CoinTypeA, CoinTypeB, FeeType, RewardCoin>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
nft: &TurbosPositionNFT,
vault: &mut PoolRewardVault<RewardCoin>,
reward_index: u64,
amount_requested: u64,
recipient: address,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Collects position's reward tokens
collect_reward_with_return_
public fun collect_reward_with_return_<CoinTypeA, CoinTypeB, FeeType, RewardCoin>(
// Same parameters as above function
): Coin<RewardCoin>
Function: Collects rewards and returns coin object
NFT Management Functions
burn_position_nft_with_return_
public fun burn_position_nft_with_return_<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
nft: TurbosPositionNFT,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Burns position NFT and returns tokens
burn_nft_collect_reward_with_return_
public fun burn_nft_collect_reward_with_return_<CoinTypeA, CoinTypeB, FeeType, RewardCoin>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
nft: TurbosPositionNFT,
vault: &mut PoolRewardVault<RewardCoin>,
reward_index: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
): (Coin<CoinTypeA>, Coin<CoinTypeB>, Coin<RewardCoin>)
Function: Burns NFT and collects rewards
burn_nft_collect_fee_with_return_
public fun burn_nft_collect_fee_with_return_<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
positions: &mut Positions,
nft: TurbosPositionNFT,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Burns NFT and collects fees
Query Functions
get_position_info
public fun get_position_info(
positions: &Positions,
nft: &TurbosPositionNFT
): (I32, I32, u128, u64, u64, vector<PositionRewardInfo>)
Function: Gets detailed position information
get_nft_minted
public fun get_nft_minted(positions: &Positions): u64
Function: Gets number of minted NFTs
burn_nft_directly
public entry fun burn_nft_directly(
positions: &mut Positions,
nft: TurbosPositionNFT,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Directly burns empty position NFT
Swap Router Module
The Swap Router provides token swapping functionality, supporting single-step and multi-step swaps.
Single-Step Swap Functions
swap_a_b
public entry fun swap_a_b<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
coins_a: vector<Coin<CoinTypeA>>,
amount: u64,
amount_threshold: u64,
sqrt_price_limit: u128,
is_exact_in: bool,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Swaps token A for token B
swap_a_b_with_return_
public fun swap_a_b_with_return_<CoinTypeA, CoinTypeB, FeeType>(
// Same parameters as above function
): (Coin<CoinTypeB>, Coin<CoinTypeA>)
Function: Swaps tokens and returns result tokens
swap_b_a
public entry fun swap_b_a<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
coins_b: vector<Coin<CoinTypeB>>,
amount: u64,
amount_threshold: u64,
sqrt_price_limit: u128,
is_exact_in: bool,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Swaps token B for token A
swap_b_a_with_return_
public fun swap_b_a_with_return_<CoinTypeA, CoinTypeB, FeeType>(
// Same parameters as above function
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Swaps tokens and returns result tokens
Partner Swap Functions
swap_with_partner
public fun swap_with_partner<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
partner: &mut Partner,
coins: vector<Coin<CoinTypeA>>,
a_to_b: bool,
amount: u64,
amount_threshold: u64,
sqrt_price_limit: u128,
is_exact_in: bool,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
): (Coin<CoinTypeA>, Coin<CoinTypeB>)
Function: Swaps through partner with fee sharing
Multi-Step Swap Functions
swap_a_b_b_c
public entry fun swap_a_b_b_c<CoinTypeA, FeeTypeA, CoinTypeB, FeeTypeB, CoinTypeC>(
pool_a: &mut Pool<CoinTypeA, CoinTypeB, FeeTypeA>,
pool_b: &mut Pool<CoinTypeB, CoinTypeC, FeeTypeB>,
coins_a: vector<Coin<CoinTypeA>>,
amount: u64,
amount_threshold: u64,
sqrt_price_limit_a: u128,
sqrt_price_limit_b: u128,
is_exact_in: bool,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Two-step swap: A → B → C
swap_a_b_b_c_with_return_
public fun swap_a_b_b_c_with_return_<CoinTypeA, FeeTypeA, CoinTypeB, FeeTypeB, CoinTypeC>(
// Same parameters as above function
): (Coin<CoinTypeC>, Coin<CoinTypeA>)
Function: Two-step swap and returns result tokens
swap_a_b_c_b
public entry fun swap_a_b_c_b<CoinTypeA, FeeTypeA, CoinTypeB, FeeTypeB, CoinTypeC>(
pool_a: &mut Pool<CoinTypeA, CoinTypeB, FeeTypeA>,
pool_b: &mut Pool<CoinTypeC, CoinTypeB, FeeTypeB>,
coins_a: vector<Coin<CoinTypeA>>,
amount: u64,
amount_threshold: u64,
sqrt_price_limit_a: u128,
sqrt_price_limit_b: u128,
is_exact_in: bool,
recipient: address,
deadline: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Two-step swap: A → B → C (through different pools)
Reward Manager Module
The Reward Manager is responsible for managing liquidity mining reward systems.
Reward Initialization Functions
init_reward_v2
public entry fun init_reward_v2<CoinTypeA, CoinTypeB, FeeType, RewardCoin>(
acl_config: &AclConfig,
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
reward_index: u64,
manager: address,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Initializes pool reward system (requires reward manager role)
reset_reward_v2
public entry fun reset_reward_v2<CoinTypeA, CoinTypeB, FeeType, RewardCoin>(
acl_config: &AclConfig,
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
reward_index: u64,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Resets reward configuration
Reward Management Functions
add_reward
public entry fun add_reward<CoinTypeA, CoinTypeB, FeeType, RewardCoin>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
vault: &mut PoolRewardVault<RewardCoin>,
reward_index: u64,
coins: vector<Coin<RewardCoin>>,
amount: u64,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Adds reward tokens to reward pool
remove_reward
public entry fun remove_reward<CoinTypeA, CoinTypeB, FeeType, RewardCoin>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
vault: &mut PoolRewardVault<RewardCoin>,
reward_index: u64,
amount: u64,
recipient: address,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Removes reward tokens from reward pool
set_reward_emissions_per_second
public entry fun set_reward_emissions_per_second<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
reward_index: u64,
emissions_per_second: u128,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext
)
Function: Sets reward emission rate per second
Pool Fetcher Module
The Pool Fetcher provides pool state querying and calculation functionality.
Swap Calculation Functions
compute_swap_result
public entry fun compute_swap_result<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
a_to_b: bool,
amount_specified: u128,
amount_specified_is_input: bool,
sqrt_price_limit: u128,
clock: &Clock,
versioned: &Versioned,
ctx: &mut TxContext,
): ComputeSwapState
Function: Calculates swap result without executing actual swap
Tick Data Retrieval Functions
fetch_ticks
public entry fun fetch_ticks<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
start: vector<u32>,
start_index_is_neg: bool,
limit: u64,
versioned: &Versioned,
)
Function: Batch retrieves tick data, returns results through events
fetch_ticks_for_testing
public fun fetch_ticks_for_testing<CoinTypeA, CoinTypeB, FeeType>(
pool: &mut Pool<CoinTypeA, CoinTypeB, FeeType>,
start: vector<u32>,
start_index_is_neg: bool,
limit: u64,
versioned: &Versioned,
): (vector<TickInfo>, Option<I32>)
Function: Testing function for tick data retrieval, returns results directly
Position NFT Module
The Position NFT module manages NFTs representing liquidity positions.
NFT Information Query Functions
pool_id
public fun pool_id(nft: &TurbosPositionNFT): ID
Function: Gets pool ID corresponding to NFT
position_id
public fun position_id(nft: &TurbosPositionNFT): ID
Function: Gets position ID corresponding to NFT
Partner Module
The Partner module manages the partner system and fee sharing.
Partner Management Functions
create_partner
public entry fun create_partner(
_: &PartnerAdminCap,
partners: &mut Partners,
name: String,
ref_fee_rate: u64,
start_time: u64,
end_time: u64,
recipient: address,
clock: &Clock,
ctx: &mut TxContext
)
Function: Creates new partner
update_ref_fee_rate
public entry fun update_ref_fee_rate(
_: &PartnerAdminCap,
partner: &mut Partner,
ref_fee_rate: u64,
clock: &Clock,
versioned: &Versioned,
)
Function: Updates partner's fee sharing ratio
update_time_range
public entry fun update_time_range(
_: &PartnerAdminCap,
partner: &mut Partner,
start_time: u64,
end_time: u64,
clock: &Clock,
versioned: &Versioned,
)
Function: Updates partner's valid time range
Fee Collection Functions
claim_ref_fee
public entry fun claim_ref_fee<CoinType>(
partner_cap: &PartnerCap,
partner: &mut Partner,
amount: u64,
recipient: address,
ctx: &mut TxContext
)
Function: Claims partner fee sharing
claim_ref_fee_with_return_
public fun claim_ref_fee_with_return_<CoinType>(
partner_cap: &PartnerCap,
partner: &mut Partner,
amount: u64,
ctx: &mut TxContext
): Coin<CoinType>
Function: Claims fee sharing and returns coin object
Query Functions
get_ref_fee_rate
public fun get_ref_fee_rate(partner: &Partner): u64
Function: Gets partner's fee sharing ratio
check_partner_valid
public fun check_partner_valid(partner: &Partner, clock: &Clock): bool
Function: Checks if partner is within valid period
get_claimable_balance
public fun get_claimable_balance<CoinType>(partner: &Partner): u64
Function: Gets claimable fee balance
Usage Recommendations
Version Check: All pool operation functions check protocol version to ensure compatibility
Time Limits: Most transaction functions include
deadline
parameter to prevent malicious exploitation during network congestionSlippage Protection: Swap and liquidity operations include min/max amount parameters for slippage protection
Permission Management: Sensitive operations require appropriate admin permissions, controlled through ACL system
Event Monitoring: Important operations emit events for frontend and analytics tools to monitor
This documentation covers all public interfaces of the Turbos CLMM protocol, providing developers with a complete integration guide.
Last updated