Skip to content

Commit

Permalink
Merge pull request #66 from Giveth/916_filter_donations_to_giveth_com…
Browse files Browse the repository at this point in the history
…munity_project_more_than_a_limit

Return donations more than 0.05$ from giveth community project
  • Loading branch information
mohammadranjbarz authored Feb 5, 2025
2 parents cda892b + 5baa7f1 commit d6163d9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,18 @@ export const getBlockByTimestamp = async (timestamp: number, chainId: number) :P
}

export const isDonationAmountValid = (params: {
donation: GivethIoDonation, minEligibleValueUsd: number, givethCommunityProjectSlug:string
donation: GivethIoDonation,
minEligibleValueUsd: number,
givethCommunityProjectSlug: string
}): boolean => {
const { donation, minEligibleValueUsd, givethCommunityProjectSlug } = params
return donation.valueUsd >= minEligibleValueUsd || donation.project.slug === givethCommunityProjectSlug
}
const { donation, minEligibleValueUsd, givethCommunityProjectSlug } = params;

// Check if donation is to the specified Giveth community project
if (donation.project.slug === givethCommunityProjectSlug) {
// https://github.com/Giveth/GIVeconomy/issues/916
return donation.valueUsd > 0.05; // Only consider if value is greater than $0.05
}

// For all other projects, use the minEligibleValueUsd check
return donation.valueUsd >= minEligibleValueUsd;
};

0 comments on commit d6163d9

Please sign in to comment.