Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
ueco-jb committed Aug 21, 2024
1 parent 20bf8dc commit 4ffbd83
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 27 deletions.
2 changes: 1 addition & 1 deletion contracts/factory/src/tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn factory_successfully_inits_multihop() {

let multihop_address = factory.get_config().multihop_address;

assert!(multihop_address.to_string().len() != 0);
assert!(!multihop_address.to_string().is_empty());
}

#[test]
Expand Down
70 changes: 50 additions & 20 deletions contracts/factory/src/tests/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,26 @@ fn test_query_user_portfolio_with_stake() {
let user_1 = Address::generate(&env);
let user_2 = Address::generate(&env);

let mut token1 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token2 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token3 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token4 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token1 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);
let mut token2 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);
let mut token3 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);
let mut token4 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);

env.mock_all_auths();
env.budget().reset_unlimited();
Expand Down Expand Up @@ -682,14 +694,26 @@ fn test_query_user_portfolio_with_multiple_users_staking_in_multiple_liquidity_p
let user_1 = Address::generate(&env);
let user_2 = Address::generate(&env);

let mut token1 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token2 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token3 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token4 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token1 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);
let mut token2 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);
let mut token3 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);
let mut token4 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);

env.mock_all_auths();
env.budget().reset_unlimited();
Expand Down Expand Up @@ -1207,10 +1231,16 @@ fn test_query_user_portfolio_without_stake() {
let manager = Address::generate(&env);
let user_1 = Address::generate(&env);

let mut token1 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token2 =
token_contract::Client::new(&env, &env.register_stellar_asset_contract(admin.clone()));
let mut token1 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);
let mut token2 = token_contract::Client::new(
&env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
);

env.mock_all_auths();
env.budget().reset_unlimited();
Expand Down
6 changes: 5 additions & 1 deletion contracts/multihop/src/tests/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ pub fn install_token_wasm(env: &Env) -> BytesN<32> {
}

pub fn deploy_token_contract<'a>(env: &Env, admin: &Address) -> token_contract::Client<'a> {
token_contract::Client::new(env, &env.register_stellar_asset_contract(admin.clone()))
token_contract::Client::new(
env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
)
}

#[allow(clippy::too_many_arguments)]
Expand Down
6 changes: 5 additions & 1 deletion contracts/pool/src/tests/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ use crate::{
use phoenix::utils::{LiquidityPoolInitInfo, StakeInitInfo, TokenInitInfo};

pub fn deploy_token_contract<'a>(env: &Env, admin: &Address) -> token_contract::Client<'a> {
token_contract::Client::new(env, &env.register_stellar_asset_contract(admin.clone()))
token_contract::Client::new(
env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
)
}

pub fn install_token_wasm(env: &Env) -> BytesN<32> {
Expand Down
6 changes: 5 additions & 1 deletion contracts/pool_stable/src/tests/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ use crate::{
use phoenix::utils::{LiquidityPoolInitInfo, StakeInitInfo, TokenInitInfo};

pub fn deploy_token_contract<'a>(env: &Env, admin: &Address) -> token_contract::Client<'a> {
token_contract::Client::new(env, &env.register_stellar_asset_contract(admin.clone()))
token_contract::Client::new(
env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
)
}

pub fn install_token_wasm(env: &Env) -> BytesN<32> {
Expand Down
6 changes: 5 additions & 1 deletion contracts/stake/src/tests/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ use crate::{
};

pub fn deploy_token_contract<'a>(env: &Env, admin: &Address) -> token_contract::Client<'a> {
token_contract::Client::new(env, &env.register_stellar_asset_contract(admin.clone()))
token_contract::Client::new(
env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
)
}

#[allow(clippy::too_many_arguments)]
Expand Down
6 changes: 5 additions & 1 deletion contracts/stake_rewards/src/tests/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ use crate::{
};

pub fn deploy_token_contract<'a>(env: &Env, admin: &Address) -> token_contract::Client<'a> {
token_contract::Client::new(env, &env.register_stellar_asset_contract(admin.clone()))
token_contract::Client::new(
env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
)
}

const MIN_BOND: i128 = 1000;
Expand Down
6 changes: 5 additions & 1 deletion contracts/vesting/src/tests/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ pub fn instantiate_vesting_client(env: &Env) -> VestingClient {
}

pub fn deploy_token_contract<'a>(env: &Env, admin: &Address) -> token_contract::Client<'a> {
token_contract::Client::new(env, &env.register_stellar_asset_contract(admin.clone()))
token_contract::Client::new(
env,
&env.register_stellar_asset_contract_v2(admin.clone())
.address(),
)
}

0 comments on commit 4ffbd83

Please sign in to comment.