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 23
23
24
24
from ethereumetl .domain .receipt import EthReceipt
25
25
from 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
27
27
28
28
29
29
class EthReceiptMapper (object ):
@@ -53,7 +53,7 @@ def json_dict_to_receipt(self, json_dict):
53
53
receipt .l1_fee = hex_to_dec (json_dict .get ('l1Fee' ))
54
54
receipt .l1_gas_used = hex_to_dec (json_dict .get ('l1GasUsed' ))
55
55
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' ))
57
57
58
58
59
59
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):
47
47
except ValueError :
48
48
return None
49
49
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
50
60
51
61
def chunk_string (string , length ):
52
62
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