@@ -2485,6 +2485,8 @@ fn kamino_deposit_or_withdraw(
2485
2485
///[ Solend Stuff ] //////////////////////////////////////////////////////////
2486
2486
//////////////////////////////////////////////////////////////////////////////
2487
2487
2488
+ const SOLEND_JLP_EXTRA_ORACLE : Pubkey = pubkey ! [ "BjUgj6YCnFBZ49wF54ddBVA9qu8TeqkFtkbqmZcee8uW" ] ;
2489
+
2488
2490
fn solend_load_reserve (
2489
2491
reserve_address : Pubkey ,
2490
2492
account_data_cache : & mut AccountDataCache ,
@@ -2498,18 +2500,27 @@ fn solend_load_reserve(
2498
2500
// read back the new reserve account data to ensure it's up to date
2499
2501
//
2500
2502
2503
+ let mut refresh_reserve_account_metas = vec ! [
2504
+ // Reserve
2505
+ AccountMeta :: new( reserve_address, false ) ,
2506
+ // Pyth Oracle
2507
+ AccountMeta :: new_readonly( rpc_reserve. liquidity. pyth_oracle_pubkey, false ) ,
2508
+ // Switchboard Oracle
2509
+ AccountMeta :: new_readonly( rpc_reserve. liquidity. switchboard_oracle_pubkey, false ) ,
2510
+ ] ;
2511
+
2512
+ // "Extra oracle" for solend-jlp's USDC reserve
2513
+ // TODO: Figure out how to determine `SOLEND_JLP_EXTRA_ORACLE` from on-chain data
2514
+ if reserve_address == pubkey ! [ "GShhnkfbaYy41Fd8vSEk9zoiwZSKqbH1j16jZ2afV2GG" ] {
2515
+ refresh_reserve_account_metas
2516
+ . push ( AccountMeta :: new_readonly ( SOLEND_JLP_EXTRA_ORACLE , false ) ) ;
2517
+ }
2518
+
2501
2519
// Instruction: Solend: Refresh Reserve
2502
2520
let instructions = vec ! [ Instruction :: new_with_bytes(
2503
2521
solend:: solend_mainnet:: ID ,
2504
2522
& [ 3 ] ,
2505
- vec![
2506
- // Reserve
2507
- AccountMeta :: new( reserve_address, false ) ,
2508
- // Pyth Oracle
2509
- AccountMeta :: new_readonly( rpc_reserve. liquidity. pyth_oracle_pubkey, false ) ,
2510
- // Switchboard Oracle
2511
- AccountMeta :: new_readonly( rpc_reserve. liquidity. switchboard_oracle_pubkey, false ) ,
2512
- ] ,
2523
+ refresh_reserve_account_metas,
2513
2524
) ] ;
2514
2525
2515
2526
account_data_cache. simulate_then_add ( & instructions, None , & [ ] ) ?;
@@ -2788,20 +2799,26 @@ fn solend_deposit_or_withdraw(
2788
2799
refresh_reserves. push ( ( market_reserve_address, reserve. clone ( ) ) ) ;
2789
2800
2790
2801
for ( reserve_address, reserve) in refresh_reserves {
2802
+ let mut refresh_reserve_account_metas = vec ! [
2803
+ // Reserve
2804
+ AccountMeta :: new( reserve_address, false ) ,
2805
+ // Pyth Oracle
2806
+ AccountMeta :: new_readonly( reserve. liquidity. pyth_oracle_pubkey, false ) ,
2807
+ // Switchboard Oracle
2808
+ AccountMeta :: new_readonly( reserve. liquidity. switchboard_oracle_pubkey, false ) ,
2809
+ ] ;
2810
+
2811
+ // "Extra oracle" for solend-jlp's USDC reserve
2812
+ // TODO: Figure out how to determine `SOLEND_JLP_EXTRA_ORACLE` from on-chain data
2813
+ if reserve_address == pubkey ! [ "GShhnkfbaYy41Fd8vSEk9zoiwZSKqbH1j16jZ2afV2GG" ] {
2814
+ refresh_reserve_account_metas
2815
+ . push ( AccountMeta :: new_readonly ( SOLEND_JLP_EXTRA_ORACLE , false ) ) ;
2816
+ }
2817
+
2791
2818
instructions. push ( Instruction :: new_with_bytes (
2792
2819
solend:: solend_mainnet:: ID ,
2793
2820
& [ 3 ] ,
2794
- vec ! [
2795
- // Reserve
2796
- AccountMeta :: new( reserve_address, false ) ,
2797
- // Pyth Oracle
2798
- AccountMeta :: new_readonly( reserve. liquidity. pyth_oracle_pubkey, false ) ,
2799
- // Switchboard Oracle
2800
- AccountMeta :: new_readonly(
2801
- reserve. liquidity. switchboard_oracle_pubkey,
2802
- false ,
2803
- ) ,
2804
- ] ,
2821
+ refresh_reserve_account_metas,
2805
2822
) ) ;
2806
2823
}
2807
2824
0 commit comments