Skip to content

Commit

Permalink
Merge pull request #221 from QuickSwap/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
sameepsi authored Jun 29, 2022
2 parents ce55b55 + 1b010da commit 43bfbfc
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 28 deletions.
2 changes: 2 additions & 0 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/components/StakeQuickModal/StakeQuickModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -28,7 +28,7 @@ const StakeQuickModal: React.FC<StakeQuickModalProps> = ({ 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,
Expand All @@ -44,10 +44,10 @@ const StakeQuickModal: React.FC<StakeQuickModalProps> = ({ 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 () => {
Expand Down
41 changes: 23 additions & 18 deletions src/pages/DragonPage/DragonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ 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();
const isMobile = useMediaQuery(breakpoints.down('xs'));
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 (
<Box width='100%' mb={3}>
Expand All @@ -26,35 +29,37 @@ const DragonPage: React.FC = () => {
{showOld && (
<Box className='dragonWrapper' mb='10px'>
<Box className='dragonBg'>
<img src={DragonBg2} alt='Old Dragon Lair' />
<img src={DragonBg2} alt='Dragon Lair' />
</Box>
<img
src={DragonLairMask}
alt='Dragon Mask'
className='dragonMask'
/>
<Box className='dragonTitle'>
<h5>{t('oldDragonLair')}</h5>
<small>{t('oldDragonLairTitle')}</small>
<h5>{t('dragonLair')}</h5>
<small>{t('dragonLairTitle')}</small>
</Box>
<DragonsLair isNew={false} />
</Box>
)}
<Box className='dragonWrapper'>
<Box className='dragonBg'>
<img src={DragonBg2} alt='Dragon Lair' />
</Box>
<img
src={DragonLairMask}
alt='Dragon Mask'
className='dragonMask'
/>
<Box className='dragonTitle'>
<h5>{t('dragonLair')}</h5>
<small>{t('dragonLairTitle')}</small>
{showNew && (
<Box className='dragonWrapper'>
<Box className='dragonBg'>
<img src={DragonBg2} alt='Dragon Lair' />
</Box>
<img
src={DragonLairMask}
alt='Dragon Mask'
className='dragonMask'
/>
<Box className='dragonTitle'>
<h5>{t('newDragonLair')}</h5>
<small>{t('newDragonLairTitle')}</small>
</Box>
<DragonsLair isNew={true} />
</Box>
<DragonsLair isNew={true} />
</Box>
)}
</Grid>
<Grid item xs={12} sm={12} md={8}>
<Box className='dragonWrapper'>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/DragonPage/DragonsLair.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: ',',
});
Expand Down Expand Up @@ -92,7 +91,7 @@ const DragonsLair: React.FC<{ isNew: boolean }> = ({ isNew }) => {
onClick={() => setIsQUICKRate(!isQUICKRate)}
/>
</Box>
{isNew && (
{!isNew && (
<Box
className='stakeButton bg-primary'
onClick={() => setOpenStakeModal(true)}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/LandingPage/TradingInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/state/stake/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ function useLairInfo(
inputs,
);

accountArg = [GlobalConst.addresses.NEW_LAIR_ADDRESS ?? undefined];
accountArg = [lairAddress ?? undefined];

const lairsQuickBalance = useSingleCallResult(
quickContract,
Expand All @@ -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),
Expand Down

0 comments on commit 43bfbfc

Please sign in to comment.