예제 #1
0
    def __init__(self,
                 bytecode=None,
                 address=None,
                 static_analysis=True,
                 dynamic_analysis=True,
                 network="mainnet",
                 simplify_show_unreachable=False,
                 simplify_show_asm=False):
        if not bytecode and not address:
            raise Exception("missing bytecode or contract address")

        if not bytecode:
            api = utils.EthJsonRpc("https://%s.infura.io/" % network)
            bytecode = api.call(method="eth_getCode",
                                params=[address, "latest"])["result"]

        self.address = address
        self.bytecode, self.auxdata = Contract.get_auxdata(bytecode)
        self._evmcode = EvmCode(
            contract=self,
            static_analysis=static_analysis,
            dynamic_analysis=dynamic_analysis
        )  # do not reference this directly, always use self.disassembly()

        self._simplify_show_unreachable, self._simplify_show_asm = simplify_show_unreachable, simplify_show_asm
예제 #2
0
    def __init__(self, bytecode=None, address=None, static_analysis=True, dynamic_analysis=True):
        if not bytecode and not address:
            raise Exception("missing bytecode or contract address")

        if not bytecode:
            api = utils.EthJsonRpc("https://mainnet.infura.io/")
            bytecode = api.call(method="eth_getCode", params=[address, "latest"])["result"]

        self.bytecode = bytecode
        self.address = address
        self._evmcode = EvmCode(contract=self,
                                static_analysis=static_analysis, dynamic_analysis=dynamic_analysis)  # do not reference this directly, always use self.disassembly()
예제 #3
0
 def trace_transaction(self, tx):
     api = utils.EthJsonRpc("https://%s.infura.io/" % "mainnet")
     bytecode = api.call(method="debug_traceTransaction",
                         params=[
                             tx, {
                                 "disableStorage": False,
                                 "disableMemory": False,
                                 "disableStack": False,
                                 "tracer": None,
                                 "timeout": None
                             }
                         ])