burrow, evm, payable

编程入门 行业动态 更新时间:2024-10-23 13:30:54

burrow, <a href=https://www.elefans.com/category/jswz/34/1692613.html style=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

本文发布于:2024-03-05 03:59:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1711255.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:burrow   evm   payable

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!