From ee45c1e23fbee23fce5692fc81e319ce6c2046f7 Mon Sep 17 00:00:00 2001 From: Sorin Petreasca Date: Wed, 3 Jul 2024 21:44:44 +0300 Subject: [PATCH] Farm staking proxy legacy SC interactions update --- .../src/external_contracts_interactions.rs | 13 +++---------- legacy-contracts/farm-v-13/src/lib.rs | 4 ++++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/legacy-contracts/farm-staking-proxy-v-13/src/external_contracts_interactions.rs b/legacy-contracts/farm-staking-proxy-v-13/src/external_contracts_interactions.rs index 11c226cb8..9e6d3e49e 100644 --- a/legacy-contracts/farm-staking-proxy-v-13/src/external_contracts_interactions.rs +++ b/legacy-contracts/farm-staking-proxy-v-13/src/external_contracts_interactions.rs @@ -2,13 +2,10 @@ multiversx_sc::imports!(); use common_structs::{RawResultWrapper, RawResultsType}; use farm_staking::unstake_farm::ProxyTrait as _; -use multiversx_sc::storage::StorageKey; use pair::pair_actions::remove_liq::ProxyTrait as _; use crate::result_types::*; -pub static FARMING_TOKEN_STORAGE_KEY: &[u8] = b"farming_token_id"; - #[multiversx_sc::module] pub trait ExternalContractsInteractionsModule: crate::lp_farm_token::LpFarmTokenModule + token_merge_helper::TokenMergeHelperModule @@ -49,13 +46,9 @@ pub trait ExternalContractsInteractionsModule: fn get_lp_farming_token_identifier(&self) -> TokenIdentifier { let lp_farm_address = self.lp_farm_address().get(); - - let farming_token_mapper = SingleValueMapper::<_, _, ManagedAddress>::new_from_address( - lp_farm_address, - StorageKey::new(FARMING_TOKEN_STORAGE_KEY), - ); - - farming_token_mapper.get() + self.lp_farm_proxy_obj(lp_farm_address) + .farming_token_id() + .execute_on_dest_context() } // staking farm diff --git a/legacy-contracts/farm-v-13/src/lib.rs b/legacy-contracts/farm-v-13/src/lib.rs index 50f3bed11..4f1660e1d 100644 --- a/legacy-contracts/farm-v-13/src/lib.rs +++ b/legacy-contracts/farm-v-13/src/lib.rs @@ -55,4 +55,8 @@ pub trait FarmV13 { #[only_owner] #[endpoint] fn end_produce_rewards(&self) {} + + #[view(getFarmingTokenId)] + #[storage_mapper("farming_token_id")] + fn farming_token_id(&self) -> SingleValueMapper; }