Workspace / Research tools
Liquidity pools

Single-Sided Constant-Product LP Zap Split

Adding only one asset to a two-token pool usually requires swapping part of the deposit first. A naive half-and-half split can leave unused tokens because the swap itself changes the reserve ratio. This model solves for a split that balances both deposit legs after its own constant-product swap, then compares alternative split sizes and their leftover quantities without submitting a zap transaction.

Enable JavaScript to edit assumptions, calculate and compare a baseline locally. The formula and methodology below remain available without JavaScript.

Formula and accounting assumptions

Let g equal one minus the input swap fee, R be the initial input reserve and D the one-sided deposit. The balanced split solves g × swap^2 + (1 + g) × R × swap − D × R = 0. Its positive root determines the amount to swap. The model then computes acquired B, updated reserves and the smaller proportional deposit ratio available from the remaining A and acquired B. Pool ownership follows that proportional addition.

Worked hypothetical example

With 100 A and 100 B in a fee-free pool and a one-sided budget of 21 A, the balanced swap is ten A. It acquires approximately 9.090909 B and leaves eleven A for deposit. After the swap, reserves are 110 A and approximately 90.909091 B. Both deposit legs are exactly one tenth of those reserves, so the resulting ownership is 1 ÷ 11, approximately 9.090909%, with no modeled leftovers on either side.

Interpret the scenarios and limits

This is a full-range constant-product pool with input fees retained in the reserve. It does not apply directly to concentrated-liquidity positions or weighted pools. Minimum locked liquidity, protocol fee minting, integer rounding, transfer taxes, gas and intervening trades are omitted. Alternative split rows show whether unused inventory is A or B; maximizing a displayed token quantity is not the objective. The optimizer balances the modeled deposit ratio and does not predict fee income, profitability or the actual liquidity tokens minted by a contract.

Primary documentation

Your research workspace

Save selected inputs and research notes explicitly in this browser. Compare assumptions and restore a saved setup without submitting a trade. JavaScript enables the controls.

Find a tool or research page