diff --git a/programs/mango-v4/tests/cases/test_collateral_fees.rs b/programs/mango-v4/tests/cases/test_collateral_fees.rs index 1ee9d8fa5..c4d852f7f 100644 --- a/programs/mango-v4/tests/cases/test_collateral_fees.rs +++ b/programs/mango-v4/tests/cases/test_collateral_fees.rs @@ -1,5 +1,8 @@ #![allow(unused_assignments)] + use super::*; +use anchor_spl::token::accessor::mint; +use std::collections::HashMap; #[tokio::test] async fn test_collateral_fees() -> Result<(), TransportError> { @@ -10,11 +13,17 @@ async fn test_collateral_fees() -> Result<(), TransportError> { let owner = context.users[0].key; let payer = context.users[1].key; let mints = &context.mints[0..2]; + let mut prices = HashMap::new(); + + // 1 unit = 1$ + prices.insert(mints[0].pubkey, 1_000_000f64); + prices.insert(mints[1].pubkey, 1_000_000f64); let mango_setup::GroupWithTokens { group, tokens, .. } = mango_setup::GroupWithTokensConfig { admin, payer, mints: mints.to_vec(), + prices: prices, ..mango_setup::GroupWithTokensConfig::default() } .create(solana) diff --git a/programs/mango-v4/tests/program_test/mango_setup.rs b/programs/mango-v4/tests/program_test/mango_setup.rs index ebd5558c0..cf05c1d0f 100644 --- a/programs/mango-v4/tests/program_test/mango_setup.rs +++ b/programs/mango-v4/tests/program_test/mango_setup.rs @@ -1,6 +1,7 @@ #![allow(dead_code)] use anchor_lang::prelude::*; +use std::collections::HashMap; use super::mango_client::*; use super::solana::SolanaCookie; @@ -11,6 +12,7 @@ pub struct GroupWithTokensConfig { pub admin: TestKeypair, pub payer: TestKeypair, pub mints: Vec, + pub prices: HashMap, pub zero_token_is_quote: bool, } @@ -38,6 +40,7 @@ impl<'a> GroupWithTokensConfig { admin, payer, mints, + prices, zero_token_is_quote, } = self; let create_group_accounts = send_tx( @@ -74,7 +77,7 @@ impl<'a> GroupWithTokensConfig { group, admin, mint: mint.pubkey, - price: 1.0, + price: prices.get(&mint.pubkey).copied().unwrap_or(1.0f64), oracle, }, )