From 57826b02de4aaf24c3d81a2f74a7a2bcbb3f654c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20M=2E=20Gonz=C3=A1lez?= Date: Thu, 31 Oct 2024 15:26:43 -0300 Subject: [PATCH] Fixed Clippy errors. --- .../front-running-1/remediated-example/src/lib.rs | 14 +++++++------- .../front-running-1/vulnerable-example/src/lib.rs | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test-cases/front-running/front-running-1/remediated-example/src/lib.rs b/test-cases/front-running/front-running-1/remediated-example/src/lib.rs index 6795865a..64e123e2 100644 --- a/test-cases/front-running/front-running-1/remediated-example/src/lib.rs +++ b/test-cases/front-running/front-running-1/remediated-example/src/lib.rs @@ -70,11 +70,11 @@ mod tests { // Given let env = Env::default(); let admin = Address::generate(&env); - let token_contract_id = env.register_stellar_asset_contract(admin); + let asset_contract = env.register_stellar_asset_contract_v2(admin); let contract_id = env.register_contract(None, FrontRunning); let client = FrontRunningClient::new(&env, &contract_id); - client.init(&token_contract_id); + client.init(&asset_contract.address()); // When let from = Address::generate(&env); @@ -92,7 +92,7 @@ mod tests { from.clone(), AuthorizedInvocation { function: AuthorizedFunction::Contract(( - token_contract_id.clone(), + asset_contract.address().clone(), Symbol::new(&env, "approve"), (&from, &spender, 200_i128, 200_u32).into_val(&env) )), @@ -111,11 +111,11 @@ mod tests { // Given let env = Env::default(); let admin = Address::generate(&env); - let token_contract_id = env.register_stellar_asset_contract(admin); + let asset_contract = env.register_stellar_asset_contract_v2(admin); let contract_id = env.register_contract(None, FrontRunning); let client = FrontRunningClient::new(&env, &contract_id); - client.init(&token_contract_id); + client.init(&asset_contract.address()); // When let token_client = TokenClient::new(&env, &client.get_token()); @@ -147,11 +147,11 @@ mod tests { // Given let env = Env::default(); let admin = Address::generate(&env); - let token_contract_id = env.register_stellar_asset_contract(admin); + let asset_contract = env.register_stellar_asset_contract_v2(admin); let contract_id = env.register_contract(None, FrontRunning); let client = FrontRunningClient::new(&env, &contract_id); - client.init(&token_contract_id); + client.init(&asset_contract.address()); // When let token_client = TokenClient::new(&env, &client.get_token()); diff --git a/test-cases/front-running/front-running-1/vulnerable-example/src/lib.rs b/test-cases/front-running/front-running-1/vulnerable-example/src/lib.rs index b7fbf131..b836042a 100644 --- a/test-cases/front-running/front-running-1/vulnerable-example/src/lib.rs +++ b/test-cases/front-running/front-running-1/vulnerable-example/src/lib.rs @@ -69,11 +69,11 @@ mod tests { // Given let env = Env::default(); let admin = Address::generate(&env); - let token_contract_id = env.register_stellar_asset_contract(admin); + let asset_contract = env.register_stellar_asset_contract_v2(admin); let contract_id = env.register_contract(None, FrontRunning); let client = FrontRunningClient::new(&env, &contract_id); - client.init(&token_contract_id); + client.init(&asset_contract.address()); // When let from = Address::generate(&env); @@ -91,7 +91,7 @@ mod tests { from.clone(), AuthorizedInvocation { function: AuthorizedFunction::Contract(( - token_contract_id.clone(), + asset_contract.address().clone(), Symbol::new(&env, "approve"), (&from, &spender, 200_i128, 200_u32).into_val(&env) )), @@ -110,11 +110,11 @@ mod tests { // Given let env = Env::default(); let admin = Address::generate(&env); - let token_contract_id = env.register_stellar_asset_contract(admin); + let asset_contract = env.register_stellar_asset_contract_v2(admin); let contract_id = env.register_contract(None, FrontRunning); let client = FrontRunningClient::new(&env, &contract_id); - client.init(&token_contract_id); + client.init(&asset_contract.address()); // When let token_client = TokenClient::new(&env, &client.get_token());