Skip to content

Commit fac0832

Browse files
author
Logan Sulpizio
committed
Fix incorrect hex conversion
1 parent 4da1a1e commit fac0832

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

yam_indexing_module/logs_handlers/internals/_decoders.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def _decode_log_offer_created(log: LogReceipt) -> Dict[str, Any]:
1818
buyer_token = normalize_ethereum_address(log['topics'][2].hex())
1919
offer_id = _hex_to_decimal(log['topics'][3].hex())
2020

21-
# Remove the '0x' prefix from data field
22-
hex_data = log['data'].hex()[2:]
21+
hex_data = log['data'].hex()
2322

2423
# Extract additional data from the data field
2524
seller_address = normalize_ethereum_address('0x' + hex_data[:64])
@@ -60,14 +59,13 @@ def _decode_log_offer_accepted(log: LogReceipt) -> Dict[str, Any]:
6059
seller_address = normalize_ethereum_address(log['topics'][2].hex())
6160
buyer_address = normalize_ethereum_address(log['topics'][3].hex())
6261

63-
# Remove the '0x' prefix from data field
64-
hex_data = log['data'].hex()[2:]
62+
hex_data = log['data'].hex()
6563

6664
# Extract additional data from the data field
6765
offer_token = normalize_ethereum_address('0x' + hex_data[:64])
6866
buyer_token = normalize_ethereum_address('0x' + hex_data[64:128])
69-
price = _hex_to_decimal(hex_data[129:192])
70-
amount = _hex_to_decimal(hex_data[193:])
67+
price = _hex_to_decimal(hex_data[128:192])
68+
amount = _hex_to_decimal(hex_data[192:256])
7169

7270
# Create event data dictionary
7371
custom_data_log = {
@@ -102,8 +100,7 @@ def _decode_log_offer_updated(log: LogReceipt) -> Dict[str, Any]:
102100
new_price = _hex_to_decimal(log['topics'][2].hex())
103101
new_amount = _hex_to_decimal(log['topics'][3].hex())
104102

105-
# Remove the '0x' prefix from data field
106-
hex_data = log['data'].hex()[2:]
103+
hex_data = log['data'].hex()
107104

108105
# Extract additional data from the data field
109106
old_price = _hex_to_decimal(hex_data[:64])

0 commit comments

Comments
 (0)