From d0330c897bdb2fe76e78486295511d27dde28667 Mon Sep 17 00:00:00 2001 From: sameepsi Date: Thu, 30 Jun 2022 03:00:44 +0530 Subject: [PATCH 1/3] Removed new DL --- public/locales/en.json | 2 + .../StakeQuickModal/StakeQuickModal.tsx | 8 ++-- src/pages/DragonPage/DragonPage.tsx | 41 +++++++++++-------- src/pages/DragonPage/DragonsLair.tsx | 5 +-- src/pages/LandingPage/TradingInfo.tsx | 2 +- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index 3dbfddfb1..a98a7dea3 100755 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -37,6 +37,7 @@ "featureDepositDesc": "Deposit your LP tokens to earn additional rewards.", "dragonLair": "Dragon’s Lair", "oldDragonLair": "Old Dragon’s Lair", + "newDragonLair": "New Dragon’s Lair", "featureDragonDesc": "Dragon’s Lair is a single staking pool for QUICK token. Stake your QUICK to receive dQUICK, and earn your share of .04% of all trading fees.", "buyWithFiat": "Buy Crypto with Fiat", "featureBuyFiatDesc": "Simple way to buy with Apple Pay, credit card, bank transfer & more.", @@ -195,6 +196,7 @@ "dragonAlertDesc": "As of May 2022, you can stake QUICK(NEW) in Syrup Pools. Note that there are some Syrup Pools that will still accept QUICK(OLD) for staking, until they run out of rewards.", "dragonLairTitle": "Stake QUICK to earn QUICK", "oldDragonLairTitle": "Withdraw and convert to new QUICK", + "newDragonLairTitle": "Withdraw your new QUICK for now", "dragonSyrup": "Dragon’s Syrup", "dragonSyrupTitle": "Earn tokens of your choice over time", "stakeQUICKTitle": "Single Stake — Auto compounding", diff --git a/src/components/StakeQuickModal/StakeQuickModal.tsx b/src/components/StakeQuickModal/StakeQuickModal.tsx index d6f91a9fe..6447066c2 100644 --- a/src/components/StakeQuickModal/StakeQuickModal.tsx +++ b/src/components/StakeQuickModal/StakeQuickModal.tsx @@ -8,7 +8,7 @@ import { useCurrencyBalance, useTokenBalance } from 'state/wallet/hooks'; import { useActiveWeb3React } from 'hooks'; import { GlobalConst, GlobalValue } from 'constants/index'; import { useApproveCallback, ApprovalState } from 'hooks/useApproveCallback'; -import { useNewLairContract } from 'hooks/useContract'; +import { useLairContract } from 'hooks/useContract'; import { useTransactionAdder, useTransactionFinalizer, @@ -28,7 +28,7 @@ const StakeQuickModal: React.FC = ({ open, onClose }) => { const { account } = useActiveWeb3React(); const addTransaction = useTransactionAdder(); const finalizedTransaction = useTransactionFinalizer(); - const quickToken = GlobalValue.tokens.COMMON.NEW_QUICK; + const quickToken = GlobalValue.tokens.COMMON.OLD_QUICK; const quickBalance = useCurrencyBalance(account ?? undefined, quickToken); const userLiquidityUnstaked = useTokenBalance( account ?? undefined, @@ -44,10 +44,10 @@ const StakeQuickModal: React.FC = ({ open, onClose }) => { userLiquidityUnstaked, ); - const lairContract = useNewLairContract(); + const lairContract = useLairContract(); const [approval, approveCallback] = useApproveCallback( parsedAmount, - GlobalConst.addresses.NEW_LAIR_ADDRESS, + GlobalConst.addresses.LAIR_ADDRESS, ); const onAttemptToApprove = async () => { diff --git a/src/pages/DragonPage/DragonPage.tsx b/src/pages/DragonPage/DragonPage.tsx index 2b9d0e787..b7457cc29 100755 --- a/src/pages/DragonPage/DragonPage.tsx +++ b/src/pages/DragonPage/DragonPage.tsx @@ -9,7 +9,7 @@ import DragonsLair from './DragonsLair'; import DragonsSyrup from './DragonsSyrup'; import 'pages/styles/dragon.scss'; import { useTranslation } from 'react-i18next'; -import { useOldLairInfo } from 'state/stake/hooks'; +import { useNewLairInfo } from 'state/stake/hooks'; const DragonPage: React.FC = () => { const { breakpoints } = useTheme(); @@ -17,6 +17,9 @@ const DragonPage: React.FC = () => { const { t } = useTranslation(); //showing old dragons lair until we're ready to deploy const showOld = true; + const lairInfo = useNewLairInfo(); + const showNew = + Number(lairInfo?.dQUICKBalance?.toFixed(0)) === 0 ? false : true; return ( @@ -26,7 +29,7 @@ const DragonPage: React.FC = () => { {showOld && ( - Old Dragon Lair + Dragon Lair { className='dragonMask' /> -
{t('oldDragonLair')}
- {t('oldDragonLairTitle')} +
{t('dragonLair')}
+ {t('dragonLairTitle')}
)} - - - Dragon Lair - - Dragon Mask - -
{t('dragonLair')}
- {t('dragonLairTitle')} + {showNew && ( + + + Dragon Lair + + Dragon Mask + +
{t('newDragonLair')}
+ {t('newDragonLairTitle')} +
+
- -
+ )} diff --git a/src/pages/DragonPage/DragonsLair.tsx b/src/pages/DragonPage/DragonsLair.tsx index fb84af56f..d8aa4c116 100644 --- a/src/pages/DragonPage/DragonsLair.tsx +++ b/src/pages/DragonPage/DragonsLair.tsx @@ -19,8 +19,7 @@ const DragonsLair: React.FC<{ isNew: boolean }> = ({ isNew }) => { const lairInfo = useOldLairInfo(); const newLairInfo = useNewLairInfo(); const lairInfoToUse = isNew ? newLairInfo : lairInfo; - let APY = useLairDQUICKAPY(isNew, lairInfoToUse); - APY = isNew ? APY : '0'; + const APY = useLairDQUICKAPY(isNew, lairInfoToUse); const dQUICKtoQUICK = lairInfoToUse.dQUICKtoQUICK?.toFixed(4, { groupSeparator: ',', }); @@ -92,7 +91,7 @@ const DragonsLair: React.FC<{ isNew: boolean }> = ({ isNew }) => { onClick={() => setIsQUICKRate(!isQUICKRate)} /> - {isNew && ( + {!isNew && ( setOpenStakeModal(true)} diff --git a/src/pages/LandingPage/TradingInfo.tsx b/src/pages/LandingPage/TradingInfo.tsx index d04f93ea7..44da89de8 100644 --- a/src/pages/LandingPage/TradingInfo.tsx +++ b/src/pages/LandingPage/TradingInfo.tsx @@ -11,7 +11,7 @@ export const TradingInfo: React.FC<{ globalData: any }> = ({ globalData }) => { const lairInfo = useOldLairInfo(); const [openStakeModal, setOpenStakeModal] = useState(false); - const dQUICKAPY = useLairDQUICKAPY(true, lairInfo); + const dQUICKAPY = useLairDQUICKAPY(false, lairInfo); //TODO: Support Multichain const totalRewardsUSD = useTotalRewardsDistributed(ChainId.MATIC); const { t } = useTranslation(); From 45d0d382baf1db80b378a1da15ca6bd0578675a1 Mon Sep 17 00:00:00 2001 From: sameepsi Date: Thu, 30 Jun 2022 03:27:37 +0530 Subject: [PATCH 2/3] Bug fix in old dl tvl --- src/state/stake/hooks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/state/stake/hooks.ts b/src/state/stake/hooks.ts index 334f8b362..16b84c608 100755 --- a/src/state/stake/hooks.ts +++ b/src/state/stake/hooks.ts @@ -1165,7 +1165,7 @@ function useLairInfo( inputs, ); - accountArg = [GlobalConst.addresses.NEW_LAIR_ADDRESS ?? undefined]; + accountArg = [lairAddress ?? undefined]; const lairsQuickBalance = useSingleCallResult( quickContract, From d10d3a1f0002d415202e58637780ddb760c5d433 Mon Sep 17 00:00:00 2001 From: sameepsi Date: Thu, 30 Jun 2022 03:29:02 +0530 Subject: [PATCH 3/3] Bug fix in old dl tvl --- src/state/stake/hooks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/state/stake/hooks.ts b/src/state/stake/hooks.ts index 16b84c608..5cf51cdf5 100755 --- a/src/state/stake/hooks.ts +++ b/src/state/stake/hooks.ts @@ -1179,7 +1179,7 @@ function useLairInfo( return useMemo(() => { return { - lairAddress: GlobalConst.addresses.NEW_LAIR_ADDRESS, + lairAddress: lairAddress, dQUICKtoQUICK: new TokenAmount( quickToken, JSBI.BigInt(dQuickToQuick?.result?.[0] ?? 0),