Пример #1
0
    def __get_asm(self, solfile):
        prefix = 'EVM assembly:'
        next_sec = '======='

        content = Command.cmd('solc --asm-json "%s"' % solfile).exp_exit_codes(0).run().stdout

        asm = []

        pos = 0
        while pos < len(content):
            begin = content.find(prefix, pos)
            if begin < 0:
                break

            begin += len(prefix)
            end = content.find(next_sec, begin)
            if end < 0:
                end = len(content)

            pos = end

            sec = json.loads(content[begin:end])
            if sec is not None:
                asm.append(sec)

        return asm
Пример #2
0
 def __get_opcode_set(self, opfile):
     opcodes = set(Command.cmd("awk '{print toupper($2)}' '%s'" % opfile).check().run().stdout.split())
     #for i, op in enumerate(opcodes):
     #    print("{0:<{1}} {2}".format(i+1, 5, op))
     return opcodes
Пример #3
0
def __get_opcode_set():
    opfile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'evm-ops.lst')
    return set(Command.cmd("awk '{print toupper($2)}' '%s'" % opfile).check().run().stdout.split())