53.hl (@wush53) profile picture
Joined November 2022
Photo by 53.hl (@wush53)Photo by 53.hl (@wush53)
(1/4) 🤯 Try/catch with intentional revert in Solidity is mind-blowing... I will explain each functions in the thread =>
2
1
65
(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.
1
1
30
(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…
1
32
📦 Inline assembly code can be interleaved within Solidity code base to have more fine-grain control over EVM and is used especially while writing the library functions gt(x, y) returns 1 if x > y, 0 o/w Adding the quotient and 0/1 achieves round-up in a clean and efficient way
1
41