Skip to content

Kadia DEX: bring liquidity

If you hold an LP position in another Ergo pool that uses the common constant-product pool format, the Bring page moves it into the Kadia pool for the same pair. Nothing moves until you sign. The page first shows what you hold, and what it’s worth now.

  1. Redeem. You sign one transaction that asks your current pool to pay out your share. That pool’s own filler pays it to your wallet, usually within a block, for a small fee to the filler and the miner, shown on the review before you sign. On Kadia’s testnet site today, that’s a 0.006 ERG filler’s fee (of which up to 0.002 ERG may go to the miner), plus a 0.001 ERG miner fee.
    • If it isn’t filled after 10 blocks, you can cancel it, and your LP comes back.
    • The payout is the pool’s exact share at the block the redeem is filled in, so it can differ a little from what the page showed.
    • On testnet, no fill is promised: no filler runs there for those pools yet, so a redeem waits until you cancel it.
  2. Move. With what actually arrived, you sign a deposit into the Kadia pool. Kadia’s next batch adds it. Whatever the Kadia pool’s price can’t use comes back to your wallet.
  3. Result. Your Kadia LP, and anything left over. Each step’s fees are on its own review, and the move’s progress shows under “Moves in progress”.

If Kadia has no pool for the pair yet, you can create one with the redeemed amounts, so it opens at the same price.

Where a Kadia pool for the pair takes deposits, one transaction can do both steps:

  • it spends your current pool’s box directly, and redeems your LP at exactly your share;
  • it places the Kadia deposit with what that pays, all at once.

If that pool’s box moves before your transaction lands, the node rejects it and nothing happens. Try again from the page. The page won’t build it at all:

  • if the pool was used in the last 30 blocks: another transaction would likely beat yours to it. Use the two steps, or try again later;
  • if Kadia has no pool for the pair that takes deposits: create one, or use the two steps.

It’s experimental, and on testnet only: turn it on for your session by opening #/bring?try=direct.

Every transaction is checked against the chain before its review opens. If a check fails, there’s nothing to sign.

The two steps:

Step You sign Checked first
Redeem Your LP into a redeem order on your current pool, plus ERG for its fees Every output is worked out again from the chain
Cancel Your redeem order, back to you The order is yours, and comes back whole
Move A Kadia LP deposit order with what arrived The deposit is exactly what you asked for

The one-signature move:

You sign Checked first
One signature Your current pool’s box, your LP and ERG for the fees, giving that pool’s next box, the Kadia deposit order and your change Every amount in and out of the whole transaction, and the Kadia order
Technical details

The checks are, in order: verifySourceRedeem, verifySourceCancel and dex-sdk’s verifyBuild for the two steps; verifyDirectMove with dex-sdk’s checkLpDepositOrderOutput for the one-signature move. They’re in kadia-web’s packages/data/src/migrate/.

All four steps work from a phone wallet as well as a browser wallet: the redeem, the cancel, the move, and the one-signature move.

  • On a computer, the page shows a QR code to scan with your phone wallet. On the phone, tap “Open in your wallet”.
  • The redeem, the cancel and the one-signature move show in your phone wallet as “Built by this page, not checked by Kadia”. The page builds and checks each one exactly as it does for a browser wallet, and Kadia’s server then prepares the phone’s request without checking it again. Compare the amounts in your wallet with the page’s review before you sign.
  • The move (step 2) is the DEX’s usual ErgoPay deposit.
  • For the one-signature move, the page reads the pool again just before the request. If the pool is spent while your phone signs, the page says “The pool changed while you were signing; review again.” and offers “Build a fresh request”.
  • A wallet: a browser wallet (EIP-12, such as Nautilus), or a phone wallet through ErgoPay.
  • Unlock first. LP that’s staked or time-locked has to be released where it is before it can move.
  • ERG for the fees. The redeem’s fees come from your wallet, along with the LP.
  • Your progress is kept in this browser only. If it forgets a move, nothing is lost: the redeemed assets are in your wallet, and a Kadia deposit shows in My orders.
Technical details

Sources: kadia-web apps/dex/src/routes/Bring.svelte (the Bring page, with ErgoPay since #395, 090e80f), packages/data/src/migrate/ (the plan, the source redeem and the one-signature move) and docs/ui-safety-checklist.md. Checked by kadia-web-dex.