Skip to content

Commit

Permalink
Added finished tab for farming
Browse files Browse the repository at this point in the history
  • Loading branch information
Beardev118 committed Oct 24, 2023
1 parent 0b17b00 commit c2d0b31
Show file tree
Hide file tree
Showing 36 changed files with 6,003 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import SlideOutMenu from './components/SlideOutMenu/SlideOutMenu'
import ComingSoon from './views/ComingSoon'
import NewVersionModal from './components/NewVersionModal'
import NewFarms from './views/NewFarms'
import OldFarms from './views/OldFarms'

// import 'bootstrap/dist/css/bootstrap.min.css'

Expand Down Expand Up @@ -123,6 +124,9 @@ const App: React.FC = () => {
<Route exact path="/ethereum/farms-v2/">
<NewFarms />
</Route>
<Route exact path="/ethereum/farms-v2/history">
<OldFarms />
</Route>
<Route path="/ethereum/staking/">
<Pools />
</Route>
Expand Down
14 changes: 14 additions & 0 deletions src/config/constants/farmsWithSmartChef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ const farmsWithSmartChef: FarmsWithSmartChefConfig[] = [
harvest: true,
tokenPerBlock: '1',
sortOrder: 999,
isFinished: true,
},
{
sousId: 4,
stakingToken: LpTokens.soku_eth_sushi,
earningToken: tokens.sodatsu,
contractAddress: {
1: '0x82ccdac1E2Fe6F86F4A2B241dfBe35E67B6E19F7',
5: '',
},
poolCategory: FarmsWithSmartChefCategory.CORE,
harvest: true,
tokenPerBlock: '1',
sortOrder: 999,
isFinished: false,
},
// {
Expand Down
7 changes: 7 additions & 0 deletions src/views/FarmsV2/components/ToggleNew/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const ToggleNew = () => {
<ButtonMenuItem style={{ color: '#05195a', borderRadius: '7px' }} as={Link} to={`/ethereum/farms-v2/`}>
Farm V2
</ButtonMenuItem>
<ButtonMenuItem
style={{ color: '#05195a', borderRadius: '7px' }}
as={Link}
to={`${'/ethereum/farms-v2/history'}`}
>
Finished
</ButtonMenuItem>
</ButtonMenu>
</Wrapper>
)
Expand Down
7 changes: 7 additions & 0 deletions src/views/NewFarms/components/ToggleNew/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const ToggleNew = () => {
>
Farm V2
</ButtonMenuItem>
<ButtonMenuItem
style={{ color: '#05195a', borderRadius: '7px' }}
as={Link}
to={`${'/ethereum/farms-v2/history'}`}
>
Finished
</ButtonMenuItem>
</ButtonMenu>
</Wrapper>
)
Expand Down
130 changes: 130 additions & 0 deletions src/views/OldFarms/components/BountyCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import React, { useMemo } from 'react'
// import BigNumber from 'bignumber.js'
// import styled from 'styled-components'
// import {
// Card,
// CardBody,
// Text,
// Flex,
// HelpIcon,
// Button,
// Heading,
// Skeleton,
// useModal,
// Box,
// useTooltip,
// } from '@pancakeswap/uikit'
// import { useTranslation } from 'contexts/Localization'
// import { getBalanceNumber } from 'utils/formatBalance'
// import { useCakeVault } from 'state/hooks'
// import Balance from 'components/Balance'
// import BountyModal from './BountyModal'

// const StyledCard = styled(Card)`
// width: 100%;
// ${({ theme }) => theme.mediaQueries.sm} {
// min-width: 240px;
// }
// `

// const BountyCard = () => {
// const { t } = useTranslation()
// const {
// estimatedCakeBountyReward,
// totalPendingCakeHarvest,
// fees: { callFee },
// } = useCakeVault()
// const cakePriceBusd = 0
// const cakePriceBusdAsNumber = cakePriceBusd.toString()

// const estimatedDollarBountyReward = useMemo(() => {
// return new BigNumber(estimatedCakeBountyReward).multipliedBy(cakePriceBusdAsNumber)
// }, [cakePriceBusdAsNumber, estimatedCakeBountyReward])

// const hasFetchedDollarBounty =
// cakePriceBusdAsNumber && estimatedDollarBountyReward ? estimatedDollarBountyReward.gte(0) : false
// const hasFetchedCakeBounty = estimatedCakeBountyReward ? estimatedCakeBountyReward.gte(0) : false
// const dollarBountyToDisplay = hasFetchedDollarBounty ? getBalanceNumber(estimatedDollarBountyReward, 18) : 0
// const cakeBountyToDisplay = hasFetchedCakeBounty ? getBalanceNumber(estimatedCakeBountyReward, 18) : 0

// const TooltipComponent = () => (
// <>
// <Text mb="16px">{t('This bounty is given as a reward for providing a service to other users.')}</Text>
// <Text mb="16px">
// {t(
// 'Whenever you successfully claim the bounty, you’re also helping out by activating the Auto CAKE Pool’s compounding function for everyone.',
// )}
// </Text>
// <Text style={{ fontWeight: 'bold' }}>
// {t('Auto-Compound Bounty: %fee%% of all Auto CAKE pool users pending yield', { fee: callFee / 100 })}
// </Text>
// </>
// )

// const [onPresentBountyModal] = useModal(
// <BountyModal
// cakeBountyToDisplay={cakeBountyToDisplay}
// dollarBountyToDisplay={dollarBountyToDisplay}
// totalPendingCakeHarvest={totalPendingCakeHarvest}
// callFee={callFee}
// TooltipComponent={TooltipComponent}
// />,
// )

// const { targetRef, tooltip, tooltipVisible } = useTooltip(<TooltipComponent />, {
// placement: 'bottom-end',
// tooltipOffset: [20, 10],
// })

// return (
// <>
// {tooltipVisible && tooltip}
// <StyledCard>
// <CardBody>
// <Flex flexDirection="column">
// <Flex alignItems="center" mb="12px">
// <Text fontSize="16px" bold color="textSubtle" mr="4px">
// {t('Auto CAKE Bounty')}
// </Text>
// <Box ref={targetRef}>
// <HelpIcon color="textSubtle" />
// </Box>
// </Flex>
// </Flex>
// <Flex alignItems="center" justifyContent="space-between">
// <Flex flexDirection="column" mr="12px">
// <Heading>
// {hasFetchedCakeBounty ? (
// <Balance fontSize="20px" bold value={cakeBountyToDisplay} decimals={3} />
// ) : (
// <Skeleton height={20} width={96} mb="2px" />
// )}
// </Heading>
// {hasFetchedDollarBounty ? (
// <Balance
// fontSize="12px"
// color="textSubtle"
// value={dollarBountyToDisplay}
// decimals={2}
// unit=" USD"
// prefix="~"
// />
// ) : (
// <Skeleton height={16} width={62} />
// )}
// </Flex>
// <Button
// disabled={!dollarBountyToDisplay || !cakeBountyToDisplay || !callFee}
// onClick={onPresentBountyModal}
// scale="sm"
// >
// {t('Claim')}
// </Button>
// </Flex>
// </CardBody>
// </StyledCard>
// </>
// )
// }

// export default BountyCard
133 changes: 133 additions & 0 deletions src/views/OldFarms/components/BountyModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import React, { useState } from 'react'
// import BigNumber from 'bignumber.js'
// import { useWeb3React } from '@web3-react/core'
// import { DEFAULT_GAS } from 'config'
// import styled from 'styled-components'
// import { Modal, Text, Flex, Button, HelpIcon, AutoRenewIcon, useTooltip } from '@pancakeswap/uikit'
// import { getBalanceNumber } from 'utils/formatBalance'
// import { useCakeVaultContract } from 'hooks/useContract'
// import useTheme from 'hooks/useTheme'
// import useToast from 'hooks/useToast'
// import { useTranslation } from 'contexts/Localization'
// import UnlockButton from 'components/UnlockButton'
// import Balance from 'components/Balance'

// interface BountyModalProps {
// cakeBountyToDisplay: number
// dollarBountyToDisplay: number
// totalPendingCakeHarvest: BigNumber
// callFee: number
// onDismiss?: () => void
// TooltipComponent: React.ElementType
// }

// const Divider = styled.div`
// background-color: ${({ theme }) => theme.colors.backgroundDisabled};
// height: 1px;
// margin: 16px auto;
// width: 100%;
// `

// const BountyModal: React.FC<BountyModalProps> = ({
// cakeBountyToDisplay,
// dollarBountyToDisplay,
// totalPendingCakeHarvest,
// callFee,
// onDismiss,
// TooltipComponent,
// }) => {
// const { t } = useTranslation()
// const { account } = useWeb3React()
// const { theme } = useTheme()
// const { toastError, toastSuccess } = useToast()
// const cakeVaultContract = useCakeVaultContract()
// const [pendingTx, setPendingTx] = useState(false)
// const callFeeAsDecimal = callFee / 100
// const totalYieldToDisplay = getBalanceNumber(totalPendingCakeHarvest, 18)
// const { targetRef, tooltip, tooltipVisible } = useTooltip(<TooltipComponent />, {
// placement: 'bottom',
// tooltipPadding: { right: 15 },
// })

// const handleConfirmClick = async () => {
// cakeVaultContract.methods
// .harvest()
// .send({ from: account, gas: DEFAULT_GAS })
// .on('sending', () => {
// setPendingTx(true)
// })
// .on('receipt', () => {
// toastSuccess(t('Bounty collected!'), t('CAKE bounty has been sent to your wallet.'))
// setPendingTx(false)
// onDismiss()
// })
// .on('error', (error) => {
// console.error(error)
// toastError(
// t('Could not be collected'),
// t('There may be an issue with your transaction, or another user claimed the bounty first.'),
// )
// setPendingTx(false)
// onDismiss()
// })
// }

// return (
// <Modal title={t('Claim Bounty')} onDismiss={onDismiss} headerBackground="#f9f9fa">
// {tooltipVisible && tooltip}
// <Flex alignItems="flex-start" justifyContent="space-between">
// <Text>{t('You’ll claim')}</Text>
// <Flex flexDirection="column">
// <Balance bold value={cakeBountyToDisplay} decimals={7} unit=" CAKE" />
// <Text fontSize="12px" color="textSubtle">
// <Balance
// fontSize="12px"
// color="textSubtle"
// value={dollarBountyToDisplay}
// decimals={2}
// unit=" USD"
// prefix="~"
// />
// </Text>
// </Flex>
// </Flex>
// <Divider />
// <Flex alignItems="center" justifyContent="space-between">
// <Text fontSize="14px" color="textSubtle">
// {t('Pool total pending yield')}
// </Text>
// <Balance color="textSubtle" value={totalYieldToDisplay} unit=" CAKE" />
// </Flex>
// <Flex alignItems="center" justifyContent="space-between" mb="24px">
// <Text fontSize="14px" color="textSubtle">
// {t('Bounty')}
// </Text>
// <Text fontSize="14px" color="textSubtle">
// {callFeeAsDecimal}%
// </Text>
// </Flex>
// {account ? (
// <Button
// isLoading={pendingTx}
// endIcon={pendingTx ? <AutoRenewIcon spin color="currentColor" /> : null}
// onClick={handleConfirmClick}
// mb="28px"
// >
// {t('Confirm')}
// </Button>
// ) : (
// <UnlockButton mb="28px" />
// )}
// <Flex justifyContent="center" alignItems="center">
// <Text fontSize="16px" bold color="textSubtle" mr="4px">
// {t('What’s this?')}
// </Text>
// <span ref={targetRef}>
// <HelpIcon color="textSubtle" />
// </span>
// </Flex>
// </Modal>
// )
// }

// export default BountyModal
49 changes: 49 additions & 0 deletions src/views/OldFarms/components/CakeVaultCard/FeeSummary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react'
import { Text, Flex, useTooltip, TooltipText } from '@pancakeswap/uikit'
import { useTranslation } from 'contexts/Localization'
import { useCakeVault } from 'state/hooks'
import UnstakingFeeCountdownRow from './UnstakingFeeCountdownRow'

interface FeeSummaryProps {
stakingTokenSymbol: string
stakeAmount: string
}

const FeeSummary: React.FC<FeeSummaryProps> = ({ stakingTokenSymbol, stakeAmount }) => {
const { t } = useTranslation()
const {
fees: { withdrawalFee },
} = useCakeVault()
const feeAsDecimal = withdrawalFee / 100
const feeInCake = (parseFloat(stakeAmount) * (feeAsDecimal / 100)).toFixed(4)
const { targetRef, tooltip, tooltipVisible } = useTooltip(
<>
<Text bold mb="4px">
{t('Unstaking fee: %fee%%', { fee: feeAsDecimal })}
</Text>
<Text>
{t(
'Only applies within 3 days of staking. Unstaking after 3 days will not include a fee. Timer resets every time you stake new SOKU in the pool.',
)}
</Text>
</>,
{ placement: 'top-start' },
)

return (
<>
<Flex mt="24px" alignItems="center" justifyContent="space-between">
{tooltipVisible && tooltip}
<TooltipText ref={targetRef} small>
{t('Unstaking Fee')}
</TooltipText>
<Text fontSize="14px">
{stakeAmount ? feeInCake : '-'} {stakingTokenSymbol}
</Text>
</Flex>
<UnstakingFeeCountdownRow />
</>
)
}

export default FeeSummary
Loading

0 comments on commit c2d0b31

Please sign in to comment.