1
1
from eth_utils import encode_hex
2
+ from ..utils import wei_to_ether
3
+
2
4
3
5
def unpack_bfp_configuration (config_data ):
4
6
"""
@@ -15,22 +17,22 @@ def unpack_bfp_configuration(config_data):
15
17
"pyth_publish_time_max" : config_data [4 ],
16
18
"min_order_age" : config_data [5 ],
17
19
"max_order_age" : config_data [6 ],
18
- "min_keeper_fee_usd" : config_data [7 ],
19
- "max_keeper_fee_usd" : config_data [8 ],
20
- "keeper_profit_margin_usd" : config_data [9 ],
21
- "keeper_profit_margin_percent" : config_data [10 ],
20
+ "min_keeper_fee_usd" : wei_to_ether ( config_data [7 ]) ,
21
+ "max_keeper_fee_usd" : wei_to_ether ( config_data [8 ]) ,
22
+ "keeper_profit_margin_usd" : wei_to_ether ( config_data [9 ]) ,
23
+ "keeper_profit_margin_percent" : wei_to_ether ( config_data [10 ]) ,
22
24
"keeper_settlement_gas_units" : config_data [11 ],
23
25
"keeper_cancellation_gas_units" : config_data [12 ],
24
26
"keeper_liquidation_gas_units" : config_data [13 ],
25
27
"keeper_flag_gas_units" : config_data [14 ],
26
28
"keeper_liquidate_margin_gas_units" : config_data [15 ],
27
29
"keeper_liquidation_endorsed" : config_data [16 ],
28
30
"collateral_discount_scalar" : config_data [17 ],
29
- "min_collateral_discount" : config_data [18 ],
30
- "max_collateral_discount" : config_data [19 ],
31
- "utilization_breakpoint_percent" : config_data [20 ],
32
- "low_utilization_slope_percent" : config_data [21 ],
33
- "high_utilization_slope_percent" : config_data [22 ],
31
+ "min_collateral_discount" : wei_to_ether ( config_data [18 ]) ,
32
+ "max_collateral_discount" : wei_to_ether ( config_data [19 ]) ,
33
+ "utilization_breakpoint_percent" : wei_to_ether ( config_data [20 ]) ,
34
+ "low_utilization_slope_percent" : wei_to_ether ( config_data [21 ]) ,
35
+ "high_utilization_slope_percent" : wei_to_ether ( config_data [22 ]) ,
34
36
}
35
37
36
38
@@ -65,20 +67,20 @@ def unpack_bfp_configuration_by_id(config_data):
65
67
return {
66
68
"oracle_node_id" : encode_hex (oracle_node_id ),
67
69
"pyth_price_feed_id" : encode_hex (pyth_price_feed_id ),
68
- "maker_fee" : maker_fee ,
69
- "taker_fee" : taker_fee ,
70
- "max_market_size" : max_market_size ,
71
- "max_funding_velocity" : max_funding_velocity ,
72
- "skew_scale" : skew_scale ,
73
- "funding_velocity_clamp" : funding_velocity_clamp ,
74
- "min_credit_percent" : min_credit_percent ,
75
- "min_margin_usd" : min_margin_usd ,
76
- "min_margin_ratio" : min_margin_ratio ,
77
- "incremental_margin_scalar" : incremental_margin_scalar ,
78
- "maintenance_margin_scalar" : maintenance_margin_scalar ,
79
- "max_initial_margin_ratio" : max_initial_margin_ratio ,
80
- "liquidation_reward_percent" : liquidation_reward_percent ,
81
- "liquidation_limit_scalar" : liquidation_limit_scalar ,
82
- "liquidation_window_duration" : liquidation_window_duration ,
83
- "liquidation_max_pd" : liquidation_max_pd ,
70
+ "maker_fee" : wei_to_ether ( maker_fee ) ,
71
+ "taker_fee" : wei_to_ether ( taker_fee ) ,
72
+ "max_market_size" : wei_to_ether ( max_market_size ) ,
73
+ "max_funding_velocity" : wei_to_ether ( max_funding_velocity ) ,
74
+ "skew_scale" : wei_to_ether ( skew_scale ) ,
75
+ "funding_velocity_clamp" : wei_to_ether ( funding_velocity_clamp ) ,
76
+ "min_credit_percent" : wei_to_ether ( min_credit_percent ) ,
77
+ "min_margin_usd" : wei_to_ether ( min_margin_usd ) ,
78
+ "min_margin_ratio" : wei_to_ether ( min_margin_ratio ) ,
79
+ "incremental_margin_scalar" : wei_to_ether ( incremental_margin_scalar ) ,
80
+ "maintenance_margin_scalar" : wei_to_ether ( maintenance_margin_scalar ) ,
81
+ "max_initial_margin_ratio" : wei_to_ether ( max_initial_margin_ratio ) ,
82
+ "liquidation_reward_percent" : wei_to_ether ( liquidation_reward_percent ) ,
83
+ "liquidation_limit_scalar" : wei_to_ether ( liquidation_limit_scalar ) ,
84
+ "liquidation_window_duration" : wei_to_ether ( liquidation_window_duration ) ,
85
+ "liquidation_max_pd" : wei_to_ether ( liquidation_max_pd ) ,
84
86
}
0 commit comments