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

Commit

Permalink
Remove some claim functions that are not being used (#2372)
Browse files Browse the repository at this point in the history
  • Loading branch information
nenadV91 authored Feb 2, 2022
1 parent fcb05fe commit 505a3b4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 60 deletions.
9 changes: 0 additions & 9 deletions src/custom/state/claim/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,6 @@ export enum ClaimType {
Advisor, // free, with vesting, only on mainnet
}

export type TypeToPriceMapper = Map<ClaimType, number>

// Hardcoded values
export const ClaimTypePriceMap: TypeToPriceMapper = new Map([
[ClaimType.GnoOption, 16.66],
[ClaimType.Investor, 26.66],
[ClaimType.UserOption, 36.66],
])

type RepoClaimType = keyof typeof ClaimType

export const FREE_CLAIM_TYPES: ClaimType[] = [ClaimType.Airdrop, ClaimType.Team, ClaimType.Advisor]
Expand Down
52 changes: 1 addition & 51 deletions src/custom/state/claim/hooks/utils.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core'

import { SupportedChainId } from 'constants/chains'
import { GNO, GpEther, USDC_BY_CHAIN, V_COW } from 'constants/tokens'
import { GNO, GpEther, USDC_BY_CHAIN } from 'constants/tokens'
import { ONE_HUNDRED_PERCENT, ZERO_PERCENT } from 'constants/misc'

import {
CLAIMS_REPO,
ClaimType,
ClaimTypePriceMap,
FREE_CLAIM_TYPES,
PAID_CLAIM_TYPES,
RepoClaims,
TypeToPriceMapper,
UserClaims,
VCowPrices,
} from 'state/claim/hooks/index'
Expand Down Expand Up @@ -66,54 +64,6 @@ export function getFreeClaims(claims: UserClaims): UserClaims {
return claims?.filter((claim) => FREE_CLAIM_TYPES.includes(claim.type))
}

/**
* Helper function to transform claim data amount to CurrencyAmount
*
*/
export function parseClaimAmount(value: string, chainId: number | undefined): CurrencyAmount<Token> | undefined {
const vCow = chainId ? V_COW[chainId || 4] : undefined
if (!vCow || !value) return undefined
return CurrencyAmount.fromRawAmount(vCow, value)
}

export type TypeToCurrencyMapper = {
[key: string]: string
}

/**
* Helper function to transform claim data type to coin name that can be displayed in the UI
*
* @param chainId
*/
export function getTypeToCurrencyMap(chainId: number | undefined): TypeToCurrencyMapper {
if (!chainId) return {}

const map: TypeToCurrencyMapper = {
[ClaimType.GnoOption]: 'GNO',
[ClaimType.Investor]: 'USDC',
[ClaimType.UserOption]: '',
}

if ([SupportedChainId.MAINNET, SupportedChainId.RINKEBY].includes(chainId)) {
map[ClaimType.UserOption] = 'ETH'
}

if (chainId === SupportedChainId.XDAI) {
map[ClaimType.UserOption] = 'XDAI'
}

return map
}

/**
* Helper function to get vCow price based on claim type and chainId
*
* @param type
*/
export function getTypeToPriceMap(): TypeToPriceMapper {
return ClaimTypePriceMap
}

/**
* Helper function to check if current type is free claim
*
Expand Down

0 comments on commit 505a3b4

Please sign in to comment.