Workspace / Research tools
Liquidity pools

Weighted AMM Exact-Input Swap Model

Weighted pools use token weights as well as reserves when determining a swap quote. An 80/20 pool therefore cannot be priced by copying a 50/50 constant-product formula without adjustment. This model calculates exact-input output, input fees and fee-inclusive execution premium, then repeats the calculation across trade sizes to make nonlinear reserve sensitivity visible before any real routing or execution is considered.

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

Formula and accounting assumptions

For input reserve A, output reserve B and normalized weights wA and wB, output is B × [1 − (A ÷ (A + effective input))^(wA ÷ wB)]. Effective input deducts the input fee. The initial marginal output rate is B × wA ÷ (A × wB). Comparing the full input paid per output received with that marginal rate measures both the fee and movement along the weighted curve.

Worked hypothetical example

With 100 units in each reserve, a 50/50 weight and no fee, an input of ten produces approximately 9.090909 output units. Changing only the weight to 80/20 changes the exponent to four and the initial marginal rate to four output units per input. Output then equals 100 × [1 − (100 ÷ 110)^4], approximately 31.69865 units. The reserves alone are therefore insufficient to compare pool prices when the normalized weights differ.

Interpret the scenarios and limits

This is a two-token constant-weight mathematical pool. It does not reproduce deployment-specific swap limits, token scaling, dynamic weights, transfer taxes or smart-contract rounding. The fee is retained in the input reserve. Very extreme inputs that exhaust representable output-reserve precision are rejected. Use consistent human token units and verify the actual protocol configuration separately; the result is neither a wallet quote nor confirmation that a proposed size can be executed in a deployed pool.

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