
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.
