Skip to content

Commit

Permalink
Add Base Grantee badge (#993)
Browse files Browse the repository at this point in the history
  • Loading branch information
zencephalon committed Sep 10, 2024
1 parent 3af427d commit 5527605
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useReadContract } from 'wagmi';
import BuildathonSBT from 'apps/web/src/abis/BuildathonSBT';

const BASE_GRANT_NFT_ADDRESS = '0x1926a8090d558066ed26b6217e43d30493dc938e';

export default function useBaseGrant(address?: `0x${string}`): boolean {
const { data: balanceOf } = useReadContract({
address: BASE_GRANT_NFT_ADDRESS,
abi: BuildathonSBT,
functionName: 'balanceOf',
args: [address ?? '0x'],
query: {
enabled: !!address,
},
});

return balanceOf ? balanceOf > 0 : false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useCoinbaseVerification } from './hooks/useCoinbaseVerifications';
import { useTalentProtocol } from './hooks/useTalentProtocol';
import useBuildathonParticipant from './hooks/useBuildathon';
import { useMemo } from 'react';
import useBaseGrant from 'apps/web/src/components/Basenames/UsernameProfileSectionBadges/hooks/useBaseGrant';

function BadgesLoop({
badges,
Expand Down Expand Up @@ -70,15 +71,17 @@ function BuilderSection() {
const { badges, empty } = useBaseGuild(profileAddress);
const talentScore = useTalentProtocol(profileAddress);
const { isParticipant, isWinner } = useBuildathonParticipant(profileAddress);
const isBaseGrantee = useBaseGrant(profileAddress);

const combinedBadges = useMemo(
() => ({
...badges,
TALENT_SCORE: talentScore,
BUILDATHON_PARTICIPANT: isParticipant,
BUILDATHON_WINNER: isWinner,
BASE_GRANTEE: isBaseGrantee,
}),
[badges, talentScore, isParticipant, isWinner],
[badges, talentScore, isParticipant, isWinner, isBaseGrantee],
);
const combinedEmpty = empty && !talentScore;

Expand Down

0 comments on commit 5527605

Please sign in to comment.