DeDust Hub
Quickstart

Liquidity Provisioning

Liquidity provisioning involves adding asset pairs (X and Y) to a pool to facilitate trading. In return, liquidity providers (LPs) receive Liquidity Tokens representing their share of the pool and earn trading fees.

Depositing Liquidity

Depositing into a CPMM V2 pool is a two-step process because standard TON transactions usually carry only one type of asset. To handle this, the protocol uses a temporary Deposit contract.

The Deposit Flow

  1. Step 1: Send Asset X. The user sends the first asset (e.g., TON) to the Pool with a Deposit payload. The Pool deploys a temporary Deposit contract and credits the asset to it.
  2. Step 2: Send Asset Y. The user sends the second asset (e.g., Jetton) to the Pool (not the Deposit contract directly). The Pool forwards this credit to the existing Deposit contract.
  3. Completion: Once the Deposit contract holds the required amounts of both X and Y, it automatically triggers a JoinLiquidity message to the Pool.
  4. Minting: The Pool calculates the liquidity tokens to mint, updates reserves, and sends the liquidity tokens to the user's Position contract.
PayNative (TON + DepositPayload) Deploy & Credit TON TransferNotification (Jetton + DepositPayload) Credit Jetton JoinLiquidity Emit DepositEvent CreditLiquidity (Mint LP Tokens) Notification Step 2: Send Asset Y Target amounts reached User Pool Deposit Position

Deposit Payload

Both payments (Step 1 and Step 2) must include a DepositPayload.

struct (0xc9a015da) DepositPayload {
    amountX: coins
    amountY: coins
    minimalLiquidity: coins
    lockedLiquidityShare: uint16
}
ParameterDescription
amountXThe expected total amount of Asset X to be deposited.
amountYThe expected total amount of Asset Y to be deposited.
minimalLiquiditySlippage Protection. The minimum amount of LP tokens to mint. If the actual minted amount is lower (due to reserve changes between steps), the transaction fails and assets are refunded.
lockedLiquidityShareA portion (in BPS, 0-10000) of the minted liquidity to permanently lock. Useful for initial liquidity offerings or protocol-owned liquidity.

When depositing TON, use the PayNative message with DepositPayload. When depositing Jettons, use Transfer with forward_payload containing PayJettonDepositPayload.

Withdrawing Liquidity

Withdrawing removes liquidity from the pool and returns the proportional share of Asset X and Asset Y to the user. This creates a Withdraw message sent to the Pool, which forwards it to the user's Position.

Withdraw Flow

Withdraw Message WithdrawLiquidity ExitLiquidity Emit WithdrawalEvent Transfer Asset X + Asset Y 1. Burn LP Tokens 2. Calculate Fees & Rewards User Pool Position

Withdraw Message

struct (0x20b5ef89) Withdraw {
    queryId: uint64
    liquidity: coins
    minimalXOut: coins
    minimalYOut: coins
    autoClaimFees: bool
    payoutConfig: Cell<BasicPayoutConfig>
}
ParameterDescription
liquidityThe amount of LP tokens to burn.
minimalXOutMinimum amount of Asset X to receive (slippage protection).
minimalYOutMinimum amount of Asset Y to receive (slippage protection).
autoClaimFeesIf true, the operation will also claim any accrued trading fees attached to this position.
payoutConfigDefines where to send the withdrawn assets (X and Y).

Claiming Fees

Liquidity providers earn trading fees. These fees accumulate in the Position contract and are not automatically auto-compounded into the pool reserves. Users must explicitly claim them or use autoClaimFees during withdrawal.

Claim Flow

To claim fees without withdrawing liquidity, send a ClaimPositionFees message to the Pool.

ClaimPositionFees ClaimAvailableFees PayoutPositionFees Transfer Fees (Asset X + Asset Y) User Pool Position

Message Structure

struct (0x5652f1df) ClaimPositionFees {
    queryId: uint64
    excessesTo: address
}

On this page