Deposit
The Deposit contract is a short-lived "escrow" contract used during the liquidity provisioning process. Because a CPMM pool requires two different assets (Asset X and Asset Y) to mint liquidity, and TON transactions typically carry only one asset type at a time, the Deposit contract acts as a temporary accumulator.
Once it has received the required amounts of both assets, it triggers the JoinLiquidity call to the Pool. If the process is cancelled, it facilitates the refund of collected assets.
Getters
Method get_deposit_data
Returns the current state of the deposit process, including the target pool, expected amounts, and currently collected balances.
Arguments
This getter does not accept any arguments.
Returns
| # | Name | Type | Description |
|---|---|---|---|
| 0 | poolAddress | slice (address) | Address of the Pool contract this deposit is intended for. |
| 1 | recipientDestination | slice (address) | Address that will receive the minted liquidity (or assets in case of a successful partial fill). |
| 2 | refundDestination | slice (address) | Address where assets will be returned if the deposit is cancelled or fails. |
| 3 | amountX | int (coins) | Target amount of asset X to be collected. |
| 4 | amountY | int (coins) | Target amount of asset Y to be collected. |
| 5 | lockedLiquidityShare | int (uint16) | Share of minted liquidity to be locked (in BPS). |
| 6 | minimalLiquidity | int (coins) | Slippage protection: minimum liquidity tokens expected to be minted. |
| 7 | balanceX | int (coins) | Current amount of asset X already credited to this contract. |
| 8 | balanceY | int (coins) | Current amount of asset Y already credited to this contract. |
Incoming Messages
Message CreditAsset
Internal message sent by the Pool to credit an asset payment to this deposit contract. When the balances of both assets meet or exceed the target amounts (amountX, amountY), the contract automatically sends JoinLiquidity to the pool and self-destructs.
struct (0xdc5ddba1) CreditAsset {
queryId: uint64
isX: bool
amount: coins
}| Parameter | Type | Description |
|---|---|---|
queryId | uint64 | Unique identifier for the transaction. |
isX | bool | Direction: true if asset X is being credited, false for asset Y. |
amount | coins | The amount of the asset being credited. |
Message CancelDeposit
Requests the cancellation of the deposit process. This message triggers a RefundDeposit call to the Pool, which returns all currently collected assets to the refundDestination. The contract self-destructs after sending the refund request.
struct (0x3db5f13a) CancelDeposit {
queryId: uint64
}| Parameter | Type | Description |
|---|---|---|
queryId | uint64 | Unique identifier for the transaction. |
Caller: Must be the initiator_address stored in the contract.
Other Types
Type DepositConfig
The configuration provided during the creation of the deposit, defining the parameters for liquidity minting and payouts.
struct DepositConfig {
amountX: coins
amountY: coins
minimalLiquidity: coins
lockedLiquidityShare: uint16
payoutConfig: Cell<ExtendedPayoutConfig>
}| Parameter | Type | Description |
|---|---|---|
amountX | coins | Target amount of asset X. |
amountY | coins | Target amount of asset Y. |
minimalLiquidity | coins | Minimum tokens to mint. |
lockedLiquidityShare | uint16 | Basis points of liquidity to lock in the resulting Position. |
payoutConfig | Cell<ExtendedPayoutConfig> | Payout settings defining recipients for minted liquidity and/or refunds. |