Created
November 28, 2021 08:23
-
-
Save metashx/fac5bbbd9036696a05f68edfc1e0d78d to your computer and use it in GitHub Desktop.
opcodes of different safeTransferETH implementations from https://twitter.com/transmissions11/status/1464432498297901056
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// call(gas(), to, amount, 0, 0, 0, 0) | |
| DUP1 | |
| PUSH1 0x0 | |
| DUP1 | |
| PUSH1 0x0 | |
| DUP6 | |
| DUP8 | |
| GAS | |
| CALL | |
| SWAP1 | |
| POP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// to.call{value: amount}("") | |
| DUP3 | |
| PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | |
| AND | |
| DUP3 | |
| PUSH1 0x40 | |
| MLOAD | |
| PUSH2 0x166 | |
| SWAP1 | |
| PUSH2 0x2F8 | |
| JUMP | |
| JUMPDEST | |
| PUSH1 0x0 | |
| PUSH1 0x40 | |
| MLOAD | |
| DUP1 | |
| DUP4 | |
| SUB | |
| DUP2 | |
| DUP6 | |
| DUP8 | |
| GAS | |
| CALL | |
| SWAP3 | |
| POP | |
| POP | |
| POP | |
| RETURNDATASIZE | |
| DUP1 | |
| PUSH1 0x0 | |
| DUP2 | |
| EQ | |
| PUSH2 0x1A3 | |
| JUMPI | |
| PUSH1 0x40 | |
| MLOAD | |
| SWAP2 | |
| POP | |
| PUSH1 0x1F | |
| NOT | |
| PUSH1 0x3F | |
| RETURNDATASIZE | |
| ADD | |
| AND | |
| DUP3 | |
| ADD | |
| PUSH1 0x40 | |
| MSTORE | |
| RETURNDATASIZE | |
| DUP3 | |
| MSTORE | |
| RETURNDATASIZE | |
| PUSH1 0x0 | |
| PUSH1 0x20 | |
| DUP5 | |
| ADD | |
| RETURNDATACOPY | |
| PUSH2 0x1A8 | |
| JUMP | |
| JUMPDEST | |
| PUSH1 0x60 | |
| SWAP2 | |
| POP | |
| JUMPDEST | |
| POP | |
| POP | |
| DUP1 | |
| SWAP2 | |
| POP | |
| POP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment