The Math Behind Every Uniswap-Style Swap
Explaining the constant-product formula that powers DeFi
TL;DR
AMMs like Uniswap use the formula x * y = k
You swap dx of token X to get dy of token Y
Fee is charged on the input, and price impact depends on pool reserves
This post walks through...
devsadi.hashnode.dev2 min read