evm, payable"/>
burrow, evm, payable
Difference between payable or non-payable fallback
Solidity code:
// fallbackfunction () ?payable? external {nnn = 100;}function testA(uint a) public payable { address payable aaa = address( uint160(address(this)) );aaa.transfer(a);}
Payable fallback
It will execute the fallback and return.
(pc) 0 (op) PUSH1 (st) 0 (gas) 2300 => 0x0000000000000000000000000000000000000000000000000000000000000080
(pc) 2 (op) PUSH1 (st) 1 (gas) 2299 => 0x0000000000000000000000000000000000000000000000000000000000000040
(pc) 4 (op) MSTORE (st) 2 (gas) 2298 => 0x0000000000000000000000000000000000000000000000000000000000000080 @ 0x64
(pc) 5 (op) PUSH1 (st) 0 (gas) 2296 => 0x0000000000000000000000000000000000000000000000000000000000000004
(pc) 7 (op) CALLDATASIZE (st) 1 (gas) 2295 => 0
(pc) 8 (op) LT (st) 2 (gas) 2294 0 < 4 = 1
(pc) 9 (op) PUSH2 (st) 1 (gas) 2291 => 0x00000000000000000000000000000000000000000000000000000000000000DD
(pc) 12 (op) JUMPI (st) 2 (gas) 2290 ~> 221
(pc) 221 (op) JUMPDEST (st) 0 (gas) 2288
(pc) 222 (op) PUSH1 (st) 0 (gas) 2288 => 0x0000000000000000000000000000000000000000000000000000000000000064
(pc) 224 (op) PUSH1 (st) 1 (gas) 2287 => 0x0000000000000000000000000000000000000000000000000000000000000004
(pc) 226 (op) DUP2 (st) 2 (gas) 2286 => [2] 0x0000000000000000000000000000000000000000000000000000000000000064
(pc) 227 (op) SWAP1 (st) 3 (gas) 2284 => [2] 0000000000000000000000000000000000000000000000000000000000000004
(pc) 228 (op) SSTORE (st) 3 (gas) 2283 9201EFC3AC005185383A8DE6EAF14D7761F81412 {0000000000000000000000000000000000000000000000000000000000000004 := 0000000000000000000000000000000000000000000000000000000000000064}
(pc) 229 (op) POP (st) 1 (gas) 2280 => 0x0000000000000000000000000000000000000000000000000000000000000064
(pc) 230 (op) STOP (st) 0 (gas) 2279
Non-payable fallback
It will eventually do REVERT.
(pc) 0 (op) PUSH1 (st) 0 (gas) 2300 => 0x0000000000000000000000000000000000000000000000000000000000000080
(pc) 2 (op) PUSH1 (st) 1 (gas) 2299 => 0x0000000000000000000000000000000000000000000000000000000000000040
(pc) 4 (op) MSTORE (st) 2 (gas) 2298 => 0x0000000000000000000000000000000000000000000000000000000000000080 @ 0x64
(pc) 5 (op) PUSH1 (st) 0 (gas) 2296 => 0x0000000000000000000000000000000000000000000000000000000000000004
(pc) 7 (op) CALLDATASIZE (st) 1 (gas) 2295 => 0
(pc) 8 (op) LT (st) 2 (gas) 2294 0 < 4 = 1
(pc) 9 (op) PUSH2 (st) 1 (gas) 2291 => 0x00000000000000000000000000000000000000000000000000000000000000E8
(pc) 12 (op) JUMPI (st) 2 (gas) 2290 ~> 232
(pc) 232 (op) JUMPDEST (st) 0 (gas) 2288
(pc) 233 (op) CALLVALUE (st) 0 (gas) 2288 => 101
(pc) 234 (op) DUP1 (st) 1 (gas) 2287 => [1] 0x0000000000000000000000000000000000000000000000000000000000000065
(pc) 235 (op) ISZERO (st) 2 (gas) 2285 0000000000000000000000000000000000000000000000000000000000000065 == 0 = 0
(pc) 236 (op) PUSH2 (st) 2 (gas) 2283 => 0x00000000000000000000000000000000000000000000000000000000000000F4
(pc) 239 (op) JUMPI (st) 3 (gas) 2282 ~> false
(pc) 240 (op) PUSH1 (st) 1 (gas) 2280 => 0x0000000000000000000000000000000000000000000000000000000000000000
(pc) 242 (op) DUP1 (st) 2 (gas) 2279 => [1] 0x0000000000000000000000000000000000000000000000000000000000000000
(pc) 243 (op) REVERT (st) 3 (gas) 2277 => [0, 0] (0) 0x
更多推荐
burrow, evm, payable
发布评论