avatar
Eunum

Following0Followers (X)55Posts29Likes11
avatar

🦄 @Uniswap V1 from scratch is complete. Rebuilt the full V1 in Solidity with Foundry, by hand. - Factory + exchange, where the exchange is the LP token - x * y = k with the 0.3% fee - ETH token and token token swaps, add/remove liquidity - 181 tests passing, 100% forge coverage - Docs + limitations and security notes 🎥 Video coming soon: not a coding tutorial, but a high-level code overview with code snippets and animations to understand how it all works. Credits: original V1 contracts + @rosarioborgesi Solidity version. 👨‍💻 GitHub: https://t.co/D4koIhyI6O

avatar

🦄 Progress on building @Uniswap V1 from scratch. - Complete tokenToEth route unit tests. - 131 tests passing with 100% forge coverage so far. 👨‍💻 GitHub: https://t.co/D4koIhyI6O

avatar

🦄 Progress on building @Uniswap V1 from scratch. - Implement removeLiquidity for burning pool shares. - Withdraws a proportional share of both ETH and tokens, based on LP share of total supply. 👨‍💻 GitHub: https://t.co/D4koIhyI6O

avatar

🦄 Progress on building @Uniswap V1 from scratch. - Implement addLiquidity for initial and subsequent pool deposits. - First deposit sets the pool price, later deposits must match the current ratio. 👨‍💻 GitHub: https://t.co/D4koIhyI6O

avatar

🦄 Progress on building @Uniswap V1 from scratch. - Complete ethToToken output swap route unit tests. - 55 tests passing with 100% forge coverage so far. 👨‍💻 GitHub: https://t.co/D4koIhyI6O

avatar

🦄 Progress on building @Uniswap V1 from scratch. - Added wrappers around private math functions. - Wrote ethToTokenSwapInput basic unit tests. 👨‍💻 GitHub: https://t.co/D4koIhyI6O

avatar

🦄 Progress on building @Uniswap V1 from scratch. - Implement _getInputPrice() & _getOutputPrice() for calculating ETH/Token price. - Implement getEthToTokenInputPrice() to get the amount of tokens bought for an exact ETH amount. - Implement _ethToTokenInput() to execute an ETH to Token swap. 👨‍💻 GitHub: https://t.co/D4koIhyahg

avatar

While building @Uniswap V1 from scratch, i found something about how contract balance behaves when you send ETH with a function call. Let's say contract have 10 ETH. You call a payable function with 1 ETH. Inside the function, address(this).balance returns 11 ETH, not 10. The EVM adds any incoming ETH to the balance before it runs any line of the function's code.

avatar

Finished Workshop 1 of UHI-11 today 🦄 Most in-depth workshop I've ever sat through. I came in knowing x*y=k and thought that was AMMs. Then the v2, v3 and v4 designs, flash accounting, transient storage, ERC-6909 claims... way beyond the constant product formula 😅 Honestly I understood maybe 30% of it, but one thing clicked: in v4, a hook is custom code the pool runs at set points in a swap, like beforeSwap and afterSwap. Going to rewatch the recording and re-read the lessons this week. Thanks @TomWade and @AtriumAcademy for the session 🙏