Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Farm staking proxy legacy SC interactions update #930

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>;
}
Loading