File tree Expand file tree Collapse file tree 4 files changed +62
-1
lines changed
Expand file tree Collapse file tree 4 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ use phoenix::quantities::WrapperU64;
99use pyth_solana_receiver_sdk:: cpi:: accounts:: InitPriceUpdate ;
1010use pyth_solana_receiver_sdk:: program:: PythSolanaReceiver ;
1111use serum_dex:: state:: ToAlignedBytes ;
12- use solana_program:: sysvar:: SysvarId ;
1312
1413use crate :: controller:: token:: close_vault;
1514use crate :: error:: ErrorCode ;
@@ -4843,6 +4842,14 @@ pub fn handle_update_if_rebalance_config(
48434842 Ok ( ( ) )
48444843}
48454844
4845+ pub fn handle_zero_mm_oracle_fields ( ctx : Context < HotAdminUpdatePerpMarket > ) -> Result < ( ) > {
4846+ let mut perp_market = load_mut ! ( ctx. accounts. perp_market) ?;
4847+ perp_market. amm . mm_oracle_price = 0 ;
4848+ perp_market. amm . mm_oracle_sequence_id = 0 ;
4849+ perp_market. amm . mm_oracle_slot = 0 ;
4850+ Ok ( ( ) )
4851+ }
4852+
48464853pub fn handle_update_mm_oracle_native ( accounts : & [ AccountInfo ] , data : & [ u8 ] ) -> Result < ( ) > {
48474854 // Verify this ix is allowed
48484855 let state = & accounts[ 3 ] . data . borrow ( ) ;
Original file line number Diff line number Diff line change @@ -1815,6 +1815,10 @@ pub mod drift {
18151815 ) -> Result < ( ) > {
18161816 handle_update_disable_bitflags_mm_oracle ( ctx, disable)
18171817 }
1818+
1819+ pub fn zero_mm_oracle_fields ( ctx : Context < HotAdminUpdatePerpMarket > ) -> Result < ( ) > {
1820+ handle_zero_mm_oracle_fields ( ctx)
1821+ }
18181822}
18191823
18201824#[ cfg( not( feature = "no-entrypoint" ) ) ]
Original file line number Diff line number Diff line change @@ -4578,4 +4578,33 @@ export class AdminClient extends DriftClient {
45784578 }
45794579 ) ;
45804580 }
4581+
4582+ public async zeroMMOracleFields (
4583+ marketIndex : number
4584+ ) : Promise < TransactionSignature > {
4585+ const zeroMMOracleFieldsIx = await this . getZeroMMOracleFieldsIx (
4586+ marketIndex
4587+ ) ;
4588+
4589+ const tx = await this . buildTransaction ( zeroMMOracleFieldsIx ) ;
4590+ const { txSig } = await this . sendTransaction ( tx , [ ] , this . opts ) ;
4591+
4592+ return txSig ;
4593+ }
4594+ public async getZeroMMOracleFieldsIx (
4595+ marketIndex : number
4596+ ) : Promise < TransactionInstruction > {
4597+ return await this . program . instruction . zeroMmOracleFields ( {
4598+ accounts : {
4599+ admin : this . isSubscribed
4600+ ? this . getStateAccount ( ) . admin
4601+ : this . wallet . publicKey ,
4602+ state : await this . getStatePublicKey ( ) ,
4603+ perpMarket : await getPerpMarketPublicKey (
4604+ this . program . programId ,
4605+ marketIndex
4606+ ) ,
4607+ } ,
4608+ } ) ;
4609+ }
45814610}
Original file line number Diff line number Diff line change 75507550 "type" : " bool"
75517551 }
75527552 ]
7553+ },
7554+ {
7555+ "name" : " zeroMmOracleFields" ,
7556+ "accounts" : [
7557+ {
7558+ "name" : " admin" ,
7559+ "isMut" : false ,
7560+ "isSigner" : true
7561+ },
7562+ {
7563+ "name" : " state" ,
7564+ "isMut" : false ,
7565+ "isSigner" : false
7566+ },
7567+ {
7568+ "name" : " perpMarket" ,
7569+ "isMut" : true ,
7570+ "isSigner" : false
7571+ }
7572+ ],
7573+ "args" : []
75537574 }
75547575 ],
75557576 "accounts" : [
You can’t perform that action at this time.
0 commit comments