Web3 & DApp Development Fundamentals · 강의

자동화된 마켓 메이커

상수 곱 공식

레슨 2/413개 단계

자동화된 마켓 메이커은(는) CoddyKit의 무료 Web3 & DApp Development Fundamentals 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Web3 & DApp Development Fundamentals 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Web3 & DApp Development Fundamentals 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

What Is an AMM?

An Automated Market Maker (AMM) is a smart contract that prices and executes trades using a mathematical formula instead of an order book.

Instead of matching a buyer with a seller, traders swap against a shared pool of tokens.

Order Books vs AMMs

Traditional exchanges match individual buy and sell orders. AMMs replace that with a liquidity pool and a pricing curve.

  • Order book: needs active market makers
  • AMM: always available, prices set by formula

The Liquidity Pool

An AMM pool holds a reserve of two tokens, for example ETH and USDC. Traders add one token and remove the other.

The pool's reserves determine the price — the contract never needs a counterparty.

Pool reserves:
    x = 100 ETH
    y = 200000 USDC

The Constant Product Formula

The most famous AMM (Uniswap v2) uses the constant product formula:

x * y = k

The product of the two reserves must stay equal to a constant k after every trade (ignoring fees).

x * y = k
100 ETH * 200000 USDC = 20,000,000 = k

How a Swap Moves Reserves

To buy ETH, a trader adds USDC. The USDC reserve grows and the ETH reserve shrinks, but the product must remain k.

Before: 100 ETH * 200000 USDC = 20,000,000
Trader adds 10000 USDC -> y = 210000
New x = k / y = 20,000,000 / 210000
      = 95.238 ETH
Trader receives 100 - 95.238 = 4.76 ETH

Price From the Curve

The instantaneous price is the ratio of reserves: price = y / x.

As one reserve shrinks, that token becomes more expensive. The curve makes large trades cost progressively more per unit.

price of ETH in USDC = y / x
= 200000 / 100 = 2000 USDC per ETH

Slippage

Slippage is the difference between the expected price and the price you actually get. Big trades move along the curve and suffer more slippage.

Deeper pools (larger reserves) reduce slippage because each trade shifts the ratio less.

Trading Fees

Each swap charges a fee (often 0.30%) that is added to the pool. This grows k slightly over time.

Fees are the reward that compensates liquidity providers for supplying capital.

amountIn after fee = amountIn * 0.997
// 0.30% fee stays in the pool

Arbitrage Keeps Prices Honest

If the AMM price drifts from the wider market, arbitrageurs trade against the pool until it matches.

This self-correcting pressure keeps AMM prices aligned with external markets without any oracle.

Other AMM Curves

Constant product is not the only design:

  • Curve uses a stableswap formula for assets that should trade near 1:1
  • Uniswap v3 adds concentrated liquidity within chosen price ranges

Each curve optimizes for a different asset type.

Putting It Together

AMMs price trades with a formula like x * y = k against a shared pool. Reserves set the price, large trades cause slippage, fees reward providers, and arbitrage keeps prices accurate.

Next we look at the liquidity pools themselves.

Quick Check

Test your AMM math intuition.

Recap: Automated Market Makers

You learned that:

  • AMMs replace order books with a formula + pool
  • The constant product rule is x * y = k
  • Price is the reserve ratio; big trades cause slippage
  • Fees reward providers; arbitrage keeps prices honest

Next: providing liquidity to these pools.

무료로 시작

AI 튜터와 함께 Web3 & DApp Development Fundamentals을(를) 배우세요 — 무료

브라우저에서 실제 코드를 작성하고 실행하며, 24/7 AI 튜터로부터 즉각적인 도움을 받고, 웹이나 앱에서 중단한 부분부터 계속 학습하세요.

코스
29
레슨
105

자주 묻는 질문

“자동화된 마켓 메이커” 강의는 무료인가요?

네 — “자동화된 마켓 메이커” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Web3 & DApp Development Fundamentals 강의 전체를 잠금 해제할 수 있습니다. Web3 & DApp Development Fundamentals 강의에는 총 4개의 강의가 포함되어 있습니다.

“자동화된 마켓 메이커”에서 뭘 배우나요?

상수 곱 공식 브라우저에서 직접 실행하는 실습 코드로 Web3 & DApp Development Fundamentals을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Web3 & DApp Development Fundamentals을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Web3 & DApp Development Fundamentals은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“자동화된 마켓 메이커” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Web3 & DApp Development Fundamentals 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Web3 & DApp Development Fundamentals 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. DeFi 개요
  2. 자동화된 마켓 메이커
  3. 유동성 풀
  4. 간단한 스왑 만들기
← Web3 & DApp Development Fundamentals(으)로 돌아가기