2023-11-01 03:32:09 +00:00
|
|
|
# Nimbus
|
2024-06-21 07:44:10 +00:00
|
|
|
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
2023-11-01 03:32:09 +00:00
|
|
|
# Licensed under either of
|
|
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
|
|
# http://opensource.org/licenses/MIT)
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
# according to those terms.
|
|
|
|
|
2024-06-21 07:44:10 +00:00
|
|
|
import ../nimbus/evm/code_stream, strformat
|
2018-05-18 10:57:55 +00:00
|
|
|
|
2024-06-21 07:44:10 +00:00
|
|
|
var c =
|
|
|
|
CodeStream.init(CodeBytesRef.fromHex("0x6003600202600055").expect("valid code"))
|
2018-05-18 10:57:55 +00:00
|
|
|
|
|
|
|
let opcodes = c.decompile()
|
|
|
|
for op in opcodes:
|
|
|
|
echo &"[{op[0]}]\t{op[1]}\t{op[2]}"
|
|
|
|
|
|
|
|
# [1] PUSH1 0x03
|
|
|
|
# [3] PUSH1 0x02
|
|
|
|
# [4] MUL
|
|
|
|
# [6] PUSH1 0x00
|
|
|
|
# [7] SSTORE
|
|
|
|
# [-1] STOP
|