Inventory and LP shares

A liquidity position is a vector of twenty independent share balances. Minting uses midpoint valuation. Redemption delivers the actual asset mix in each occupied bin.

On this page

Minting against existing inventory

For bin i, denote reserves in base and quote atoms by B and Q. Let H be the share supply before the deposit and x the deposit in native atoms of the asset accepted at that index. At the bin midpoint pᵢ, ObeliskMath.depositShares values both the deposit and the inventory in quote atoms.

V = Q + ⌊B · pi / S⌋
v = x   (i < 10)
v = ⌊x · pi / S⌋   (i ≥ 10)
h = v   if H = 0
h = ⌊v · H / V⌋   otherwise

The first depositor establishes the bin’s share scale. Subsequent deposits mint against the pre-deposit reserves at the current midpoint. Each funded bin must mint at least one share atom and satisfy its own positive minShares[i]. Unfunded bins require a zero minimum. The contract stores the resulting vector under the owner and a 64-bit position nonce in this pool.

A deposit into a mixed bin

At P = 100 tUSDC/WHYPE, bin 10 is priced at 100.5. Suppose it contains 2 WHYPE and 201 tUSDC, with 402,000,000 outstanding share atoms. The reserves are worth 402,000,000 quote atoms at this midpoint. A new deposit of 1 WHYPE has value 100,500,000 quote atoms.

h = ⌊100,500,000 × 402,000,000 / 402,000,000⌋
= 100,500,000 share atoms

Post-deposit supply is 502,500,000, giving the depositor exactly one fifth of each reserve. Consequently the position already contains exposure to tUSDC even though the deposit consisted entirely of WHYPE.

A position owns the same fraction of each reserve in its binAfter a one WHYPE deposit, the new position owns 20 percent of a bin containing three WHYPE and 201 tUSDC. New position · 20% Prior LPs · 80% 3 WHYPEbase reserve 201 tUSDCquote reserve
Each bar shows ownership within one asset. An immediate withdrawal of the new shares returns 0.6 WHYPE plus 40.2 tUSDC.

Redemption and residual atoms

For each bin in the position, previewWithdraw and withdraw calculate the token quantities using the same pre-burn supply. For balances hᵢ and supplies Hᵢ, the sums below run over bins where hᵢ > 0.

baseOut = ∑ᵢ ⌊Bᵢ · hᵢ / Hᵢ⌋
quoteOut = ∑ᵢ ⌊Qᵢ · hᵢ / Hᵢ⌋

Each per-token quotient is rounded before aggregation. Fractional entitlements stay in that bin for its remaining shareholders. A sole remaining shareholder redeeming every share receives the full integer reserves. Redemption closes the complete position and requires no oracle observation.

A bin that has sold all of its WHYPE can still hold tUSDC and carry a positive position value. It has zero buy-side capacity at that moment. Further buys must find higher bins with WHYPE, while a sell can restore base inventory if the directional walk reaches this bin.