Skip to content

Commit

Permalink
farm supply on claim fix for farm with locked rew
Browse files Browse the repository at this point in the history
  • Loading branch information
psorinionut committed Aug 1, 2024
1 parent 2ca12e4 commit f668405
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions dex/farm-with-locked-rewards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,30 +127,19 @@ pub trait Farm:

self.migrate_old_farm_positions(&orig_caller);

let payments = self.call_value().all_esdt_transfers().clone_value();
let base_claim_rewards_result =
self.claim_rewards_base::<NoMintWrapper<Self>>(orig_caller.clone(), payments);
let output_farm_token_payment = base_claim_rewards_result.new_farm_token.payment.clone();
self.send_payment_non_zero(&caller, &output_farm_token_payment);
let claim_rewards_result = self.claim_rewards::<NoMintWrapper<Self>>(orig_caller.clone());

let rewards_payment = base_claim_rewards_result.rewards;
self.send_payment_non_zero(&caller, &claim_rewards_result.new_farm_token);

let rewards_payment = claim_rewards_result.rewards;
let locked_rewards_payment = self.send_to_lock_contract_non_zero(
rewards_payment.token_identifier,
rewards_payment.amount,
caller,
orig_caller.clone(),
);

self.emit_claim_rewards_event::<_, FarmTokenAttributes<Self::Api>>(
&orig_caller,
base_claim_rewards_result.context,
base_claim_rewards_result.new_farm_token,
locked_rewards_payment.clone(),
base_claim_rewards_result.created_with_merge,
base_claim_rewards_result.storage_cache,
orig_caller,
);

(output_farm_token_payment, locked_rewards_payment).into()
(claim_rewards_result.new_farm_token, locked_rewards_payment).into()
}

#[payable("*")]
Expand Down

0 comments on commit f668405

Please sign in to comment.