Skip to content

Commit

Permalink
Merge pull request #646 from ElrondNetwork/add-farm-token-id-check
Browse files Browse the repository at this point in the history
  • Loading branch information
sasurobert authored Dec 8, 2022
2 parents 8b7ea4d + 3015924 commit 9d4de97
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dex/farm/src/claim_boost_only.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ pub trait ClaimBoostOnlyModule:
caller: &ManagedAddress,
payment: &EsdtTokenPayment,
) -> EsdtTokenPayment {
let reward_token_id = self.reward_token_id().get();
let farm_token_mapper = self.farm_token();
farm_token_mapper.require_same_token(&payment.token_identifier);

let token_attributes =
self.get_attributes_as_part_of_fixed_supply(payment, &self.farm_token());
self.get_attributes_as_part_of_fixed_supply(payment, &farm_token_mapper);
let reward = Wrapper::<Self>::calculate_boosted_rewards(
self,
caller,
Expand All @@ -49,6 +51,7 @@ pub trait ClaimBoostOnlyModule:
self.reward_reserve().update(|reserve| *reserve -= &reward);
}

let reward_token_id = self.reward_token_id().get();
EsdtTokenPayment::new(reward_token_id, 0, reward)
}
}

0 comments on commit 9d4de97

Please sign in to comment.