Skip to content

Commit

Permalink
Change SWB pull oracle to the actual mainnet key (was using swb v2 ke…
Browse files Browse the repository at this point in the history
…y incorrectly)
  • Loading branch information
jgur-psyops committed Aug 19, 2024
1 parent 9eae066 commit 4dfbb0e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions programs/marginfi/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ cfg_if::cfg_if! {
}
}

// TODO add localnet/devnet
pub const SWITCHBOARD_PULL_ID: Pubkey = pubkey!("SBondMDrcV3K4kxZR1HNVT7osZxAHVHgYXL5Ze1oMUv");

/// TODO: Make these variable per bank
pub const LIQUIDATION_LIQUIDATOR_FEE: I80F48 = I80F48!(0.025);
pub const LIQUIDATION_INSURANCE_FEE: I80F48 = I80F48!(0.025);
Expand Down
8 changes: 4 additions & 4 deletions programs/marginfi/src/state/price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
check,
constants::{
CONF_INTERVAL_MULTIPLE, EXP_10, EXP_10_I80F48, MAX_CONF_INTERVAL,
MIN_PYTH_PUSH_VERIFICATION_LEVEL, PYTH_ID, STD_DEV_MULTIPLE,
MIN_PYTH_PUSH_VERIFICATION_LEVEL, PYTH_ID, STD_DEV_MULTIPLE, SWITCHBOARD_PULL_ID,
},
debug, math_error,
prelude::*,
Expand Down Expand Up @@ -320,7 +320,7 @@ impl SwitchboardPullPriceFeed {
let ai_data = ai.data.borrow();

check!(
ai.owner.eq(&switchboard_on_demand::SWITCHBOARD_PROGRAM_ID),
ai.owner.eq(&SWITCHBOARD_PULL_ID),
MarginfiError::InvalidOracleAccount
);

Expand All @@ -342,7 +342,7 @@ impl SwitchboardPullPriceFeed {
let ai_data = ai.data.borrow();

check!(
ai.owner.eq(&switchboard_on_demand::SWITCHBOARD_PROGRAM_ID),
ai.owner.eq(&SWITCHBOARD_PULL_ID),
MarginfiError::InvalidOracleAccount
);

Expand Down Expand Up @@ -1210,7 +1210,7 @@ mod tests {
Account {
lamports: 1_000_000,
data,
owner: switchboard_on_demand::SWITCHBOARD_PROGRAM_ID,
owner: SWITCHBOARD_PULL_ID,
executable: false,
rent_epoch: 361,
}
Expand Down
3 changes: 2 additions & 1 deletion test-utils/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use anchor_lang::prelude::*;
use anchor_lang_29::Discriminator;
use anchor_spl::token_2022::spl_token_2022::extension::transfer_fee::MAX_FEE_BASIS_POINTS;
use marginfi::constants::PYTH_ID;
use marginfi::constants::SWITCHBOARD_PULL_ID;
use pyth_sdk_solana::state::{
AccountType, PriceInfo, PriceStatus, Rational, SolanaPriceAccount, MAGIC, VERSION_2,
};
Expand Down Expand Up @@ -152,7 +153,7 @@ pub fn create_switch_pull_oracle_account_from_bytes(data: Vec<u8>) -> Account {
Account {
lamports: 1_000_000,
data,
owner: switchboard_on_demand::SWITCHBOARD_PROGRAM_ID,
owner: SWITCHBOARD_PULL_ID,
executable: false,
rent_epoch: 361,
}
Expand Down

0 comments on commit 4dfbb0e

Please sign in to comment.