def test_filter_transfer_from_receipt_log(): log = EthReceiptLog() log.address = '0x25c6413359059694A7FCa8e599Ae39Ce1C944Da2' log.block_number = 1061946 log.data = '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18' log.log_index = 0 log.topics = [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x000000000000000000000000e9eeaec75883f0e389a78e2260bfac1776df2f1d', '0x0000000000000000000000000000000000000000000000000000000000000000' ] log.transaction_hash = '0xd62a74c7b04e8e0539398f6ba6a5eb11ad8aa862e77f0af718f0fad19b0b0480' erc20_transfer = erc20_transfer_extractor.extract_transfer_from_log(log) assert erc20_transfer.erc20_token == '0x25c6413359059694a7fca8e599ae39ce1c944da2' assert erc20_transfer.erc20_from == '0xe9eeaec75883f0e389a78e2260bfac1776df2f1d' assert erc20_transfer.erc20_to == '0x0000000000000000000000000000000000000000' assert erc20_transfer.erc20_value == 115792089237316195423570985008687907853269984665640564039457584007913129638936 assert erc20_transfer.erc20_tx_hash == '0xd62a74c7b04e8e0539398f6ba6a5eb11ad8aa862e77f0af718f0fad19b0b0480' assert erc20_transfer.erc20_block_number == 1061946
def web3_dict_to_receipt_log(self, dict): receipt_log = EthReceiptLog() receipt_log.log_index = dict.get('logIndex', None) transaction_hash = dict.get('transactionHash', None) if transaction_hash is not None: transaction_hash = transaction_hash.hex() receipt_log.transaction_hash = transaction_hash block_hash = dict.get('blockHash', None) if block_hash is not None: block_hash = block_hash.hex() receipt_log.block_hash = block_hash receipt_log.block_number = dict.get('blockNumber', None) receipt_log.address = dict.get('address', None) receipt_log.data = dict.get('data', None) if 'topics' in dict: receipt_log.topics = [topic.hex() for topic in dict['topics']] return receipt_log