Skip to content

Commit

Permalink
fix proof capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
cjinghong committed May 24, 2024
1 parent ae535b2 commit 1e128b0
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions governance/src/hooks/airdrop/useAirdrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,29 @@ const getProof = (account: string) => {
? (ProofData as AirdropProof)
: (ProofTestnetData as AirdropProof);

// lowercased all claims
const proofClaims = Object.keys(proof.claims).reduce((prev, address) => {
return {
...prev,
[address.toLowerCase()]: proof.claims[address]
}
}, proof.claims)
proof.claims = proofClaims

const missedProof = isProduction()
? (ProofData2 as AirdropProof)
: (ProofTestnetData as AirdropProof);

const isMissedAccount = !proof.claims[account] && missedProof.claims[account];
// lowercased all claims
const missedProofClaims = Object.keys(missedProof.claims).reduce((prev, address) => {
return {
...prev,
[address.toLowerCase()]: missedProof.claims[address]
}
}, missedProof.claims)
missedProof.claims = missedProofClaims

const isMissedAccount = !Boolean(proof.claims[account.toLowerCase()]) && Boolean(missedProof.claims[account.toLowerCase()]);

return {
merkleProof: isMissedAccount ? missedProof : proof,
Expand Down Expand Up @@ -100,7 +118,7 @@ const useAirdrop = () => {
return;
}

const airdropClaim = proof.merkleProof.claims[account];
const airdropClaim = proof.merkleProof.claims[account.toLowerCase()];
const totalBn = BigNumber.from(airdropClaim?.amount || 0);
const total = parseFloat(formatUnits(totalBn, rbnDecimals));

Expand Down

0 comments on commit 1e128b0

Please sign in to comment.