-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b17b00
commit c2d0b31
Showing
36 changed files
with
6,003 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
49
src/views/OldFarms/components/CakeVaultCard/FeeSummary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.