Skip to content

Instantly share code, notes, and snippets.

@Marenz
Created June 8, 2020 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marenz/655f48eae27c232628c612e502a74899 to your computer and use it in GitHub Desktop.
Save Marenz/655f48eae27c232628c612e502a74899 to your computer and use it in GitHub Desktop.
EVM assembly:
/* "test.sol":0:270 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* "test.sol":0:270 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* "test.sol":15:268 function f() external {... */
tag_3:
tag_4
tag_5
jump // in
tag_4:
stop
tag_5:
/* "test.sol":47:66 bytes memory amount */
0x60
/* "test.sol":76:96 bytes24 zero_bytes24 */
0x00
/* "test.sol":106:128 bytes32 signature_root */
dup1
/* "test.sol":138:150 bytes32 node */
0x00
/* "test.sol":153:263 sha256(abi.encodePacked(... */
0x02
/* "test.sol":190:252 sha256(abi.encodePacked(amount, zero_bytes24, signature_root)) */
dup1
/* "test.sol":214:220 amount */
dup6
/* "test.sol":222:234 zero_bytes24 */
dup6
/* "test.sol":236:250 signature_root */
dup6
/* "test.sol":197:251 abi.encodePacked(amount, zero_bytes24, signature_root) */
add(0x20, mload(0x40))
dup1
dup5
dup1
mload
swap1
0x20
add
swap1
dup1
dup4
dup4
tag_7:
0x20
dup4
lt
tag_9
jumpi
dup1
mload
dup3
mstore
not(0x1f)
swap1
swap3
add
swap2
0x20
swap2
dup3
add
swap2
add
jump(tag_7)
tag_9:
0x01
dup4
0x20
sub
0x0100
exp
sub
dup1
not
dup3
mload
and
dup2
dup5
mload
and
dup1
dup3
or
dup6
mstore
pop
pop
pop
pop
pop
pop
swap1
pop
add
dup4
not(0xffffffffffffffff)
and
not(0xffffffffffffffff)
and
dup2
mstore
0x18
add
dup3
dup2
mstore
0x20
add
swap4
pop
pop
pop
pop
mload(0x40)
0x20
dup2
dup4
sub
sub
dup2
mstore
swap1
0x40
mstore
/* "test.sol":190:252 sha256(abi.encodePacked(amount, zero_bytes24, signature_root)) */
mload(0x40)
dup1
dup3
dup1
mload
swap1
0x20
add
swap1
dup1
dup4
dup4
tag_10:
0x20
dup4
lt
tag_12
jumpi
dup1
mload
dup3
mstore
not(0x1f)
swap1
swap3
add
swap2
0x20
swap2
dup3
add
swap2
add
jump(tag_10)
tag_12:
mload
dup2
mload
0x20
swap4
dup5
sub
0x0100
exp
not(0x00)
add
dup1
not
swap1
swap3
and
swap2
and
or
swap1
mstore
mload(0x40)
swap2
swap1
swap4
add
swap5
pop
swap2
swap3
pop
pop
dup1
dup4
sub
dup2
dup6
gas
staticcall
iszero
dup1
iszero
tag_14
jumpi
returndatasize
0x00
dup1
returndatacopy
revert(0x00, returndatasize)
tag_14:
pop
pop
pop
mload(0x40)
returndatasize
0x20
dup2
lt
iszero
tag_15
jumpi
0x00
dup1
revert
tag_15:
pop
mload
/* "test.sol":160:262 abi.encodePacked(... */
0x40
dup1
mload
/* "test.sol":190:252 sha256(abi.encodePacked(amount, zero_bytes24, signature_root)) */
0x20
/* "test.sol":160:262 abi.encodePacked(... */
dup2
dup2
add
swap4
swap1
swap4
mstore
dup2
mload
dup1
dup3
sub
dup5
add
dup2
mstore
swap1
dup3
add
swap2
dup3
swap1
mstore
/* "test.sol":153:263 sha256(abi.encodePacked(... */
dup1
mload
/* "test.sol":160:262 abi.encodePacked(... */
swap1
swap3
dup3
swap2
/* "test.sol":153:263 sha256(abi.encodePacked(... */
swap1
dup5
add
swap1
dup1
/* "test.sol":160:262 abi.encodePacked(... */
dup4
/* "test.sol":153:263 sha256(abi.encodePacked(... */
dup4
tag_16:
0x20
dup4
lt
tag_18
jumpi
dup1
mload
dup3
mstore
not(0x1f)
swap1
swap3
add
swap2
0x20
swap2
dup3
add
swap2
add
jump(tag_16)
tag_18:
mload
dup2
mload
0x20
swap4
dup5
sub
0x0100
exp
not(0x00)
add
dup1
not
swap1
swap3
and
swap2
and
or
swap1
mstore
mload(0x40)
swap2
swap1
swap4
add
swap5
pop
swap2
swap3
pop
pop
dup1
dup4
sub
dup2
dup6
gas
staticcall
iszero
dup1
iszero
tag_20
jumpi
returndatasize
0x00
dup1
returndatacopy
revert(0x00, returndatasize)
tag_20:
pop
pop
pop
mload(0x40)
returndatasize
0x20
dup2
lt
iszero
tag_21
jumpi
0x00
dup1
revert
tag_21:
pop
pop
pop
pop
pop
pop
/* "test.sol":15:268 function f() external {... */
jump // out
auxdata: 0xa2646970667358221220eb19f5bacd61eab743e7e6715f80aa4b3925ce06f01d035885bc252d956b725e64736f6c637827302e362e31302d646576656c6f702e323032302e362e382b636f6d6d69742e33323561373866650058
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment