(1/4) 🤯 Try/catch with intentional revert in Solidity is mind-blowing...
I will explain each functions in the thread =>
(3/4) When "swap" function calls "biswapSwapCallback" function, we can access wanted current values in pool contract. We use assembly to read and write values in memory as it will be more gas efficient. Note that we pointed to the 0x40 slot in memory, where free memory starts.
(4/4) Memory in EVM is organized in 32 byte slots. 0x20 = 32 in decimal. Therefore, we can point to the next available memory slot per 0x20.
For more details, follow the links
- Try/catch in Solidity solidity-by-example.org/try-…
- mload/mstore ethereum.stackexchange.com/q…


