Skip to content

Commit

Permalink
Pass through OracleGuardRails for margin calc
Browse files Browse the repository at this point in the history
  • Loading branch information
jordy25519 committed Sep 27, 2024
1 parent b51befc commit a5413ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub extern "C" fn math_calculate_margin_requirement_and_total_collateral_and_lia
let mut oracle_map = OracleMap::load(
&mut oracle_accounts.iter().peekable(),
accounts.latest_slot,
None,
accounts.oracle_guard_rails,
)
.unwrap();

Expand Down
5 changes: 3 additions & 2 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! cross-boundary FFI types
use abi_stable::std_types::RResult;
use drift_program::{
math::margin::MarginRequirementType, state::margin_calculation::MarginContext,
math::margin::MarginRequirementType,
state::{margin_calculation::MarginContext, state::OracleGuardRails},
};
use solana_sdk::{
account::Account,
Expand Down Expand Up @@ -44,11 +45,11 @@ impl<'a> IntoAccountInfo<'a> for &'a mut AccountWithKey {

/// FFI equivalent of an `AccountMap`
#[repr(C)]
#[derive(Debug)]
pub struct AccountsList<'a> {
pub perp_markets: &'a mut [AccountWithKey],
pub spot_markets: &'a mut [AccountWithKey],
pub oracles: &'a mut [AccountWithKey],
pub oracle_guard_rails: Option<OracleGuardRails>,
pub latest_slot: Slot,
}

Expand Down

0 comments on commit a5413ea

Please sign in to comment.