Skip to content

Commit

Permalink
Merge remote-tracking branch 'bitcountry/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
justinphamnz committed Mar 13, 2023
2 parents 4faa6ae + 190c09e commit db89c37
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pallets/reward/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,12 @@ pub mod pallet {
/// - `leaf_nodes`: list of the merkle tree nodes required for merkle-proof calculation.
///
/// Emits `RewardClaimed` if successful.
#[pallet::weight(T::WeightInfo::claim_nft_reward_root() * (1u64 + tokens.len() as u64))]
#[pallet::weight(T::WeightInfo::claim_nft_reward_root() * (1u64 + reward_tokens.len() as u64))]
#[transactional]
pub fn claim_nft_reward_root(
origin: OriginFor<T>,
id: CampaignId,
tokens: Vec<(ClassId, TokenId)>,
reward_tokens: Vec<(ClassId, TokenId)>,
leaf_nodes: Vec<Hash>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
Expand All @@ -639,7 +639,7 @@ pub mod pallet {
RewardType::NftAssets(reward) => match campaign.claimed.clone() {
RewardType::NftAssets(claimed) => {
let merkle_proof: Hash =
Self::calculate_nft_rewards_merkle_proof(&who, &tokens, &leaf_nodes)?;
Self::calculate_nft_rewards_merkle_proof(&who, &reward_tokens, &leaf_nodes)?;

ensure!(
Self::campaign_merkle_roots(id).contains(&merkle_proof),
Expand All @@ -650,7 +650,7 @@ pub mod pallet {
ensure!(!tokens.is_empty(), Error::<T>::NoRewardFound);

let mut new_claimed = claimed;
for token in tokens.clone() {
for token in reward_tokens.clone() {
ensure!(
reward.contains(&token) && !new_claimed.contains(&token),
Error::<T>::NoRewardFound
Expand All @@ -663,7 +663,7 @@ pub mod pallet {

campaign.claimed = RewardType::NftAssets(new_claimed);

Self::deposit_event(Event::<T>::NftRewardClaimed(id, who, tokens));
Self::deposit_event(Event::<T>::NftRewardClaimed(id, who, reward_tokens));
Ok(())
}
_ => Err(Error::<T>::InvalidCampaignType.into()),
Expand Down

0 comments on commit db89c37

Please sign in to comment.