Add to Existing Position
Increase liquidity in your current positions without creating new NFTs. Add more tokens to existing bins or expand to new price ranges within the same position.
Prerequisites
Existing position NFT ID
Additional tokens to deposit
Same distribution strategy or new bins
Position must belong to the pair
Basic Usage
const pair = await sdk.Pair.getPair(pairAddress);
const positionId = "0x123...abc";
// Add more liquidity to existing position
const tx = await sdk.Pair.addLiquidity(pair, {
positionId,
amountX: 500000000n, // 0.5 token X
amountY: 1000000000n, // 1 token Y
deltaIds: [-2, -1, 0, 1, 2],
distributionX: [0, 0, 100, 0, 0],
distributionY: [0, 0, 100, 0, 0]
});
await sdk.fullClient.signAndExecuteTransaction({
transaction: tx,
signer: keypair
});
Method Parameters
interface AddLiquidityParams {
positionId: string; // Existing position NFT
amountX: bigint; // Additional token X
amountY: bigint; // Additional token Y
deltaIds: number[]; // Bins to add liquidity to
distributionX: number[]; // X distribution
distributionY: number[]; // Y distribution
}
Adding to Same Bins
// Get current position bins
const currentBins = await sdk.Position.getPositionBins(pair, positionId);
const binIds = currentBins.map(b => b.id - pair.parameters.active_id);
// Double liquidity in existing bins
await sdk.Pair.addLiquidity(pair, {
positionId,
amountX: originalAmountX,
amountY: originalAmountY,
deltaIds: binIds,
distributionX: Array(binIds.length).fill(100 / binIds.length),
distributionY: Array(binIds.length).fill(100 / binIds.length)
});
Expanding Range
// Current position: bins -5 to +5
// Expand to: bins -10 to +10
const newBins = [
...Array.from({length: 5}, (_, i) => -10 + i), // -10 to -6
...Array.from({length: 5}, (_, i) => 6 + i) // +6 to +10
];
await sdk.Pair.addLiquidity(pair, {
positionId,
amountX: expansionAmountX,
amountY: expansionAmountY,
deltaIds: newBins,
distributionX: Array(10).fill(10), // Even distribution
distributionY: Array(10).fill(10)
});
Compound Fees Strategy
// Calculate accumulated fees
const binsWithAmounts = await sdk.Position.getPositionBinsAmount(pair, positionId);
const fees = calculateAccumulatedFees(binsWithAmounts);
// Reinvest fees back into position
await sdk.Pair.addLiquidity(pair, {
positionId,
amountX: fees.x,
amountY: fees.y,
deltaIds: [0], // Add to active bin
distributionX: [100],
distributionY: [100]
});
Add to Specific Bins Only
// Add liquidity to bins that need rebalancing
const bins = await sdk.Position.getPositionBins(pair, positionId);
const activeId = pair.parameters.active_id;
// Find bins below threshold
const lowLiquidityBins = bins
.filter(b => b.liquidity < THRESHOLD)
.map(b => b.id - activeId);
if (lowLiquidityBins.length > 0) {
await sdk.Pair.addLiquidity(pair, {
positionId,
amountX: rebalanceAmount,
amountY: rebalanceAmount,
deltaIds: lowLiquidityBins,
distributionX: Array(lowLiquidityBins.length).fill(100 / lowLiquidityBins.length),
distributionY: Array(lowLiquidityBins.length).fill(100 / lowLiquidityBins.length)
});
}
What Happens
Validates position ownership
Deposits additional tokens into specified bins
Updates position's liquidity shares
Maintains existing fee accumulation
No new NFT created
Important Notes
Can add to new bins not in original position
Existing liquidity remains untouched
Fees continue accumulating normally
Gas efficient for position scaling
Common Use Cases
DCA Strategy: Regular liquidity additions
Reinvestment: Compound earned fees
Range Extension: Adapt to market moves
Concentration: Focus on profitable bins
Related Topics
Get Position Bins - Check current bins
Calculate Token Amounts - Required tokens
Remove from Specific Bins - Rebalance
Position Value - Track growth
Last updated