diff --git a/apps/contracts/integration-test/src/test/test_vault_one_fixed_strategy/test_deposit.rs b/apps/contracts/integration-test/src/test/test_vault_one_fixed_strategy/test_deposit.rs index 693ff7c8..0380d83c 100644 --- a/apps/contracts/integration-test/src/test/test_vault_one_fixed_strategy/test_deposit.rs +++ b/apps/contracts/integration-test/src/test/test_vault_one_fixed_strategy/test_deposit.rs @@ -49,7 +49,7 @@ fn test_fixed_apr_deposit_success() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let vault_balance = enviroment.token.balance(&enviroment.vault_contract.address); assert_eq!(vault_balance, deposit_amount); @@ -113,7 +113,7 @@ fn test_fixed_apr_deposit_insufficient_balance() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); } #[test] @@ -177,7 +177,7 @@ fn test_fixed_apr_deposit_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1, &false); enviroment.vault_contract .mock_auths(&[MockAuth { @@ -204,7 +204,7 @@ fn test_fixed_apr_deposit_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2, &false); let vault_balance = enviroment.token.balance(&enviroment.vault_contract.address); assert_eq!(vault_balance, deposit_amount * 2); @@ -250,6 +250,7 @@ fn test_fixed_apr_deposit_zero_amount() { &svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, + &false ); assert_eq!(result, Err(Ok(VaultContractError::InsufficientAmount))); @@ -282,6 +283,7 @@ fn test_fixed_apr_deposit_negative_amount() { &svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, + &false ); assert_eq!(result, Err(Ok(VaultContractError::NegativeNotAllowed))); @@ -314,6 +316,7 @@ fn test_fixed_apr_deposit_insufficient_minimum_liquidity() { &svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, + &false ); assert_eq!(result, Err(Ok(VaultContractError::InsufficientAmount))); diff --git a/apps/contracts/integration-test/src/test/test_vault_one_fixed_strategy/test_withdraw.rs b/apps/contracts/integration-test/src/test/test_vault_one_fixed_strategy/test_withdraw.rs index 708d05f4..97a91a63 100644 --- a/apps/contracts/integration-test/src/test/test_vault_one_fixed_strategy/test_withdraw.rs +++ b/apps/contracts/integration-test/src/test/test_vault_one_fixed_strategy/test_withdraw.rs @@ -46,7 +46,7 @@ fn test_fixed_apr_no_invest_withdraw_success() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); setup.env.ledger().set_timestamp(setup.env.ledger().timestamp() + ONE_YEAR_IN_SECONDS); @@ -128,7 +128,7 @@ fn test_fixed_apr_invest_withdraw_success() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let investments = svec![ &setup.env, diff --git a/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_deposit.rs b/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_deposit.rs index 3ae650b0..cd7a4eeb 100644 --- a/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_deposit.rs +++ b/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_deposit.rs @@ -49,7 +49,7 @@ fn test_deposit_success() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let vault_balance = enviroment.token.balance(&enviroment.vault_contract.address); assert_eq!(vault_balance, deposit_amount); @@ -113,7 +113,7 @@ fn test_deposit_insufficient_balance() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); } #[test] @@ -177,7 +177,7 @@ fn test_deposit_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1, &false); enviroment.vault_contract .mock_auths(&[MockAuth { @@ -204,7 +204,7 @@ fn test_deposit_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2, &false); let vault_balance = enviroment.token.balance(&enviroment.vault_contract.address); assert_eq!(vault_balance, deposit_amount * 2); @@ -250,6 +250,7 @@ fn test_deposit_zero_amount() { &svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, + &false ); assert_eq!(result, Err(Ok(VaultContractError::InsufficientAmount))); @@ -282,6 +283,7 @@ fn test_deposit_negative_amount() { &svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, + &false ); assert_eq!(result, Err(Ok(VaultContractError::NegativeNotAllowed))); @@ -314,6 +316,7 @@ fn test_deposit_insufficient_minimum_liquidity() { &svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, + &false ); assert_eq!(result, Err(Ok(VaultContractError::InsufficientAmount))); diff --git a/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_invest.rs b/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_invest.rs index 035faf50..faec6852 100644 --- a/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_invest.rs +++ b/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_invest.rs @@ -49,7 +49,7 @@ fn test_invest_success() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let df_balance = enviroment.vault_contract.balance(&user); assert_eq!(df_balance, deposit_amount - MINIMUM_LIQUIDITY); @@ -153,7 +153,7 @@ fn test_invest_exceeding_investing_lenght() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let df_balance = enviroment.vault_contract.balance(&user); assert_eq!(df_balance, deposit_amount - MINIMUM_LIQUIDITY); @@ -276,7 +276,7 @@ fn test_invest_insufficient_balance() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); } #[test] @@ -340,7 +340,7 @@ fn test_invest_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1, &false); enviroment.vault_contract .mock_auths(&[MockAuth { @@ -367,7 +367,7 @@ fn test_invest_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2, &false); let df_balance_user1 = enviroment.vault_contract.balance(&user1); let df_balance_user2 = enviroment.vault_contract.balance(&user2); diff --git a/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_withdraw.rs b/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_withdraw.rs index 057524ae..e3601633 100644 --- a/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_withdraw.rs +++ b/apps/contracts/integration-test/src/test/test_vault_one_hodl_strategy/test_withdraw.rs @@ -49,7 +49,7 @@ fn test_withdraw_no_invest_success() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let df_balance = enviroment.vault_contract.balance(&user); assert_eq!(df_balance, deposit_amount - MINIMUM_LIQUIDITY); @@ -133,7 +133,7 @@ fn test_withdraw_partial_success() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let df_balance = enviroment.vault_contract.balance(&user); assert_eq!(df_balance, deposit_amount - MINIMUM_LIQUIDITY); @@ -212,7 +212,7 @@ fn test_withdraw_insufficient_balance() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let df_balance = enviroment.vault_contract.balance(&user); assert_eq!(df_balance, deposit_amount - MINIMUM_LIQUIDITY); @@ -292,7 +292,7 @@ fn test_withdraw_after_invest() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user, &false); let user_balance_after_deposit = enviroment.token.balance(user); assert_eq!(user_balance_after_deposit, 0); @@ -445,7 +445,7 @@ fn test_withdraw_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1, &false); enviroment.vault_contract .mock_auths(&[MockAuth { @@ -472,7 +472,7 @@ fn test_withdraw_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2, &false); let df_balance_user1 = enviroment.vault_contract.balance(&user1); let df_balance_user2 = enviroment.vault_contract.balance(&user2); @@ -587,7 +587,7 @@ fn test_withdraw_after_invest_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user1, &false); enviroment.vault_contract .mock_auths(&[MockAuth { @@ -614,7 +614,7 @@ fn test_withdraw_after_invest_multiple_users() { ] }, }]) - .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2); + .deposit(&svec![&setup.env, deposit_amount], &svec![&setup.env, deposit_amount], &user2, &false); let df_balance_user1 = enviroment.vault_contract.balance(&user1); let df_balance_user2 = enviroment.vault_contract.balance(&user2); diff --git a/apps/contracts/vault/src/test/deposit.rs b/apps/contracts/vault/src/test/deposit.rs index 54217e6b..1b3e1648 100644 --- a/apps/contracts/vault/src/test/deposit.rs +++ b/apps/contracts/vault/src/test/deposit.rs @@ -773,6 +773,7 @@ fn deposit_amounts_min_greater_than_amounts_desired(){ &sorobanvec![&test.env, amount0, amount1], &sorobanvec![&test.env, amount0 + 1, amount1 + 1], &users[0], + &false ); // this should fail @@ -832,6 +833,7 @@ fn deposit_transfers_tokens_from_user_to_vault(){ &sorobanvec![&test.env, amount0, amount1], &sorobanvec![&test.env, amount0, amount1], &users[0], + &false ); // check balances after deposit @@ -888,6 +890,7 @@ fn test_deposit_arithmetic_error() { &sorobanvec![&test.env, large_amount], &sorobanvec![&test.env, large_amount], &users[0], + &false ); // Try to deposit a large amount @@ -895,6 +898,7 @@ fn test_deposit_arithmetic_error() { &sorobanvec![&test.env, large_amount], &sorobanvec![&test.env, large_amount], &users[0], + &false ); // Verify that the returned error is ContractError::ArithmeticError @@ -951,6 +955,7 @@ fn deposit_amounts_desired_zero() { &sorobanvec![&test.env, 0i128], &sorobanvec![&test.env, 0i128], &users[0], + &false ); // Verify that the returned error is ContractError::InsufficientAmount @@ -1014,6 +1019,7 @@ fn deposit_insufficient_funds_with_error_message() { &sorobanvec![&test.env, amount0 + 1, amount1 + 1], &sorobanvec![&test.env, amount0 + 1, amount1 + 1], &users[0], + &false ); if deposit_result == Err(Err(InvokeError::Contract(10))) { diff --git a/apps/contracts/vault/src/test/rebalance.rs b/apps/contracts/vault/src/test/rebalance.rs index 397c5c5d..19bb9cf4 100644 --- a/apps/contracts/vault/src/test/rebalance.rs +++ b/apps/contracts/vault/src/test/rebalance.rs @@ -147,6 +147,7 @@ fn rebalance_one_instruction() { &sorobanvec![&test.env, amount], &sorobanvec![&test.env, amount], &users[0], + &false ); let df_balance = test.defindex_contract.balance(&users[0]); @@ -226,6 +227,7 @@ fn rebalance_empty_instructions(){ &sorobanvec![&test.env, amount], &sorobanvec![&test.env, amount], &users[0], + &false ); let df_balance = test.defindex_contract.balance(&users[0]); assert_eq!(df_balance, amount - 1000); @@ -304,6 +306,7 @@ fn rebalance_no_instructions(){ &sorobanvec![&test.env, amount], &sorobanvec![&test.env, amount], &users[0], + &false ); let df_balance = test.defindex_contract.balance(&users[0]); assert_eq!(df_balance, amount - 1000); @@ -346,8 +349,9 @@ fn rebalance_insufficient_balance(){ &sorobanvec![&test.env, amount], &sorobanvec![&test.env, amount], &users[0], + &false ); - let df_balance = test.defindex_contract.balance(&users[0]); + let df_balance: i128 = test.defindex_contract.balance(&users[0]); assert_eq!(df_balance, amount - 1000); let withdraw_instructions = sorobanvec![