Skip to content

Commit

Permalink
Add position and tick params to mock_deps_with_querier_with_balance
Browse files Browse the repository at this point in the history
  • Loading branch information
lubkoll committed Aug 28, 2024
1 parent 6881074 commit 37b11e8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ impl Querier for QuasarQuerier {
}

pub fn mock_deps_with_querier_with_balance(
position_base_amount: u128,
position_quote_amount: u128,
current_tick: i64,
balances: &[(&str, &[Coin])],
) -> OwnedDeps<MockStorage, MockApi, QuasarQuerier, Empty> {
OwnedDeps {
Expand All @@ -183,11 +186,11 @@ pub fn mock_deps_with_querier_with_balance(
}),
asset0: Some(OsmoCoin {
denom: BASE_DENOM.to_string(),
amount: "1000000".to_string(),
amount: position_base_amount.to_string(),
}),
asset1: Some(OsmoCoin {
denom: QUOTE_DENOM.to_string(),
amount: "1000000".to_string(),
amount: position_quote_amount.to_string(),
}),
claimable_spread_rewards: vec![
OsmoCoin {
Expand All @@ -202,7 +205,7 @@ pub fn mock_deps_with_querier_with_balance(
claimable_incentives: vec![],
forfeited_incentives: vec![],
},
0,
current_tick,
balances,
),
custom_query_type: PhantomData,
Expand Down
13 changes: 9 additions & 4 deletions smart-contracts/osmosis/contracts/cl-vault/src/vault/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,15 @@ mod tests {
let info = mock_info("addr0000", &[]);
let env = mock_env();

let mut deps = mock_deps_with_querier_with_balance(&[(
MOCK_CONTRACT_ADDR,
&[coin(11000, BASE_DENOM), coin(11234, QUOTE_DENOM)],
)]);
let mut deps = mock_deps_with_querier_with_balance(
100_000,
100_000,
0,
&[(
MOCK_CONTRACT_ADDR,
&[coin(11000, BASE_DENOM), coin(11234, QUOTE_DENOM)],
)],
);
instantiate_contract(deps.as_mut(), env.clone(), info.sender.as_str());

MODIFY_RANGE_STATE
Expand Down
13 changes: 9 additions & 4 deletions smart-contracts/osmosis/contracts/cl-vault/src/vault/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,15 @@ mod tests {
#[test]
fn execute_withdraw_works_no_rewards() {
let info = mock_info("bolice", &[]);
let mut deps = mock_deps_with_querier_with_balance(&[(
MOCK_CONTRACT_ADDR,
&[coin(2000, BASE_DENOM), coin(3000, QUOTE_DENOM)],
)]);
let mut deps = mock_deps_with_querier_with_balance(
100_000,
100_000,
0,
&[(
MOCK_CONTRACT_ADDR,
&[coin(2000, BASE_DENOM), coin(3000, QUOTE_DENOM)],
)],
);
let env = mock_env();
instantiate_contract(deps.as_mut(), env.clone(), info.sender.as_str());

Expand Down

0 comments on commit 37b11e8

Please sign in to comment.