Skip to content

Commit

Permalink
Fixed some of the swap issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Sk8erboi84 committed Mar 30, 2024
1 parent 63b22e2 commit 311c5ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/market/market_utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2831,6 +2831,7 @@ fn validate_market_token_balance_with_token(
.balance_of(market.market_token)
.low
.into();
'Issue here'.print();
let expected_min_balance: u256 = get_expected_min_token_balance(data_store, market, token);

assert(balance >= expected_min_balance, MarketError::INVALID_MARKET_TOKEN_BALANCE);
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/swap_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,19 @@ fn test_deposit_market_integration() {

// Set params in data_store
data_store.set_address(keys::fee_token(), market.index_token);
data_store.set_u128(keys::max_swap_path_length(), 5);
data_store.set_u256(keys::max_swap_path_length(), 5);

// Set max pool amount.
data_store
.set_u128(
.set_u256(
keys::max_pool_amount_key(market.market_token, market.long_token), 500000000000000000
);
data_store
.set_u128(
.set_u256(
keys::max_pool_amount_key(market.market_token, market.short_token), 500000000000000000
);

oracle.set_price_testing_eth(5000);
// Fill the pool.
IERC20Dispatcher { contract_address: market.long_token }.mint(market.market_token, 50000000000);
IERC20Dispatcher { contract_address: market.short_token }
Expand Down Expand Up @@ -684,7 +685,7 @@ fn deploy_role_store() -> ContractAddress {
let caller_address: ContractAddress = contract_address_const::<'caller'>();
let deployed_contract_address = contract_address_const::<'role_store'>();
start_prank(deployed_contract_address, caller_address);
contract.deploy_at(@array![], deployed_contract_address).unwrap()
contract.deploy_at(@array![caller_address.into()], deployed_contract_address).unwrap()
}

fn deploy_event_emitter() -> ContractAddress {
Expand Down

0 comments on commit 311c5ed

Please sign in to comment.