Skip to main content

Dynamic Weights

Dynamic weights let pool scale adapt as trades happen.

A reserve asset has:

reserve a
scale s
target scale st
stableness n
fee

The scale-to-reserve ratio gives the asset price in scale terms:

P = s / a

A trade changes reserves and may change scale. The quote engine computes value flow and scale change for each leg.

Target-relative curvature

The quote engine computes a target-relative trade size:

rt = ((targetWeight - tokenWeight) / (1 - targetWeight)) / tokenWeight

Then the dynamic branch uses:

kappa = abs((r - rt) / (1 + rt))^n
sigma = r / (1 + kappa * r)

where:

r = da / a
n = stableness

The parameter n controls how quickly curvature emerges.

Linear branch

When a trade moves an asset toward target, the quote engine uses the linear branch:

valueFlow = amount * scale / reserve
valueChange = valueFlow

This branch supports target-restoring execution.

Dynamic branch

When a trade moves beyond the target-restoring direction, the quote engine uses the dynamic branch:

valueFlow = scale * sigma
valueChange = (1 - kappa) * valueFlow

This branch creates price impact according to target distance, trade size, and stableness.

Practical interpretation

Near target with high stableness, curvature grows slowly. Larger reserve-relative trades can remain close to linear execution. Farther from target, curvature grows and price impact increases.