File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use abi_stable::std_types::{
99} ;
1010use anchor_lang:: prelude:: { AccountInfo , AccountLoader } ;
1111use drift_program:: {
12- controller:: position:: PositionDirection ,
12+ controller:: { position:: PositionDirection , repeg :: _update_amm } ,
1313 math:: { self , amm:: calculate_amm_available_liquidity, margin:: MarginRequirementType } ,
1414 state:: {
1515 oracle:: { get_oracle_price as get_oracle_price_, OraclePriceData , OracleSource } ,
@@ -149,6 +149,26 @@ pub extern "C" fn math_calculate_margin_requirement_and_total_collateral_and_lia
149149 to_ffi_result ( m)
150150}
151151
152+ #[ no_mangle]
153+ pub extern "C" fn simulate_update_amm (
154+ market : & mut PerpMarket ,
155+ state : & State ,
156+ mm_oracle_price_data : MMOraclePriceData ,
157+ now : u64 ,
158+ slot : Slot ,
159+ ) -> FfiResult < compat:: i128 > {
160+ to_ffi_result (
161+ _update_amm (
162+ market,
163+ & unsafe { std:: mem:: transmute ( mm_oracle_price_data) } ,
164+ state,
165+ now as i64 ,
166+ slot,
167+ )
168+ . map ( |x| x. into ( ) ) ,
169+ )
170+ }
171+
152172#[ no_mangle]
153173pub extern "C" fn math_calculate_base_asset_amount_for_amm_to_fulfill (
154174 order : & Order ,
You can’t perform that action at this time.
0 commit comments