Skip to main content

Swap & Liquidity

Swaps run on external Subfrost constant-product AMM pools (Uniswap-V2 style). The DOHM app is a client to these pools; the protocol does not control them and takes no cut of swap fees.

Availability: the swap page is off by default in production and only appears when the deploy enables it — it's held back until the external AMM integration is pinned and audited. If you don't see Swap in the app, it hasn't been enabled for that deployment.

Swap output​

Exact-input swap with the pool's per-pool fee (fee in units of 1/1000 — e.g. 10 = 1%):

in_after_fee = amount_in × (1000 − fee)
amount_out = in_after_fee × reserve_out / (reserve_in × 1000 + in_after_fee)

The fee stays in the pool's reserves and accrues to LP holders. The fee is read live from the pool — it is set per-pool, not a protocol constant.

Your transaction carries a minimum output; if the pool price moves against you past your slippage tolerance before your transaction confirms, it reverts instead of filling badly.

Adding liquidity​

You deposit both tokens at the pool's current ratio and receive LP tokens — a pro-rata claim on the pool's reserves (plus accumulated fees). Withdrawing burns LP tokens for both tokens at the then-current ratio:

amount_0_out = lp × reserve_0 / total_lp
amount_1_out = lp × reserve_1 / total_lp

Risks​

  • Impermanent loss: an LP position underperforms simply holding the two tokens when their relative price moves.
  • The pool spot price is not an oracle. The protocol itself never trusts it unguarded (bonds require a signed band; LP valuation uses the swap-invariant √k markdown) — neither should you for anything price-critical.