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.
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.
- Move funds from a clean device to a wallet whose seed never touched the suspect machine
- Revoke approvals on the affected wallet
- Assume the seed is burned if it may have been exposed; generate a new wallet
- Secure surrounding accounts — email first, then exchange
- Capture evidence — URLs as text, addresses, transaction hashes
- Report to the impersonated party, the hosting platform, and your jurisdiction's authority
- Ignore recovery offers — anyone approaching you afterwards is running a second fraud
The two habits that do the most
- Trade from a wallet holding only what you are trading. Bounds every mistake.
- 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
- What Is a Decentralized Exchange
- DEX vs Centralized Exchange
- Wallet-Based Trading Explained
- Trading With USDT
- How Decentralized Exchanges Work
How-to
- How to Use a DEX Safely
- How to Connect a Crypto Wallet
- How to Place a DEX Order
- How to Swap Tokens on a DEX
- How to Spot Common DEX Risks
Reference
Related on DEX Education
-
How to Use a DEX Safely
A routine that limits what any single mistake can cost, rather than relying on you spotting every threat.
-
How Decentralized Exchanges Work
Most explanations stop at 'smart contracts handle it'. This one shows the formula that sets your price and walks the ari...
-
DEX Glossary
Definitions of the terminology used across CoinDock's DEX guides.
-
Learn How CoinDock Works
What CoinDock is, what it is not, and the situations where a DEX genuinely suits you better.
-
Liquidity Resources
The formulas and templates from CoinDock's liquidity guides, in one place.
Learn How CoinDock Works
Continue your CoinDock journey.
Go