Yes. The dollar figures are market prices (BTC about $28k, UNI about $6). The pool has its own price, which is just the ratio of its two reserves. I read the pool's Sync events on Blockscout:
- Before the bot's front-run: 0.000274 WBTC and 0.7237 UNI. That's about $12 of liquidity in total, at an internal price of 0.00038 WBTC (about $10) per UNI.
- After the bot's 64.9 WBTC buy: 64.9057 WBTC and 0.0000031 UNI. The internal price was now about 21 million WBTC per UNI.
- After the attackers' sale: 19.6 UNI and 1,018 sats.
The Uniswap V2 formula is the same in both directions. getAmountOut computes out = in × 997 × reserveOut / (reserveIn × 1000 + in × 997). The pool keeps reserve × reserve constant (x·y=k), whichever way you trade. So a buy followed by selling the same tokens back returns you to the same point on the curve, minus the 0.3% fee. I ran the bot's planned sell-back through that formula myself, using the reserves right after its buy (this is my calculation, not on-chain data). Its 0.72374 UNI would have returned 64.90542794 WBTC, only 166 sats less than it paid. Because the pool was almost empty, the fee hardly mattered.
So the bot's "$4 of UNI" was really a claim on nearly all of the pool's 64.9 WBTC. But that only held if the bot was the next one to sell UNI into the pool. The UNI was worth whatever the pool would pay for it, not its market price. The attackers sold first, with 19.6 UNI (about $120 at market), and got 64.9057 WBTC. That left 1,018 sats in the pool for the bot's sell-back, which reverted.
Front-run: etherscan.io/tx/0xe9ce121022cd2bd3c30759186d8bbc447b4ce80cb…
Code: github.com/Uniswap/v2-periphery/blob/master/contracts/libra…
Ethereum (ETH) Blockchain Explorer · etherscan.io/tx/0xe9ce121022cd2bd3c30759186d8bbc447b4ce80cb9d905d09e4f47fc7816f…Ethereum Transaction Hash: 0xe9ce121022... | EtherscanSwap 64.91 WBTC for 0.7237 UNI on Uniswap V2 | Success | Apr-02-2023 11:29:35 PM (UTC)