DeFi mechanics: automated market makers and lending pools
In short
An automated market maker (AMM) holds two tokens in a pool and prices trades so that the product of the two balances stays constant. In this example, a Larkspur pool of 100 VRX and 4,000,000 MDT prices VRX at $40,000; buying 1 VRX costs $40,404.04 (1.01% above that price) and buying 10 costs $44,444.44 each (11.11%), before any pool fee. Liquidity providers who supply the pool trail simply holding the two tokens when prices move, before fees: a doubling of the VRX price leaves them 5.72% behind. A lending pool lends against collateral. A $6,000 MDT loan against $10,000 of VRX with an 80% liquidation threshold is liquidated if VRX falls 25%, to $30,000. Lenders earn less than borrowers pay: at a 5% borrowing rate, 80% utilization and a 10% reserve factor, suppliers receive 3.60%.
Scope. This article explains the two most common DeFi building blocks: automated market makers, which price trades with a formula, and lending pools, which lend against collateral and liquidate automatically. It builds on DeFi: Financial Machinery Without the Institutions. It is educational and informational only. It contains no price forecast, level, target or signal, names no protocol, exchange or platform, and does not evaluate any token. Worked figures use the fictional Larkspur protocol, Verex (VRX) and Meridian Dollar Token (MDT). Tax rules vary by country and are not covered here.
Automated market makers
A conventional exchange matches buyers with sellers. An AMM has no order book; it holds a pool of two tokens and lets anyone trade against it at a price set by a formula. The most widely used design keeps the product of the two balances constant, so x × y = k.
Larkspur's pool holds 100 VRX and 4,000,000 MDT, so k = 400,000,000 and the pool price is $40,000. To buy VRX, a trader adds MDT and removes VRX until the product is back to k:
| VRX bought | MDT paid | Average price | Above pool price |
|---|---|---|---|
| 1 | 40,404.04 | $40,404.04 | 1.01% |
| 10 | 444,444.44 | $44,444.44 | 11.11% |
The larger the trade relative to the pool, the worse the price. Pools also charge a fee on each trade, which goes to the liquidity providers; the table leaves the fee out.
The liquidity provider's position
Liquidity providers deposit both tokens and earn fees. When the price of one token moves, the formula leaves the pool holding more of the token that fell and less of the one that rose. If the VRX price doubles, the pool position is worth 2√2 ÷ 3 = 0.9428 of what simply holding the two tokens would be worth, a 5.72% shortfall before fees (see DeFi: Financial Machinery Without the Institutions). Fees may or may not make up the difference.
Lending pools
| Rule | Larkspur setting | Failure mode |
|---|---|---|
| Collateral | Deposit tokens worth more than the loan | Collateral value can fall faster than liquidations can run |
| Liquidation threshold | 80% of collateral value | Oracle errors can trigger liquidations wrongly |
| Liquidation | Anyone can repay the loan and take collateral at a discount | The borrower loses the discount on top of the fall |
| Interest rate | Rises with utilization (borrowed ÷ supplied) | At full utilization, suppliers cannot withdraw |
A borrower deposits $10,000 of VRX and borrows $6,000 of MDT. The health factor is 10,000 × 0.80 ÷ 6,000 = 1.33; liquidation starts when it falls to 1, when collateral is worth $7,500. That is a 25% fall, with VRX at $30,000. On the lending side, if borrowers pay 5% and 80% of the pool is lent out, suppliers receive 5% × 80% × (1 − 10% reserve factor) = 3.60%.
Teaching value, not a forecast: Larkspur figures and parameters are fictional.
Risks the formulas do not show
Smart-contract bugs, price oracles that report wrong prices, governance changes to parameters (see Governance Tokens), and the stablecoin used as the other side of the pool (see Stablecoin Plumbing at Depth) all sit outside the arithmetic. DeFi: Financial Machinery Without the Institutions described the general property: code without discretion also has no one to correct its errors. The exception is a contract deployed with upgrade or admin powers: whoever holds those keys can change it, which is a separate risk, covered in Reading a Token's Documentation.
Check understanding
1 of 5
In the Larkspur pool of 100 VRX and 4,000,000 MDT, a trader buys 5 VRX. What is the average price per VRX, before any pool fee?
Frequently askedCommon questions
4 questions
What does an AMM keep constant?
The product of the two token balances in the pool.
What does buying 1 VRX from the example pool cost?
$40,404.04, 1.01% above the pool price, before any pool fee.
When is the example loan liquidated?
When VRX falls 25%, to $30,000.
Why do suppliers earn less than borrowers pay?
Only part of the pool is lent out, and the protocol keeps a reserve share.
Finished reading?
Mark it complete once the answer holds without scrolling back up.
Ask MarketClue AI about this lesson
The question carries this lesson as its context. MarketClue AI needs an account.
MarketClue does not provide financial advice.
Next on your list
After that
Educational and informational only — not investment advice, a recommendation, or an offer to buy or sell any security. Investing involves risk, including the possible loss of principal. Worked examples use fictional companies and figures.