Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Removed unnecessary claim type mapping const
Browse files Browse the repository at this point in the history
  • Loading branch information
L B committed Jan 3, 2022
1 parent f3fff57 commit 817f7ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
12 changes: 1 addition & 11 deletions src/custom/state/claim/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export * from './hooksMod'
// TODO: replace with real repo when known
export const CLAIMS_REPO = 'https://raw.githubusercontent.com/gnosis/cow-mrkl-drop-data-chunks/final/chunks/'

export const enum ClaimType {
export enum ClaimType {
Airdrop, // free, no vesting, can be available on both mainnet and gchain
GnoOption, // paid, with vesting, must use GNO, can be available on both mainnet and gchain
UserOption, // paid, with vesting, must use Native currency, can be available on both mainnet and gchain
Expand All @@ -33,16 +33,6 @@ export const enum ClaimType {

type RepoClaimType = keyof typeof ClaimType

// TODO: also, is there a smarter way of doing this?
export const REVERSE_CLAIM_TYPE_MAPPING: Record<RepoClaimType, ClaimType> = {
Airdrop: ClaimType.Airdrop,
GnoOption: ClaimType.GnoOption,
UserOption: ClaimType.UserOption,
Investor: ClaimType.Investor,
Team: ClaimType.Team,
Advisor: ClaimType.Advisor,
}

export const FREE_CLAIM_TYPES: ClaimType[] = [ClaimType.Airdrop, ClaimType.Team, ClaimType.Advisor]
export const PAID_CLAIM_TYPES: ClaimType[] = [ClaimType.GnoOption, ClaimType.UserOption, ClaimType.Investor]

Expand Down
10 changes: 2 additions & 8 deletions src/custom/state/claim/hooks/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
FREE_CLAIM_TYPES,
PAID_CLAIM_TYPES,
RepoClaims,
REVERSE_CLAIM_TYPE_MAPPING,
UserClaims,
} from 'state/claim/hooks/index'
import { ClaimType, FREE_CLAIM_TYPES, PAID_CLAIM_TYPES, RepoClaims, UserClaims } from 'state/claim/hooks/index'

/**
* Helper function to check whether any claim is an investment option
Expand All @@ -31,5 +25,5 @@ export function hasFreeClaim(claims: UserClaims | null): boolean {
* Airdrop -> 0
*/
export function transformRepoClaimsToUserClaims(repoClaims: RepoClaims): UserClaims {
return repoClaims.map((claim) => ({ ...claim, type: REVERSE_CLAIM_TYPE_MAPPING[claim.type] }))
return repoClaims.map((claim) => ({ ...claim, type: ClaimType[claim.type] }))
}

0 comments on commit 817f7ee

Please sign in to comment.