COURSE OVERVIEW
What this course covers
Compare automated market makers and on-chain order-book venues, focusing on liquidity provision, routing, settlement, slippage and smart-contract exposure. The course approaches the subject as a set of connected systems and decisions. Students are expected to distinguish verifiable facts from assumptions, identify where a model is incomplete and explain the operational or financial risks that follow.
This school focuses on the systems and controls behind a trading venue. Learners connect market structure with software architecture, custody, liquidity, settlement, compliance and operational resilience.
Related topics
- how decentralized exchanges work
- automated market makers explained
- decentralized exchange liquidity pools
- crypto token swaps
- AMM pricing curves
- impermanent loss risks
- DEX trading mechanisms
- decentralized finance protocols
LEARNING OUTCOMES
What you should be able to explain
- Explain constant-product liquidity pools and price impact.
- Compare AMM swaps with order-book execution.
- Assess impermanent loss, MEV, oracle and contract risks.
CURRICULUM
Course syllabus and module outline
DEX architectures and transaction routing
Study the concepts, operating assumptions and failure cases behind dex architectures and transaction routing. Connect the topic to the wider decentralized exchange mechanisms framework, then record the evidence and limitations that matter in practice.
AMM curves, pool reserves and price impact
Study the concepts, operating assumptions and failure cases behind amm curves, pool reserves and price impact. Connect the topic to the wider decentralized exchange mechanisms framework, then record the evidence and limitations that matter in practice.
Liquidity providers and impermanent loss
Study the concepts, operating assumptions and failure cases behind liquidity providers and impermanent loss. Connect the topic to the wider decentralized exchange mechanisms framework, then record the evidence and limitations that matter in practice.
On-chain order books and aggregator routing
Study the concepts, operating assumptions and failure cases behind on-chain order books and aggregator routing. Connect the topic to the wider decentralized exchange mechanisms framework, then record the evidence and limitations that matter in practice.
MEV, slippage, settlement and protocol risk
Study the concepts, operating assumptions and failure cases behind mev, slippage, settlement and protocol risk. Connect the topic to the wider decentralized exchange mechanisms framework, then record the evidence and limitations that matter in practice.
LEARNING MATERIAL
Course lessons and learning activities
This is academic-draft teaching content published for curriculum review. It is not an approved or open course. Enrolment, assessment submissions and recording, completion tracking and certificates are inactive.
Estimated study time: 4 hours
MODULE 01
DEX architectures and transaction routing
Module objective: dex-architectures-transaction-routing
LESSON 1.1
DEX architectures and transaction routing — mechanisms, execution and risk
Learning objectives
Explain the main decentralized exchange (DEX) architectures, distinguish on-chain execution from off-chain coordination, and trace the route of a hypothetical token swap from wallet approval to settlement.
1. What makes an exchange decentralized
A DEX enables users to exchange digital assets through blockchain transactions and smart-contract or protocol rules rather than relying exclusively on a central operator to maintain customer accounts and execute every trade. The label does not guarantee decentralisation in every dimension. Governance, front-end hosting, order discovery, sequencers, relayers, validators, upgrade keys, oracles and liquidity sources may still be concentrated. Analyse decentralisation as a set of control points, not a marketing label.
2. Main architecture families
Automated market makers (AMMs) quote trades against pools of assets using a mathematical pricing rule. On-chain order-book venues maintain or settle orders through blockchain contracts, although some use off-chain matching or transaction ordering to reduce latency and cost. RFQ systems obtain quotes from designated market makers. Aggregators compare or split routes across multiple pools and venues. Hybrid designs combine these elements. Each architecture trades off execution certainty, latency, transparency, cost, composability and operational complexity.
3. Transaction routing
A swap route identifies the input asset, output asset, amount, candidate pools or venues, expected output, fee assumptions and execution constraints. A route may use one pool or several sequential pools. Each hop adds dependencies: pool reserves, token transfer behaviour, fees, network fees and transaction ordering. A route displayed by a user interface is a proposal, not proof that the transaction will execute at the displayed price. The contract must enforce appropriate minimum-output or maximum-input constraints.
4. Wallets, approvals and transaction lifecycle
A user typically connects a wallet, selects assets and an amount, reviews a quote, authorises a token allowance where required, and signs a transaction. The transaction is broadcast, included or rejected under network rules, executed by contracts and eventually treated as confirmed according to the chain's finality model. Token approvals can grant a contract permission to transfer tokens within a defined allowance. Unlimited approvals increase exposure if the approved contract or key is compromised; allowance scope and revocation procedures matter.
5. Trust and control boundaries
Review contract addresses, token identity, upgradeability, admin privileges, routing dependencies, oracle use, front-end integrity, wallet prompts and chain selection. A malicious or non-standard token can behave unexpectedly. A user interface can be compromised even when the underlying protocol is unchanged. Independent contract review, verified deployment addresses, monitoring and incident plans are important, but none removes all risk.
Applied case
A fictional aggregator proposes a route from Token A to Token C through two pools. The user interface shows an estimated output, but one pool has shallow reserves and the token charges a transfer fee. Map the route, identify the data and contract assumptions, and explain which execution constraints and warnings should be checked before a simulated transaction is signed.
Key takeaways
• DEX architecture includes AMMs, order books, RFQ venues, aggregators and hybrid designs.
• Decentralisation must be assessed across governance, execution, infrastructure and control.
• Multi-hop routes add fees, dependencies and execution uncertainty.
• Wallet approval and transaction signing are separate security decisions.
• A displayed quote is an estimate; on-chain execution constraints determine acceptable outcomes.
Exercise
Draw a DEX transaction architecture showing wallet, interface, router, pools, token contracts and blockchain. Mark which components are on-chain, which may be off-chain, who can change them, and where a user should verify addresses, allowances, price limits and transaction status.
MODULE 02
AMM curves, pool reserves and price impact
Module objective: amm-curves-pool-reserves-price-impact
LESSON 2.1
AMM curves, pool reserves and price impact — mechanisms, execution and risk
Learning objectives
Explain the constant-product invariant, calculate a simplified swap output from fictional reserves, and distinguish spot price, execution price, price impact and slippage.
1. Pool reserves and the invariant
A constant-product AMM commonly represents a two-asset pool with reserves x and y and an invariant x × y = k, before considering fees and other design details. The marginal reserve ratio helps determine the pool's instantaneous price. When a trader adds asset X and removes asset Y, the reserve balances change while the product is constrained by the pool's rule. The pool is not an unlimited counterparty: trade size changes the price available to the next trader.
2. Simplified swap calculation
Suppose a fictional pool contains 100 units of X and 10,000 units of Y. Ignoring fees, the initial reserve-ratio price is 100 Y per X. A swap that adds 10 X changes the X reserve to 110. To preserve the invariant of 1,000,000, the Y reserve becomes approximately 9,090.91. The pool therefore releases about 909.09 Y. The average execution is about 90.91 Y per X, below the initial marginal price. This difference illustrates price impact. Real protocols include fee calculations, integer arithmetic, token transfer behaviour and exact contract rules.
3. Fees and execution price
A swap fee may be retained by the pool, distributed to liquidity providers, directed elsewhere or split according to protocol design. Fees mean the amount entering the pricing curve may differ from the amount credited to reserves. Always use the protocol's documented formula rather than applying a generic formula to every AMM. Execution price is the actual output divided by input after relevant fees. It should be compared with a clearly defined reference price and should include route and network costs when evaluating the user's total cost.
4. Price impact versus slippage
Price impact is the effect the trade itself has on the pool price under the quoted pool state. Slippage is the difference between an expected execution and the realised execution; it can arise because reserves change, transactions are reordered, network conditions shift or the quote becomes stale. A minimum-output limit protects a swap from executing below a user-defined threshold, but a limit that is too loose can expose the user to poor execution. A limit that is too tight can cause a transaction to revert and still incur network fees.
5. Pool composition and market price
The pool ratio is not a universal fair value. Arbitrageurs may trade against a pool when its price differs from other venues, changing reserves and bringing prices closer together, subject to costs and risks. A pool can become imbalanced, shallow or disconnected from broader markets. The displayed ratio should not be treated as a guaranteed price for a large order.
Applied case
Use the fictional pool above. Calculate the approximate output for a 10 X input with no fee, the average execution price and the percentage difference from the initial 100 Y per X reference. Then explain why a real quote may differ after fees, token transfer rules, route selection and intervening trades.
Key takeaways
• Constant-product pools use reserve balances and a pricing invariant.
• Larger trades relative to pool depth generally create greater price impact.
• Fees and token mechanics alter the simplified calculation.
• Price impact is not the same as slippage.
• A pool ratio is a venue-specific price signal, not a guarantee of fair value.
Exercise
Create a spreadsheet or hand calculation for three fictional trade sizes against one pool. Record initial reserves, invariant, output, average execution price and price impact. Add a separate section listing fee, rounding, token and network assumptions that would need to be confirmed against a real protocol specification.
MODULE 03
Liquidity providers and impermanent loss
Module objective: liquidity-providers-impermanent-loss
LESSON 3.1
Liquidity providers and impermanent loss — mechanisms, execution and risk
Learning objectives
Describe how liquidity providers supply assets to an AMM, compare a pool position with holding the same assets outside the pool, and identify the risks that fee income may not offset.
1. What liquidity providers do
A liquidity provider (LP) deposits assets into a pool so that traders can swap against available reserves. In return, the LP may receive a proportional claim on pool assets and a share of eligible trading fees or incentives. The exact claim may be represented by pool tokens, accounting records or another protocol-specific mechanism. Depositing assets does not create a fixed return. The value and composition of the position change as traders interact with the pool and as external market prices move.
2. Inventory exposure and rebalancing
In a two-asset constant-product pool, arbitrage and trading activity tend to change reserve proportions when the relative market price changes. If one asset appreciates against the other, the pool typically ends up holding less of the appreciating asset and more of the depreciating asset compared with a simple hold position. This is an inventory effect, not a fee or an account error. Concentrated-liquidity designs add range selection and out-of-range exposure; they should not be analysed as if every LP position had uniform exposure across all prices.
3. Impermanent loss
Impermanent loss compares the value of an LP position with the value of holding the deposited assets outside the pool over the same period, using the same external valuation point. It is often called divergence loss. The comparison depends on the price ratio change and pool design. It is not necessarily a realised cash loss at the moment it is measured, but withdrawing or rebalancing can crystallise the economic difference. The term does not mean the position will recover automatically.
4. Fees, incentives and net outcomes
Trading fees and incentives may offset some or all of the divergence loss, but this is not guaranteed. Fee income depends on actual volume, fee tiers, pool share, protocol distribution rules and competition from other pools. Incentives may be temporary or denominated in volatile assets. A meaningful analysis estimates gross fees, protocol deductions, gas, rebalancing costs, token risk, opportunity cost and the value of the position under multiple price scenarios. Avoid presenting historical yields as guaranteed forecasts.
5. LP-specific risks
LPs face smart-contract vulnerabilities, oracle or pricing failures, malicious token behaviour, governance changes, chain congestion, bridge exposure, concentration risk and sudden liquidity exits. Concentrated liquidity can stop earning swap fees when the market price moves outside the selected range while leaving the LP with a one-sided inventory. Pool TVL and advertised APR are incomplete measures of risk and should be read with volume, depth, concentration, fee generation and contract controls.
Applied case
A fictional LP deposits equal values of Token X and Token Y. Over a month, X doubles in external price while pool fees accrue. Compare the pool position with holding the original quantities, identify the information needed to calculate divergence loss and explain why fee income alone is insufficient to declare the LP profitable.
Key takeaways
• LPs provide inventory that enables swaps and bear changing asset exposure.
• Impermanent loss compares pool value with holding the original assets.
• Fees and incentives can offset divergence loss but do not guarantee a positive net return.
• Concentrated liquidity introduces range and inventory-management risks.
• Smart-contract, token, governance and network risks remain material.
Exercise
Prepare a fictional LP risk worksheet with initial deposits, external price scenarios, estimated pool composition, fee assumptions, gas and withdrawal costs. Compare pool value with hold value at each scenario and clearly label assumptions, exclusions and uncertainty. Do not use the worksheet as an investment recommendation.
MODULE 04
On-chain order books and aggregator routing
Module objective: on-chain-order-books-aggregator-routing
LESSON 4.1
On-chain order books and aggregator routing — mechanisms, execution and risk
Learning objectives
Compare on-chain order books with AMMs, explain order matching and settlement constraints, and assess how an aggregator evaluates routes across venues.
1. On-chain order-book model
An order book represents bids to buy and offers to sell at specified prices and quantities. A matching process applies rules such as price-time priority or another published priority model. In a fully on-chain design, order placement, cancellation or matching may be recorded through smart contracts. Other designs keep some order discovery or matching off-chain and settle trades on-chain. These models differ in latency, transaction cost, transparency, censorship resistance and exposure to transaction ordering.
2. AMM versus order book
An AMM provides a continuous pricing function based on pool reserves or another mechanism. An order book displays discrete orders and available depth at price levels. AMMs can provide always-available quotes while reserves remain, but trade size moves the price along the curve. Order books expose visible limit liquidity, but displayed orders can be cancelled, partially filled or unavailable by execution time. Neither design guarantees deep liquidity or a better price in every market condition.
3. Aggregator route selection
An aggregator may query several pools and venues, estimate output, account for fees and network costs, and choose a route or split an order across multiple venues. A route may be multi-hop or split into parallel portions. Optimisation is only as good as its data, gas assumptions, token handling and execution model. A route with the highest gross output may be inferior after gas, protocol fees, transfer taxes, bridge costs or failure probability.
4. Atomicity and partial execution
Smart-contract routing can make several swaps execute atomically: if a required leg fails, the transaction may revert rather than leave a partial route. But atomicity depends on the contract design and does not erase costs, network fees or external side effects. Off-chain systems may have different partial-fill and recovery semantics. Review the actual contract's failure handling, deadlines, minimum outputs and token transfer assumptions.
5. Fair comparison
A fair venue comparison uses the same input size, asset pair, timestamp, network, fee assumptions and finality expectations. Include expected output, gas, price impact, spread, route complexity, execution probability, settlement certainty and smart-contract dependencies. Record whether the quote is firm or indicative. Do not compare a best-case AMM quote with an order-book mid-price and call the result an executable saving.
Applied case
A fictional aggregator compares one AMM pool, a second AMM pool and an on-chain order book. It proposes splitting a swap across two venues. Build a comparison using identical input size and assumptions; identify the extra contracts and failure points introduced by splitting the route.
Key takeaways
• Order books organise discrete bids and asks; AMMs price trades using pool rules.
• Some DEX order-book systems use on-chain settlement with off-chain coordination.
• Aggregators optimise across routes but depend on accurate data and assumptions.
• Multi-leg routes add dependencies even when execution is atomic.
• Compare executable net outcomes on a like-for-like basis.
Exercise
Create a venue-selection matrix for a fictional token pair. Compare an AMM, an on-chain order book and an aggregator route across depth, quoted output, fees, gas, price impact, failure modes, contract dependencies and settlement. State which facts would need independent verification before a real user interface could display the comparison.
MODULE 05
MEV, slippage, settlement and protocol risk
Module objective: mev-slippage-settlement-protocol-risk
LESSON 5.1
MEV, slippage, settlement and protocol risk — mechanisms, execution and risk
Learning objectives
Explain maximal extractable value (MEV) at a conceptual level, identify common transaction-ordering and slippage risks, and assess settlement and protocol dependencies in a DEX swap.
1. Transaction ordering and MEV
Transactions compete for inclusion and ordering in block production. Maximal extractable value describes value that block builders, validators or other actors may obtain by including, excluding or ordering transactions within protocol rules or through exploitative behaviour. Examples discussed in DEX contexts include sandwich attacks, where an actor places transactions around a victim's swap to influence execution. The exact mechanism and feasibility vary by chain, mempool design and transaction path.
2. Slippage and execution protections
A swap commonly specifies a minimum acceptable output or maximum acceptable input and may include a deadline. These constraints can cause a transaction to revert if market conditions move beyond the user's tolerance. A very wide tolerance may permit poor execution; a very narrow tolerance can increase failure and repeated submission costs. Users should understand the quote timestamp, route, fee, network conditions and the contract's actual enforcement logic. Interface defaults should not silently encourage excessive tolerance.
3. Settlement and finality
A submitted transaction is not the same as a confirmed transaction. It may remain pending, be replaced, fail, revert or be included in a block that is later reorganised, depending on network rules. Settlement analysis should identify the relevant chain, confirmation or finality policy, token transfer result and any off-chain obligations. Cross-chain swaps add bridge, relayer and destination-chain dependencies. A user interface should communicate transaction state accurately and avoid describing a pending transaction as completed.
4. Protocol and token risks
Risks include smart-contract bugs, compromised upgrade keys, flawed oracle dependencies, governance attacks, malicious tokens, fee-on-transfer or rebasing behaviour, liquidity withdrawal, bridge failure, chain congestion and interface compromise. Audits and formal verification can improve assurance but do not prove that a protocol is risk-free. Review scope, deployment version, audit findings, unresolved issues, admin privileges, timelocks, emergency controls and incident disclosures.
5. Risk review and incident response
A DEX risk review should map assets, contracts, privileged roles, external dependencies, user approvals, oracle sources, route paths and settlement assumptions. Define monitoring for unusual pool changes, failed swaps, oracle divergence, liquidity concentration, contract upgrades and chain incidents. Incident plans should identify who can pause or communicate, how evidence is preserved, what user actions are recommended and which decisions require governance or legal authority. Never promise that an on-chain transaction can be reversed.
Applied case
A fictional user submits a swap with a permissive minimum-output setting during a volatile market. The transaction is delayed and executes after pool reserves change. Explain the possible MEV and slippage exposure, what evidence should be preserved and how the user interface could have communicated the risk more clearly.
Key takeaways
• Transaction ordering can affect execution and create MEV opportunities.
• Minimum-output and deadline controls constrain execution but do not eliminate risk.
• Pending, confirmed and finalised are distinct transaction states.
• Smart-contract audits do not guarantee safety.
• Protocol risk reviews must include governance, token, oracle, bridge, interface and network dependencies.
Exercise
Prepare a one-page DEX protocol risk register with at least eight risks. For each, record the affected component, cause, user impact, preventive control, detection method, owner and incident response. Include one transaction-ordering scenario and one settlement/finality scenario.
LEARNER ASSESSMENT
Decentralized Exchange Mechanisms — Final Knowledge Assessment
Total: 100 marks. Pass threshold: proposed 70%, subject to academic approval. These questions are displayed for review only; learners cannot submit or record an assessment result on this page.
Multiple-choice knowledge assessment (100 marks)
Select one answer for each question. All examples are fictional and educational; this assessment does not authorise live trading, liquidity provision, wallet approvals or financial transactions.
Question 1: Which feature most directly characterises a constant-product AMM?
- A pool prices swaps using a reserve-based invariant
- A central broker guarantees every quote
- A bank sets a fixed daily exchange rate
- A validator manually approves each trade
Question 2: A trader submits a large swap relative to pool depth. What is the expected effect?
- The pool price cannot change
- Price impact is likely to be larger
- The transaction becomes risk-free
- Network fees are automatically waived
Question 3: What does impermanent loss compare?
- Two different blockchain networks
- A pool position's value with holding the deposited assets
- A token's market cap with its supply
- A validator's reward with gas fees
Question 4: What is a key role of a DEX aggregator?
- Guarantee a profitable trade
- Compare or combine routes across liquidity venues
- Remove all smart-contract dependencies
- Reverse confirmed blockchain transactions
Question 5: How does a limit order book differ from a typical AMM?
- It displays discrete bids and asks at price levels
- It always provides unlimited liquidity
- It has no execution rules
- It cannot use blockchain settlement
Question 6: What is slippage in swap execution?
- The difference between expected and realised execution
- The total number of tokens in a pool
- A protocol governance vote
- A cryptographic hash mismatch
Question 7: What does a minimum-output parameter do?
- Guarantees a market price
- Rejects execution if output falls below a specified threshold
- Eliminates network fees
- Prevents every form of MEV
Question 8: Which statement about MEV is most accurate?
- It is impossible on public blockchains
- It can arise from transaction inclusion or ordering choices
- It is identical to impermanent loss
- It only affects centralised exchanges
Question 9: Why is a pending transaction not necessarily settled?
- It may fail, be replaced or await confirmation/finality
- All pending transactions are irreversible
- A wallet interface determines finality
- A displayed hash proves successful execution
Question 10: Which is the strongest DEX risk-review approach?
- Rely only on the protocol's marketing page
- Check contracts, privileges, dependencies, liquidity, tokens and incident controls
- Assume an audit removes all risk
- Ignore bridge and oracle dependencies
COURSE COMPLETION
Learning completion requirements
- Review all five modules and their lessons.
- Complete the applied exercises using fictional or synthetic information.
- Review the final knowledge assessment; submissions and results are inactive.
- Complete academic review before this material is approved for enrolment.
Completion tracking and certificates are not active until the Academy learning platform is implemented and approved.
GLOSSARY
Key terminology
APPLIED LEARNING
Practical case exercise
Use a hypothetical constant-product pool to calculate how a swap changes reserves and price; explain why quoted output can differ from execution.
The exercise is educational and uses hypothetical or historical information. It does not connect to a live brokerage, exchange, customer wallet or payment account.
ASSESSMENT DESIGN
How learning will be assessed
Knowledge checks, applied case analysis and a final assessment aligned to the published learning outcomes. Assessment formats and pass requirements will be confirmed in the live course syllabus.
When the assessment system is released, the approved Academy policy will allow up to three attempts per final examination. The proposed pass threshold is 70%, subject to the published syllabus and academic controls. Results are intended to be marked automatically where answers have objectively verifiable keys; assignments requiring judgement may require instructor review.
ENTRY GUIDANCE
Who this course is for
This intermediate-level course is intended for learners who want a structured understanding of decentralized exchange mechanisms. It may be useful to students, analysts, fintech builders, operations teams and professionals who need to understand the subject's terminology and control environment.
Suggested preparation: Learners should be comfortable with the relevant foundation concepts and basic numerical reasoning.
FURTHER READING
Primary and institutional references
Use original standards, technical documentation and institutional publications when checking details. Regulatory requirements vary by jurisdiction and may change.
COURSE QUESTIONS
Frequently asked questions
What is a decentralized exchange?
A decentralized exchange is a protocol or application that enables users to swap digital assets through smart contracts or other on-chain mechanisms rather than relying on a conventional central order-matching operator.
How do automated market makers set swap prices?
Automated market makers use pool balances and a pricing rule, often expressed as a mathematical invariant, to quote trades. Fees, pool composition, trade size and external market prices affect the resulting execution price.
What is impermanent loss in a liquidity pool?
Impermanent loss describes how a liquidity provider's pool position can underperform simply holding the deposited assets when their relative market prices change. Fees and other incentives may offset or fail to offset that difference.
Are decentralized exchanges risk-free because they use smart contracts?
No. Smart-contract defects, oracle failures, liquidity shortages, malicious tokens, governance decisions, wallet compromise and network congestion can create material risks.
Is this course currently open for enrolment?
This page contains academic-draft learning material for review, but the course is not approved or open for enrolment. Assessment questions are displayed for review only; submissions, assessment recording, completion tracking and certificates are inactive. Check the live education catalogue for courses explicitly published as available.
Does this course provide trading signals or promise profits?
No. It is an educational curriculum. It does not provide guaranteed outcomes, trading signals or personal investment recommendations.
Will I receive a NexaCrypto Academy certificate?
The approved Academy model distinguishes a Certificate of Completion from an examination-based Professional Certificate. Automated issuance will operate only after the learning, assessment and certificate systems are implemented and the learner meets the published eligibility rules.