03 How the contract prices a trade
The price is arithmetic, not a negotiation.
Without an order book, something still has to set the price. An AMM takes it from the pool itself: two reserves, and a rule every trade has to respect. The best-known rule — the one modelled here — is the constant product: reserve A times reserve B stays the same, trade after trade.
Put token A in and the pool pays out exactly as much token B as keeps that product unchanged. The pool slides along the curve, and the price moves with it — gently for a small trade, steeply for a large one.
Drag the trade size and watch where the pool ends up. The numbers are a model in abstract units, not market data.