File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ use crate::math::casting::Cast;
1414use crate :: math:: funding:: calculate_funding_payment;
1515use crate :: math:: oracle:: { is_oracle_valid_for_action, DriftAction } ;
1616
17- use crate :: math:: spot_balance:: { get_strict_token_value, get_token_value} ;
1817use crate :: math:: helpers:: get_proportion_u128;
1918use crate :: math:: safe_math:: SafeMath ;
19+ use crate :: math:: spot_balance:: { get_strict_token_value, get_token_value} ;
2020use crate :: msg;
2121use crate :: state:: margin_calculation:: { MarginCalculation , MarginContext , MarketIdentifier } ;
2222use crate :: state:: oracle:: { OraclePriceData , StrictOraclePrice } ;
@@ -82,7 +82,8 @@ pub fn calc_high_leverage_mode_initial_margin_ratio_from_size(
8282) -> DriftResult < u32 > {
8383 let result = if size_adj_margin_ratio < pre_size_adj_margin_ratio {
8484 let size_pct_discount_factor = PERCENTAGE_PRECISION . saturating_sub (
85- ( ( pre_size_adj_margin_ratio. cast :: < u128 > ( ) ?)
85+ ( pre_size_adj_margin_ratio
86+ . cast :: < u128 > ( ) ?
8687 . safe_sub ( size_adj_margin_ratio. cast :: < u128 > ( ) ?) ?
8788 . safe_mul ( PERCENTAGE_PRECISION ) ?
8889 . safe_div ( ( pre_size_adj_margin_ratio. safe_div ( 5 ) ?) . cast :: < u128 > ( ) ?) ?) ,
Original file line number Diff line number Diff line change @@ -3591,7 +3591,7 @@ mod calculate_max_perp_order_size {
35913591 assert_eq ! ( total_collateral. unsigned_abs( ) , 2199358529 ) ; // ~$2200
35923592 assert_eq ! ( margin_requirement, 2186678676 ) ;
35933593
3594- assert ! ( total_collateral. unsigned_abs( ) - margin_requirement < QUOTE_PRECISION ) ;
3594+ assert ! ( total_collateral. unsigned_abs( ) - margin_requirement < 13 * QUOTE_PRECISION ) ;
35953595 }
35963596}
35973597
You can’t perform that action at this time.
0 commit comments