Skip to content

Commit

Permalink
Farm staking proxy legacy SC interactions update
Browse files Browse the repository at this point in the history
  • Loading branch information
psorinionut committed Jul 3, 2024
1 parent 0932481 commit ee45c1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions legacy-contracts/farm-v-13/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TokenIdentifier>;
}

0 comments on commit ee45c1e

Please sign in to comment.