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

Commit

Permalink
Reverting unwanted claim changes (#2323)
Browse files Browse the repository at this point in the history
* Removed claim modal original file test changes

* Removed ProgresBar component that ended up not being used

* Removed mock claim data

* Removed duplicated constant ONE_HUNDRED_PERCENT

Co-authored-by: Leandro <[email protected]>
  • Loading branch information
alfetopito and Leandro authored Jan 27, 2022
1 parent ce73a5b commit cd633a0
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 327 deletions.
12 changes: 5 additions & 7 deletions src/components/claim/ClaimModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import tokenLogo from '../../assets/images/token-logo.png'
import { useActiveWeb3React } from '../../hooks/web3'
import { useModalOpen, useToggleSelfClaimModal } from '../../state/application/hooks'
import { ApplicationModal } from '../../state/application/reducer'
import { useClaimCallback, useUserClaimData, useUserUnclaimedAmount } from 'state/claim/hooks'
import { useUserHasSubmittedClaim } from 'state/transactions/hooks'
import { useClaimCallback, useUserClaimData, useUserUnclaimedAmount } from '../../state/claim/hooks'
import { useUserHasSubmittedClaim } from '../../state/transactions/hooks'
import { CloseIcon, CustomLightSpinner, ExternalLink, TYPE, UniTokenAnimated } from '../../theme'
import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
import { ButtonPrimary } from '../Button'
Expand Down Expand Up @@ -51,25 +51,23 @@ export default function ClaimModal() {
const isOpen = useModalOpen(ApplicationModal.SELF_CLAIM)
const toggleClaimModal = useToggleSelfClaimModal()

const { chainId } = useActiveWeb3React()
const { account, chainId } = useActiveWeb3React()

const account = '0x0010B775429d6C92333E363CBd6BF28dDF1A87E6'
// used for UI loading states
const [attempting, setAttempting] = useState<boolean>(false)

// get user claim data
const userClaimData = useUserClaimData(account)

// monitor the status of the claim from contracts and txns
const { claimCallback } = useClaimCallback(account) // TODO: remove me, hard coded only for testing
const { claimCallback } = useClaimCallback(account)
const unclaimedAmount: CurrencyAmount<Token> | undefined = useUserUnclaimedAmount(account)
const { claimSubmitted, claimTxn } = useUserHasSubmittedClaim(account ?? undefined)
const claimConfirmed = Boolean(claimTxn?.receipt)

function onClaim() {
console.log(`Trying to claim!!!`, unclaimedAmount?.toString(), claimConfirmed)
setAttempting(true)
claimCallback([{ index: 3 }])
claimCallback()
// reset modal and log error
.catch((error) => {
setAttempting(false)
Expand Down
62 changes: 0 additions & 62 deletions src/custom/components/ProgressBar/index.tsx

This file was deleted.

77 changes: 0 additions & 77 deletions src/custom/components/ProgressBar/styled.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/custom/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ export const INITIAL_ALLOWED_SLIPPAGE_PERCENT = new Percent('5', '1000') // 0.5%
export const RADIX_DECIMAL = 10
export const RADIX_HEX = 16

// TODO: remove, this is duplicated with `import { ONE_HUNDRED_PERCENT } from 'constants/misc'`
export const ONE_HUNDRED_PERCENT = new Percent(1, 1)

export const DEFAULT_DECIMALS = 18
export const DEFAULT_PRECISION = 6
export const DEFAULT_SMALL_LIMIT = '0.000001'
Expand Down
24 changes: 0 additions & 24 deletions src/custom/state/claim/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ import {
transformRepoClaimsToUserClaims,
} from 'state/claim/hooks/utils'
import { SupportedChainId } from 'constants/chains'
import { registerOnWindow } from 'utils/misc'
import mockData, { MOCK_INDICES } from './mocks/claimData'
import { getIndexes } from './utils'
import { useAllClaimingTransactionIndices } from 'state/enhancedTransactions/hooks'

export { useUserClaimData } from '@src/state/claim/hooks'
Expand Down Expand Up @@ -266,13 +263,6 @@ export function useUserClaims(account: Account): UserClaims | null {
return claimKey ? claimInfo[claimKey] : null
}

// TODO: remove
const createMockTx = (data: number[]) => ({
hash: '0x' + Math.round(Math.random() * 10).toString() + 'AxAFjAhG89G89AfnLK3CCxAfnLKQffQ782G89AfnLK3CCxxx123FF',
summary: `Claimed ${Math.random() * 3337} vCOW`,
claim: { recipient: '0x97EC4fcD5F78cA6f6E4E1EAC6c0Ec8421bA518B7', indices: data },
})

/**
* Fetches from contract the deployment timestamp in ms
*
Expand Down Expand Up @@ -431,20 +421,6 @@ export function useClaimCallback(account: string | null | undefined): {
const addTransaction = useTransactionAdder()
const vCowToken = chainId ? V_COW[chainId] : undefined

// TODO: remove
registerOnWindow({
addMockClaimTransactions: (data?: number[]) => {
let finalData: number[] | undefined = data

if (!finalData) {
const mockDataIndices = connectedAccount ? getIndexes(mockData[connectedAccount] || []) : []
finalData = mockDataIndices?.length > 0 ? mockDataIndices : MOCK_INDICES
}

return addTransaction(createMockTx(finalData))
},
})

const getClaimArgs = useCallback(
async function (claimInput: ClaimInput[]): Promise<GetClaimManyArgsResult> {
if (claims.length === 0) {
Expand Down
153 changes: 0 additions & 153 deletions src/custom/state/claim/hooks/mocks/claimData.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/custom/state/orders/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { OrderKind } from '@gnosis.pm/gp-v2-contracts'
import { Price } from '@uniswap/sdk-core'

import { ONE_HUNDRED_PERCENT, PENDING_ORDERS_BUFFER } from 'constants/index'
import { ONE_HUNDRED_PERCENT } from 'constants/misc'
import { PENDING_ORDERS_BUFFER } from 'constants/index'
import { OrderMetaData } from 'api/gnosisProtocol'
import { Order } from 'state/orders/actions'
import { PriceInformation } from 'utils/price'
Expand Down

0 comments on commit cd633a0

Please sign in to comment.