def __init__(self, tx):
        self.set_variables(tx, self.ERC20_ADDRESS)
        self.item = {}

        self.output("[%s] Processing: %s " % (self.NAME, tx["hash"]))

        self.item = self.triage_transaction(tx)

        if not self.item:
            method = self.get_method(tx["input"])
            self.output("[%s] Method missing for: %s" % (self.NAME, method))
            self.store_unhandled_method(method, tx)
            """ """ """ """ """ """ """ """ """ """
            # ### ### #### #### #### #### ### ###
            #     STORE CUSTOM METHODS HERE     #
            # ### ### #### #### #### #### ### ###
            """ """ """ """ """ """ """ """ """ """

        if self.item:
            # Add ico_id and transform eth_value from WEI to ETH
            self.item["ico_id"] = tx["ico_id"]
            if self.item["eth_value"] is not None:
                self.item[
                    "eth_value"] = self.item["eth_value"] * self.WEI_TO_ETH
            else:
                self.item["eth_value"] = -1
            if self.item["erc20_value"] is not None:
                self.item[
                    "erc20_value"] = self.item["erc20_value"] * self.WEI_TO_ETH
            else:
                self.item["erc20_value"] = -1

        prettify(self.item)
    def __init__(self, tx):
        # Push transaction and Contract address into BaseModul
        self.set_variables(tx, self.ERC20_ADDRESS)
        self.item = {}

        self.output("[%s] Processing: %s " % (self.NAME, tx["hash"]))

        # has transaction a standard type?
        # yes => item will contain a dictionary with identified values
        # no  => item will be 'False'

        self.item = self.triage_transaction(tx)

        if self.item is None:
            if len(tx["input"]) == 202:
                self.item = self.unknown_contract(tx)

        #overwrite custom transfer-function
        elif self.item["type"] == "transfer":
            tx_logs = get_logs_from_receipt(self.TRANSACTION_RECEIPT)
            self.item["erc20_value"] = self.erc20_value_from_data(tx, 1)

        elif self.item["type"] == "transfer_from":
            tx_logs = get_logs_from_receipt(self.TRANSACTION_RECEIPT)
            erc20_to = get_info_from_topics_in_logs(tx_logs, 0, 3)
            self.item["erc20_to"] = "0x" + erc20_to[-40:]
            self.item["erc20_value"] = self.erc20_value_from_data(tx, 1)

        if not self.item:
            """ """ """ """ """ """ """ """ """ """
            # ### ### #### #### #### #### ### ###
            #     STORE CUSTOM METHODS HERE     #
            # ### ### #### #### #### #### ### ###
            """ """ """ """ """ """ """ """ """ """

            # Save unknown method to database
            # Change here if you enter contract specific methods
            method = self.get_method(tx["input"])
            self.output("[%s] Method missing for: %s" % (self.NAME, method))
            self.store_unhandled_method(method, tx)

        if self.item:
            # Add ico_id and transform eth_value from WEI to ETH
            self.item["ico_id"] = tx["ico_id"]

            if self.item["eth_value"] is not None:
                self.item[
                    "eth_value"] = self.item["eth_value"] * self.WEI_TO_ETH
            else:
                self.item["eth_value"] = -1

            if self.item["erc20_value"] is not None:
                self.item[
                    "erc20_value"] = self.item["erc20_value"] * self.WEI_TO_ETH
            else:
                self.item["erc20_value"] = -1

        prettify(self.item)
Example #3
0
    def __init__(self, tx):
        # Push transaction and Contract address into BaseModul
        self.set_variables(tx, self.ERC20_ADDRESS)
        self.item = {}

        self.output("[%s] Processing: %s " % (self.NAME, tx["hash"]))

        # has transaction a standard type?
        # yes => item will contain a dictionary with identified values
        # no  => item will be 'False'
        self.item = self.triage_transaction(tx)

        if not self.item:
            """ """ """ """ """ """ """ """ """ """
            # ### ### #### #### #### #### ### ###
            #     STORE CUSTOM METHODS HERE     #
            # ### ### #### #### #### #### ### ###
            """ """ """ """ """ """ """ """ """ """

            # Save unknown method to database
            # Change here if you enter contract specific methods
            method = self.get_method(tx["input"])
            self.output("[%s] Method missing for: %s" % (self.NAME, method))
            self.store_unhandled_method(method, tx)

        if self.item:
            # Add ico_id and transform eth_value from WEI to ETH
            self.item["ico_id"] = tx["ico_id"]

            if self.item["eth_value"] is not None:
                self.item[
                    "eth_value"] = self.item["eth_value"] * self.WEI_TO_ETH
            else:
                self.item["eth_value"] = -1

            if self.item["erc20_value"] is not None:
                self.item[
                    "erc20_value"] = self.item["erc20_value"] * self.WEI_TO_ETH
            else:
                self.item["erc20_value"] = -1

        prettify(self.item)
Example #4
0
    def __init__(self, tx):
        self.set_variables(tx, self.ERC20_ADDRESS)
        self.item = {}
        self.output("[Viberate] Processing: " + tx["hash"])

        self.item = self.triage_transaction(tx)

        if not self.item:
            method = self.get_method(tx["input"])

            if method == self.PUSH_ANGEL_METHOD:
                # Angel investments won't make it to this point b/c
                # the contract addr is not in the main tx information and only in logs
                # add multiple possible contracts to check for tx_to?
                self.item = self.angel(tx)

            elif method == self.CLAIM_TEAM_TOKENS_METHOD:
                # same as above. didnt really check for sufficient work
                # need to take a look at it again
                self.item = self.team_tokens(tx)

            else:
                self.output("[Viberate] Method missing for: " + method)
                self.store_unhandled_method(method, tx)

            #print "viberate specific transaction"

        if self.item:
            # Add ico_id and transform eth_value from WEI to ETH
            self.item["ico_id"] = tx["ico_id"]
            if self.item["eth_value"] is not None:
                self.item[
                    "eth_value"] = self.item["eth_value"] * self.WEI_TO_ETH
            else:
                self.item["eth_value"] = -1
            if self.item["erc20_value"] is not None:
                self.item[
                    "erc20_value"] = self.item["erc20_value"] * self.WEI_TO_ETH
            else:
                self.item["erc20_value"] = -1

        prettify(self.item)