From 4ea3933f078fc6d1eed6cea9fc2334fd441306a9 Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 25 Feb 2021 08:36:39 +0100 Subject: [PATCH] Handle failed giftercallbacks --- apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py b/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py index 19faadfa..7fce9d39 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/filters/callback.py @@ -7,6 +7,7 @@ import celery from cic_registry.error import UnknownContractError from chainlib.status import Status as TxStatus from chainlib.eth.address import to_checksum +from chainlib.eth.constant import ZERO_ADDRESS from hexathon import strip_0x # local imports @@ -83,6 +84,9 @@ class CallbackFilter(SyncFilter): elif method_signature == giveto_method_signature: transfer_type = 'tokengift' transfer_data = unpack_gift(tx.payload) + transfer_data['from'] = tx.inputs[0] + transfer_data['value'] = 0 + transfer_data['token_address'] = ZERO_ADDRESS for l in tx.logs: topics = l['topics'] logg.debug('topixx {}'.format(topics)) @@ -91,7 +95,6 @@ class CallbackFilter(SyncFilter): #token_address_bytes = topics[2][32-20:] token_address = strip_0x(topics[2])[64-40:] transfer_data['token_address'] = to_checksum(token_address) - transfer_data['from'] = tx.inputs[0] logg.debug('resolved method {}'.format(transfer_type))