DEX Education · Resource

DEX Resources — Formulas, Checklists, and Routines

Copy these into your own notes. Each comes from a guide in this pillar where the reasoning is explained.

By CoinDock Editorial Published Last reviewed

Formula reference

Constant product AMM

invariant:     x × y = k
spot price:    price of A in B = y / x
output for Δx: Δy = y − k / (x + Δx)
average price: Δx / Δy
price impact:  (average price − spot price) / spot price

Where x and y are the pool's reserves of the two tokens.

Worked example

Pool: 1,000 ETH and 2,000,000 USDC, so k = 2,000,000,000 and spot = 2,000 USDC/ETH.

Buy with (USDC) ETH out Average price Price impact
1,000 0.4998 2,001.0 0.05%
10,000 4.9751 2,010.0 0.50%
100,000 47.619 2,100.0 5.0%
1,000,000 333.33 3,000.0 50%

Zero-fee pool, for checkable arithmetic. A real pool adds a swap fee (commonly ~0.30%) taken from the input.

The property to remember: execution impact is dx / y — your spend divided by the pool's quote reserve. It is linear in trade size, so what matters is your size relative to the pool. The pool's own spot price moves quadratically, (1 + dx/y)^2 - 1, and the tokens you forgo versus spot grow faster than linearly.

Total cost of a swap

total = swap fee + price impact + gas

Small trade, deep pool → gas dominates. Large trade, thin pool → impact dominates.

Pre-trade checklist

  • Trading from a wallet sized to this trade, not my main holdings
  • Reached the site by typing the domain, not via a link or ad
  • Token selected by contract address, not by name
  • Address obtained from a project-controlled source; chain confirmed
  • Source code verified on an explorer
  • No asymmetric or owner-mutable sell fee
  • Pool reserves checked; price impact acceptable at my size
  • Slippage tolerance at the smallest value that reliably executes
  • Holding native asset for gas
  • Exit path considered — same pool, same curve
  • Every signature read before confirming

Signature reference

Prompt What it does Gas Risk
Connect Shares address, allows prompts None Low — grants no spending power
Message Proves address ownership None Low, but read it
Approve Standing permission to move a token Yes High — persists until revoked
Permit Same authority, via signature None High — easy to sign without reading
Transaction Executes a specific action now Yes Bounded to that action

A gasless signature is not a harmless signature.

Order type decision

Situation Choice
Small trade, deep pool, want it done Market swap
Price-sensitive, not time-sensitive Limit order (signed intent)
Size large relative to pool TWAP, or reduce size
Thin pool, any size Limit order, or reconsider
Need a guaranteed fill at a price Not available on an AMM — use an order book

Risk-to-check mapping

Risk Check
Impersonator token Contract address from a project-controlled source
Honeypot Verified source; no asymmetric or mutable sell fee
Malicious approval Read every prompt; prefer finite; use a small wallet
Thin pool Pool reserves and displayed price impact
Cloned interface Type the domain yourself
MEV / sandwich Minimal slippage tolerance; split size; private relay
Rug pull Liquidity lock verified on-chain; holder concentration

Incident response

Order matters — secure funds before investigating.

  1. Move funds from a clean device to a wallet whose seed never touched the suspect machine
  2. Revoke approvals on the affected wallet
  3. Assume the seed is burned if it may have been exposed; generate a new wallet
  4. Secure surrounding accounts — email first, then exchange
  5. Capture evidence — URLs as text, addresses, transaction hashes
  6. Report to the impersonated party, the hosting platform, and your jurisdiction's authority
  7. Ignore recovery offers — anyone approaching you afterwards is running a second fraud

The two habits that do the most

  1. Trade from a wallet holding only what you are trading. Bounds every mistake.
  2. Verify identifiers, not labels. Contract addresses over token names; typed domains over links.

Neither requires correctly judging whether something is malicious — which is exactly the judgement attackers work to defeat.

Guides

Concepts

How-to

Reference

Related on DEX Education

Learn How CoinDock Works

Continue your CoinDock journey.

Go