Skip to content

Commit

Permalink
cargo fmt --
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Dec 10, 2024
1 parent c1d7c26 commit a2dc4df
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions programs/drift/src/instructions/keeper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,13 @@ pub fn handle_log_user_balances<'c: 'info, 'info>(
let (equity, _) =
calculate_user_equity(&user, &perp_market_map, &spot_market_map, &mut oracle_map)?;

msg!("Authority key {} subaccount id {} user key {}", user.authority, user.sub_account_id, user_key);

msg!(
"Authority key {} subaccount id {} user key {}",
user.authority,
user.sub_account_id,
user_key
);

msg!("Equity {}", equity);

for spot_position in user.spot_positions.iter() {
Expand All @@ -482,14 +487,23 @@ pub fn handle_log_user_balances<'c: 'info, 'info>(

let spot_market = spot_market_map.get_ref(&spot_position.market_index)?;
let token_amount = spot_position.get_signed_token_amount(&spot_market)?;
msg!("Spot position {} balance {}", spot_position.market_index, token_amount);
msg!(
"Spot position {} balance {}",
spot_position.market_index,
token_amount
);
}

for perp_position in user.perp_positions.iter() {
let perp_market = perp_market_map.get_ref(&perp_position.market_index)?;
let oracle_price = oracle_map.get_price_data(&perp_market.oracle_id())?.price;
let (_, unrealized_pnl) = calculate_base_asset_value_and_pnl_with_oracle_price(&perp_position, oracle_price)?;
msg!("Perp position {} unrealized pnl {}", perp_position.market_index, unrealized_pnl);
let (_, unrealized_pnl) =
calculate_base_asset_value_and_pnl_with_oracle_price(&perp_position, oracle_price)?;
msg!(
"Perp position {} unrealized pnl {}",
perp_position.market_index,
unrealized_pnl
);
}

Ok(())
Expand Down

0 comments on commit a2dc4df

Please sign in to comment.