From c74132aa4c941b8b40294716e6d249380aa325c6 Mon Sep 17 00:00:00 2001 From: Dorin Marian Iancu Date: Mon, 9 Oct 2023 13:39:40 +0300 Subject: [PATCH 1/2] opt caller arg --- locked-asset/proxy_dex/Cargo.toml | 6 +- .../proxy_dex/src/farm_interactions.rs | 12 +-- locked-asset/proxy_dex/src/lib.rs | 5 +- ...{sc_whitelist.rs => other_sc_whitelist.rs} | 2 +- locked-asset/proxy_dex/src/proxy_farm.rs | 80 ++++++++++++++----- locked-asset/proxy_dex/src/proxy_pair.rs | 4 +- .../proxy_dex/src/wrapped_farm_token_merge.rs | 2 +- .../tests/proxy_dex_test_setup/mod.rs | 2 +- .../proxy_dex/tests/proxy_farm_test.rs | 47 +++++++---- 9 files changed, 106 insertions(+), 54 deletions(-) rename locked-asset/proxy_dex/src/{sc_whitelist.rs => other_sc_whitelist.rs} (97%) diff --git a/locked-asset/proxy_dex/Cargo.toml b/locked-asset/proxy_dex/Cargo.toml index 2bbeec0d2..bec88ca06 100644 --- a/locked-asset/proxy_dex/Cargo.toml +++ b/locked-asset/proxy_dex/Cargo.toml @@ -59,6 +59,9 @@ path = "../../energy-integration/common-modules/energy-query" [dependencies.simple-lock] path = "../simple-lock" +[dependencies.sc_whitelist_module] +path = "../../common/modules/sc_whitelist_module" + [dev-dependencies] num-bigint = "0.4.2" num-traits = "0.2" @@ -82,8 +85,5 @@ path = "../../common/modules/farm/farm_token" [dev-dependencies.rewards] path = "../../common/modules/farm/rewards" -[dev-dependencies.sc_whitelist_module] -path = "../../common/modules/sc_whitelist_module" - [dev-dependencies.farm-boosted-yields] path = "../../energy-integration/farm-boosted-yields" diff --git a/locked-asset/proxy_dex/src/farm_interactions.rs b/locked-asset/proxy_dex/src/farm_interactions.rs index 0ccabdb33..e1620f1d4 100644 --- a/locked-asset/proxy_dex/src/farm_interactions.rs +++ b/locked-asset/proxy_dex/src/farm_interactions.rs @@ -19,14 +19,14 @@ pub struct ExitFarmResultWrapper { pub trait FarmInteractionsModule { fn call_enter_farm( &self, + user: ManagedAddress, farm_address: ManagedAddress, farming_token_id: TokenIdentifier, farming_token_amount: BigUint, ) -> EnterFarmResultWrapper { - let original_caller = self.blockchain().get_caller(); let enter_farm_result: EnterFarmResultType = self .farm_contract_proxy(farm_address) - .enter_farm_endpoint(original_caller) + .enter_farm_endpoint(user) .with_esdt_transfer((farming_token_id, 0, farming_token_amount)) .execute_on_dest_context(); @@ -40,13 +40,13 @@ pub trait FarmInteractionsModule { fn call_exit_farm( &self, + user: ManagedAddress, farm_address: ManagedAddress, farm_token: EsdtTokenPayment, ) -> ExitFarmResultWrapper { - let original_caller = self.blockchain().get_caller(); let raw_result: ExitFarmWithPartialPosResultType = self .farm_contract_proxy(farm_address) - .exit_farm_endpoint(original_caller) + .exit_farm_endpoint(user) .with_esdt_transfer(farm_token) .execute_on_dest_context(); let (farming_tokens, reward_tokens) = raw_result.into_tuple(); @@ -59,13 +59,13 @@ pub trait FarmInteractionsModule { fn call_claim_rewards_farm( &self, + user: ManagedAddress, farm_address: ManagedAddress, farm_token: EsdtTokenPayment, ) -> ClaimRewardsResultWrapper { - let original_caller = self.blockchain().get_caller(); let raw_result: ClaimRewardsResultType = self .farm_contract_proxy(farm_address) - .claim_rewards_endpoint(original_caller) + .claim_rewards_endpoint(user) .with_esdt_transfer(farm_token) .execute_on_dest_context(); let (new_farm_token, rewards) = raw_result.into_tuple(); diff --git a/locked-asset/proxy_dex/src/lib.rs b/locked-asset/proxy_dex/src/lib.rs index 757f7d505..d81055288 100644 --- a/locked-asset/proxy_dex/src/lib.rs +++ b/locked-asset/proxy_dex/src/lib.rs @@ -13,7 +13,7 @@ pub mod pair_interactions; pub mod proxy_common; pub mod proxy_farm; pub mod proxy_pair; -pub mod sc_whitelist; +pub mod other_sc_whitelist; pub mod wrapped_farm_attributes; pub mod wrapped_farm_token_merge; pub mod wrapped_lp_attributes; @@ -22,7 +22,7 @@ pub mod wrapped_lp_token_merge; #[multiversx_sc::contract] pub trait ProxyDexImpl: proxy_common::ProxyCommonModule - + sc_whitelist::ScWhitelistModule + + crate::other_sc_whitelist::OtherScWhitelistModule + proxy_pair::ProxyPairModule + pair_interactions::PairInteractionsModule + proxy_farm::ProxyFarmModule @@ -37,6 +37,7 @@ pub trait ProxyDexImpl: + multiversx_sc_modules::default_issue_callbacks::DefaultIssueCallbacksModule + utils::UtilsModule + legacy_token_decode_module::LegacyTokenDecodeModule + + sc_whitelist_module::SCWhitelistModule { #[init] fn init( diff --git a/locked-asset/proxy_dex/src/sc_whitelist.rs b/locked-asset/proxy_dex/src/other_sc_whitelist.rs similarity index 97% rename from locked-asset/proxy_dex/src/sc_whitelist.rs rename to locked-asset/proxy_dex/src/other_sc_whitelist.rs index d89b767f8..5fe43bffd 100644 --- a/locked-asset/proxy_dex/src/sc_whitelist.rs +++ b/locked-asset/proxy_dex/src/other_sc_whitelist.rs @@ -1,7 +1,7 @@ multiversx_sc::imports!(); #[multiversx_sc::module] -pub trait ScWhitelistModule { +pub trait OtherScWhitelistModule { #[only_owner] #[endpoint(addPairToIntermediate)] fn add_pair_to_intermediate(&self, pair_address: ManagedAddress) { diff --git a/locked-asset/proxy_dex/src/proxy_farm.rs b/locked-asset/proxy_dex/src/proxy_farm.rs index d77e6d212..e21d4b0b4 100644 --- a/locked-asset/proxy_dex/src/proxy_farm.rs +++ b/locked-asset/proxy_dex/src/proxy_farm.rs @@ -12,18 +12,20 @@ use crate::{ wrapped_lp_attributes::WrappedLpTokenAttributes, }; -pub struct FarmingFarmTokenPair { +pub struct EnterFarmResult { pub farming_token: EsdtTokenPayment, pub farm_token: EsdtTokenPayment, + pub rewards: EsdtTokenPayment, } +pub type EnterFarmProxyResultType = MultiValue2, EsdtTokenPayment>; pub type ExitFarmProxyResultType = MultiValue2, EsdtTokenPayment>; pub type ClaimRewardsFarmProxyResultType = MultiValue2, EsdtTokenPayment>; #[multiversx_sc::module] pub trait ProxyFarmModule: crate::proxy_common::ProxyCommonModule - + crate::sc_whitelist::ScWhitelistModule + + crate::other_sc_whitelist::OtherScWhitelistModule + crate::proxy_pair::ProxyPairModule + crate::pair_interactions::PairInteractionsModule + crate::farm_interactions::FarmInteractionsModule @@ -36,30 +38,44 @@ pub trait ProxyFarmModule: + crate::events::EventsModule + utils::UtilsModule + legacy_token_decode_module::LegacyTokenDecodeModule + + sc_whitelist_module::SCWhitelistModule { #[payable("*")] #[endpoint(enterFarmProxy)] - fn enter_farm_proxy_endpoint(&self, farm_address: ManagedAddress) -> EsdtTokenPayment { + fn enter_farm_proxy_endpoint( + &self, + farm_address: ManagedAddress, + opt_original_caller: OptionalValue, + ) -> EnterFarmProxyResultType { self.require_is_intermediated_farm(&farm_address); self.require_wrapped_farm_token_id_not_empty(); self.require_wrapped_lp_token_id_not_empty(); let caller = self.blockchain().get_caller(); + let original_caller = self.get_orig_caller_from_opt(&caller, opt_original_caller); + let mut payments = self.get_non_empty_payments(); let proxy_farming_token = self.pop_first_payment(&mut payments); let wrapped_lp_token_id = self.wrapped_lp_token().get_token_id(); - let farm_farming_token_pair = if self.is_locked_token(&proxy_farming_token.token_identifier) - { - self.enter_farm_locked_token(farm_address.clone(), proxy_farming_token.clone()) + let enter_result = if self.is_locked_token(&proxy_farming_token.token_identifier) { + self.enter_farm_locked_token( + original_caller.clone(), + farm_address.clone(), + proxy_farming_token.clone(), + ) } else if proxy_farming_token.token_identifier == wrapped_lp_token_id { - self.enter_farm_wrapped_lp(farm_address.clone(), proxy_farming_token.clone()) + self.enter_farm_wrapped_lp( + original_caller.clone(), + farm_address.clone(), + proxy_farming_token.clone(), + ) } else { sc_panic!(INVALID_PAYMENTS_ERR_MSG) }; let new_token_attributes = WrappedFarmTokenAttributes { - farm_token: farm_farming_token_pair.farm_token, + farm_token: enter_result.farm_token, proxy_farming_token, }; @@ -72,7 +88,7 @@ pub trait ProxyFarmModule: self.send().esdt_local_burn_multi(&payments); self.merge_wrapped_farm_tokens_with_virtual_pos( - &caller, + &original_caller, farm_address.clone(), wrapped_lp_tokens, new_token_attributes, @@ -89,46 +105,51 @@ pub trait ProxyFarmModule: }; self.send_payment_non_zero(&caller, &new_wrapped_farm_token.payment); + self.send_payment_non_zero(&caller, &enter_result.rewards); self.emit_enter_farm_proxy_event( - &caller, + &original_caller, &farm_address, - farm_farming_token_pair.farming_token, + enter_result.farming_token, new_wrapped_farm_token.payment.clone(), new_wrapped_farm_token.attributes, token_merge_requested, ); - new_wrapped_farm_token.payment + (new_wrapped_farm_token.payment, enter_result.rewards).into() } fn enter_farm_locked_token( &self, + user: ManagedAddress, farm_address: ManagedAddress, locked_token: EsdtTokenPayment, - ) -> FarmingFarmTokenPair { + ) -> EnterFarmResult { let asset_token_id = self.get_base_token_id(); self.send() .esdt_local_mint(&asset_token_id, 0, &locked_token.amount); let minted_asset_tokens = EsdtTokenPayment::new(asset_token_id, 0, locked_token.amount); let enter_result = self.call_enter_farm( + user, farm_address, minted_asset_tokens.token_identifier.clone(), minted_asset_tokens.amount.clone(), ); - FarmingFarmTokenPair { + EnterFarmResult { farming_token: minted_asset_tokens, farm_token: enter_result.farm_token, + rewards: enter_result.reward_token, } } fn enter_farm_wrapped_lp( &self, + user: ManagedAddress, farm_address: ManagedAddress, wrapped_lp_token: EsdtTokenPayment, - ) -> FarmingFarmTokenPair { + ) -> EnterFarmResult { let wrapped_lp_token_mapper = self.wrapped_lp_token(); let wrapped_lp_attributes: WrappedLpTokenAttributes = self .get_attributes_as_part_of_fixed_supply(&wrapped_lp_token, &wrapped_lp_token_mapper); @@ -139,20 +160,26 @@ pub trait ProxyFarmModule: wrapped_lp_attributes.lp_token_amount, ); let enter_result = self.call_enter_farm( + user, farm_address, farming_token.token_identifier.clone(), farming_token.amount.clone(), ); - FarmingFarmTokenPair { + EnterFarmResult { farming_token, farm_token: enter_result.farm_token, + rewards: enter_result.reward_token, } } #[payable("*")] #[endpoint(exitFarmProxy)] - fn exit_farm_proxy(&self, farm_address: ManagedAddress) -> ExitFarmProxyResultType { + fn exit_farm_proxy( + &self, + farm_address: ManagedAddress, + opt_original_caller: OptionalValue, + ) -> ExitFarmProxyResultType { self.require_is_intermediated_farm(&farm_address); self.require_wrapped_farm_token_id_not_empty(); self.require_wrapped_lp_token_id_not_empty(); @@ -169,7 +196,12 @@ pub trait ProxyFarmModule: full_wrapped_farm_attributes .clone() .into_part(&payment.amount); + + let caller = self.blockchain().get_caller(); + let original_caller = self.get_orig_caller_from_opt(&caller, opt_original_caller); + let exit_result = self.call_exit_farm( + original_caller.clone(), farm_address.clone(), wrapped_farm_attributes_for_exit.farm_token.clone(), ); @@ -181,10 +213,9 @@ pub trait ProxyFarmModule: attributes: wrapped_farm_attributes_for_exit.clone(), }; - let caller = self.blockchain().get_caller(); let initial_proxy_farming_tokens = self .handle_farm_penalty_and_get_output_proxy_farming_token( - &caller, + &original_caller, wrapped_farm_tokens_for_initial_tokens, exit_result.farming_tokens.amount, ); @@ -195,7 +226,7 @@ pub trait ProxyFarmModule: wrapped_farm_token_mapper.nft_burn(payment.token_nonce, &payment.amount); self.emit_exit_farm_proxy_event( - &caller, + &original_caller, &farm_address, payment, wrapped_farm_attributes_for_exit, @@ -262,6 +293,7 @@ pub trait ProxyFarmModule: fn claim_rewards_proxy( &self, farm_address: ManagedAddress, + opt_original_caller: OptionalValue, ) -> ClaimRewardsFarmProxyResultType { self.require_is_intermediated_farm(&farm_address); self.require_wrapped_farm_token_id_not_empty(); @@ -273,7 +305,12 @@ pub trait ProxyFarmModule: let wrapped_farm_attributes: WrappedFarmTokenAttributes = self.get_attributes_as_part_of_fixed_supply(&payment, &wrapped_farm_token_mapper); + + let caller = self.blockchain().get_caller(); + let original_caller = self.get_orig_caller_from_opt(&caller, opt_original_caller); + let claim_result = self.call_claim_rewards_farm( + original_caller.clone(), farm_address.clone(), wrapped_farm_attributes.farm_token.clone(), ); @@ -286,12 +323,11 @@ pub trait ProxyFarmModule: let new_wrapped_token = wrapped_farm_token_mapper.nft_create(new_token_amount, &new_wrapped_farm_attributes); - let caller = self.blockchain().get_caller(); self.send_payment_non_zero(&caller, &new_wrapped_token); self.send_payment_non_zero(&caller, &claim_result.rewards); self.emit_claim_rewards_farm_proxy_event( - &caller, + &original_caller, &farm_address, payment, wrapped_farm_attributes, diff --git a/locked-asset/proxy_dex/src/proxy_pair.rs b/locked-asset/proxy_dex/src/proxy_pair.rs index e6a2f4d1b..1536f41cb 100644 --- a/locked-asset/proxy_dex/src/proxy_pair.rs +++ b/locked-asset/proxy_dex/src/proxy_pair.rs @@ -12,14 +12,14 @@ use fixed_supply_token::FixedSupplyToken; #[multiversx_sc::module] pub trait ProxyPairModule: crate::proxy_common::ProxyCommonModule - + crate::sc_whitelist::ScWhitelistModule + + crate::other_sc_whitelist::OtherScWhitelistModule + crate::pair_interactions::PairInteractionsModule + crate::wrapped_lp_token_merge::WrappedLpTokenMerge + crate::energy_update::EnergyUpdateModule + + crate::events::EventsModule + energy_query::EnergyQueryModule + token_merge_helper::TokenMergeHelperModule + token_send::TokenSendModule - + crate::events::EventsModule + utils::UtilsModule + legacy_token_decode_module::LegacyTokenDecodeModule { diff --git a/locked-asset/proxy_dex/src/wrapped_farm_token_merge.rs b/locked-asset/proxy_dex/src/wrapped_farm_token_merge.rs index f4052f337..5b071a2f1 100644 --- a/locked-asset/proxy_dex/src/wrapped_farm_token_merge.rs +++ b/locked-asset/proxy_dex/src/wrapped_farm_token_merge.rs @@ -13,7 +13,7 @@ use fixed_supply_token::FixedSupplyToken; pub trait WrappedFarmTokenMerge: token_merge_helper::TokenMergeHelperModule + token_send::TokenSendModule - + crate::sc_whitelist::ScWhitelistModule + + crate::other_sc_whitelist::OtherScWhitelistModule + crate::proxy_common::ProxyCommonModule + crate::wrapped_lp_token_merge::WrappedLpTokenMerge + utils::UtilsModule diff --git a/locked-asset/proxy_dex/tests/proxy_dex_test_setup/mod.rs b/locked-asset/proxy_dex/tests/proxy_dex_test_setup/mod.rs index c93cfc924..59da1640a 100644 --- a/locked-asset/proxy_dex/tests/proxy_dex_test_setup/mod.rs +++ b/locked-asset/proxy_dex/tests/proxy_dex_test_setup/mod.rs @@ -21,7 +21,7 @@ use multiversx_sc_scenario::{ }; use pair::{config::ConfigModule as OtherConfigModule, Pair}; use pausable::{PausableModule, State}; -use proxy_dex::{proxy_common::ProxyCommonModule, sc_whitelist::ScWhitelistModule, ProxyDexImpl}; +use proxy_dex::{proxy_common::ProxyCommonModule, other_sc_whitelist::OtherScWhitelistModule, ProxyDexImpl}; use sc_whitelist_module::SCWhitelistModule; use simple_lock::locked_token::{LockedTokenAttributes, LockedTokenModule}; diff --git a/locked-asset/proxy_dex/tests/proxy_farm_test.rs b/locked-asset/proxy_dex/tests/proxy_farm_test.rs index 9ea589340..4dc879dba 100644 --- a/locked-asset/proxy_dex/tests/proxy_farm_test.rs +++ b/locked-asset/proxy_dex/tests/proxy_farm_test.rs @@ -57,7 +57,7 @@ fn farm_proxy_actions_test() { 1, &rust_biguint!(USER_BALANCE), |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_addr)); + sc.enter_farm_proxy_endpoint(managed_address!(&farm_addr), OptionalValue::None); }, ) .assert_ok(); @@ -122,7 +122,7 @@ fn farm_proxy_actions_test() { 1, &rust_biguint!(USER_BALANCE / 2), |sc| { - sc.claim_rewards_proxy(managed_address!(&farm_addr)); + sc.claim_rewards_proxy(managed_address!(&farm_addr), OptionalValue::None); }, ) .assert_ok(); @@ -240,7 +240,7 @@ fn farm_proxy_actions_test() { 3, &rust_biguint!(USER_BALANCE), |sc| { - let output = sc.exit_farm_proxy(managed_address!(&farm_addr)); + let output = sc.exit_farm_proxy(managed_address!(&farm_addr), OptionalValue::None); let output_lp_token = output.0 .0; assert_eq!(output_lp_token.token_nonce, 1); assert_eq!(output_lp_token.amount, USER_BALANCE); @@ -375,7 +375,10 @@ fn farm_with_wrapped_lp_test() { 1, &expected_lp_token_amount, |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_locked_addr)); + sc.enter_farm_proxy_endpoint( + managed_address!(&farm_locked_addr), + OptionalValue::None, + ); }, ) .assert_ok(); @@ -443,7 +446,7 @@ fn farm_with_wrapped_lp_test() { 1, &(expected_lp_token_amount.clone() / rust_biguint!(2)), |sc| { - sc.exit_farm_proxy(managed_address!(&farm_locked_addr)); + sc.exit_farm_proxy(managed_address!(&farm_locked_addr), OptionalValue::None); }, ) .assert_ok(); @@ -545,7 +548,10 @@ fn farm_proxy_claim_energy_test() { 1, &rust_biguint!(USER_BALANCE), |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_locked_addr)); + sc.enter_farm_proxy_endpoint( + managed_address!(&farm_locked_addr), + OptionalValue::None, + ); }, ) .assert_ok(); @@ -619,7 +625,7 @@ fn farm_proxy_claim_energy_test() { 1, &rust_biguint!(USER_BALANCE), |sc| { - sc.claim_rewards_proxy(managed_address!(&farm_locked_addr)); + sc.claim_rewards_proxy(managed_address!(&farm_locked_addr), OptionalValue::None); }, ) .assert_ok(); @@ -680,7 +686,10 @@ fn farm_proxy_partial_exit_test() { 1, &rust_biguint!(USER_BALANCE), |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_locked_addr)); + sc.enter_farm_proxy_endpoint( + managed_address!(&farm_locked_addr), + OptionalValue::None, + ); }, ) .assert_ok(); @@ -756,7 +765,7 @@ fn farm_proxy_partial_exit_test() { 1, &rust_biguint!(USER_BALANCE / 2), |sc| { - sc.exit_farm_proxy(managed_address!(&farm_locked_addr)); + sc.exit_farm_proxy(managed_address!(&farm_locked_addr), OptionalValue::None); }, ) .assert_ok(); @@ -855,7 +864,10 @@ fn farm_proxy_partial_exit_with_penalty_test() { 1, &rust_biguint!(USER_BALANCE), |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_locked_addr)); + sc.enter_farm_proxy_endpoint( + managed_address!(&farm_locked_addr), + OptionalValue::None, + ); }, ) .assert_ok(); @@ -931,7 +943,7 @@ fn farm_proxy_partial_exit_with_penalty_test() { 1, &rust_biguint!(USER_BALANCE / 2), |sc| { - sc.exit_farm_proxy(managed_address!(&farm_locked_addr)); + sc.exit_farm_proxy(managed_address!(&farm_locked_addr), OptionalValue::None); }, ) .assert_ok(); @@ -1042,7 +1054,7 @@ fn different_farm_locked_token_nonce_merging_test() { 1, &rust_biguint!(USER_BALANCE), |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_addr)); + sc.enter_farm_proxy_endpoint(managed_address!(&farm_addr), OptionalValue::None); }, ) .assert_ok(); @@ -1056,7 +1068,7 @@ fn different_farm_locked_token_nonce_merging_test() { 2, &rust_biguint!(USER_BALANCE), |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_addr)); + sc.enter_farm_proxy_endpoint(managed_address!(&farm_addr), OptionalValue::None); }, ) .assert_ok(); @@ -1149,7 +1161,7 @@ fn different_farm_locked_token_nonce_merging_test() { 3, &rust_biguint!(USER_BALANCE * 2), |sc| { - sc.exit_farm_proxy(managed_address!(&farm_addr)); + sc.exit_farm_proxy(managed_address!(&farm_addr), OptionalValue::None); }, ) .assert_ok(); @@ -1190,7 +1202,7 @@ fn increase_proxy_farm_lkmex_energy() { 1, &rust_biguint!(USER_BALANCE), |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_addr)); + sc.enter_farm_proxy_endpoint(managed_address!(&farm_addr), OptionalValue::None); }, ) .assert_ok(); @@ -1343,7 +1355,10 @@ fn increase_proxy_farm_proxy_lp_energy() { 1, &expected_lp_token_amount, |sc| { - sc.enter_farm_proxy_endpoint(managed_address!(&farm_locked_addr)); + sc.enter_farm_proxy_endpoint( + managed_address!(&farm_locked_addr), + OptionalValue::None, + ); }, ) .assert_ok(); From cd4d21b6e4cfc86292b6e1f5db0379cb2b5be3f7 Mon Sep 17 00:00:00 2001 From: Dorin Marian Iancu Date: Mon, 9 Oct 2023 13:42:05 +0300 Subject: [PATCH 2/2] clippy --- locked-asset/proxy_dex/src/proxy_farm.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/locked-asset/proxy_dex/src/proxy_farm.rs b/locked-asset/proxy_dex/src/proxy_farm.rs index e21d4b0b4..1d15c7528 100644 --- a/locked-asset/proxy_dex/src/proxy_farm.rs +++ b/locked-asset/proxy_dex/src/proxy_farm.rs @@ -193,9 +193,7 @@ pub trait ProxyFarmModule: .get_token_attributes(&payment.token_identifier, payment.token_nonce); let wrapped_farm_attributes_for_exit: WrappedFarmTokenAttributes = - full_wrapped_farm_attributes - .clone() - .into_part(&payment.amount); + full_wrapped_farm_attributes.into_part(&payment.amount); let caller = self.blockchain().get_caller(); let original_caller = self.get_orig_caller_from_opt(&caller, opt_original_caller);