File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 2323
2424from ethereumetl .domain .receipt import EthReceipt
2525from ethereumetl .mappers .receipt_log_mapper import EthReceiptLogMapper
26- from ethereumetl .utils import hex_to_dec , to_normalized_address
26+ from ethereumetl .utils import hex_to_dec , to_normalized_address , to_float_or_none
2727
2828
2929class EthReceiptMapper (object ):
@@ -53,7 +53,7 @@ def json_dict_to_receipt(self, json_dict):
5353 receipt .l1_fee = hex_to_dec (json_dict .get ('l1Fee' ))
5454 receipt .l1_gas_used = hex_to_dec (json_dict .get ('l1GasUsed' ))
5555 receipt .l1_gas_price = hex_to_dec (json_dict .get ('l1GasPrice' ))
56- receipt .l1_fee_scalar = hex_to_dec (json_dict .get ('l1FeeScalar' ))
56+ receipt .l1_fee_scalar = to_float_or_none (json_dict .get ('l1FeeScalar' ))
5757
5858
5959 if 'logs' in json_dict :
Original file line number Diff line number Diff line change @@ -47,6 +47,16 @@ def to_int_or_none(val):
4747 except ValueError :
4848 return None
4949
50+ def to_float_or_none (val ):
51+ if isinstance (val , float ):
52+ return val
53+ if val is None or val == "" :
54+ return None
55+ try :
56+ return float (val )
57+ except ValueError :
58+ print ("can't cast %s to float" % val )
59+ return val
5060
5161def chunk_string (string , length ):
5262 return (string [0 + i :length + i ] for i in range (0 , len (string ), length ))
You can’t perform that action at this time.
0 commit comments