Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix proof capitalization #731

Merged
merged 2 commits into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions governance/src/hooks/airdrop/useAirdrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,34 @@ 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 +123,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
Loading