Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cjinghong committed May 17, 2024
1 parent bc01701 commit be236be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
40 changes: 22 additions & 18 deletions governance/src/hooks/airdrop/useAirdrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export type AirdropBreakdownData = {
};
};


const airdropBreakdown = isProduction()
? (BreakdownData as AirdropBreakdownData)
: (BreakdownTestnetData as AirdropBreakdownData);
Expand All @@ -50,20 +49,20 @@ const rbnDecimals = getAssetDecimals("RBN");

const getProof = (account: string) => {
const proof = isProduction()
? (ProofData as AirdropProof)
: (ProofTestnetData as AirdropProof);
? (ProofData as AirdropProof)
: (ProofTestnetData as AirdropProof);

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

const isMissedAccount = !proof.claims[account] && missedProof.claims[account]
const isMissedAccount = !proof.claims[account] && missedProof.claims[account];

return {
merkleProof: isMissedAccount ? missedProof : proof,
isMissedAccount
}
}
isMissedAccount,
};
};

const useAirdrop = () => {
const web3Context = useWeb3Wallet();
Expand All @@ -77,21 +76,26 @@ const useAirdrop = () => {

const proof = useMemo(() => {
if (account) {
return getProof(account)
return getProof(account);
}
return undefined
}, [account])
return undefined;
}, [account]);

const merkleDistributor = useMemo(() => {
if (proof) {
const { isMissedAccount } = proof
return isMissedAccount ? contract2 : contract
const { isMissedAccount } = proof;
return isMissedAccount ? contract2 : contract;
}
return contract
}, [contract, contract2, proof])
return contract;
}, [contract, contract2, proof]);

const updateAirdropInfo = useCallback(async () => {
if (!proof || chainId !== CHAINID.ETH_MAINNET || !account || !merkleDistributor) {
if (
!proof ||
chainId !== CHAINID.ETH_MAINNET ||
!account ||
!merkleDistributor
) {
setAirdropInfo(undefined);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions governance/src/hooks/useMerkleDistributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getMerkleDistributor = (
const provider = ethereumProvider.getSigner();
return MerkleDistributorAdjustable__factory.connect(
isProduction()
? isMissedMerkleProof
? isMissedMerkleProof
? deployments.mainnet.MerkleDistributorStakingAirdrop2
: deployments.mainnet.MerkleDistributorStakingAirdrop
: deployments.sepolia.MerkleDistributorStakingAirdrop,
Expand All @@ -39,7 +39,7 @@ const useMerkleDistributor = () => {

return {
contract,
contract2
contract2,
};
};

Expand Down

0 comments on commit be236be

Please sign in to comment.