Skip to content

Commit 4357621

Browse files
authored
Merge pull request QuickSwap#1706 from 0xoscario/remove/defiedge
Remove all defiedge mentions
2 parents da5afff + f30ef93 commit 4357621

9 files changed

Lines changed: 11 additions & 377 deletions

File tree

src/hooks/v3/useV3Farms.ts

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { useEffect, useMemo } from 'react';
2020
import { useSelectedTokenList } from 'state/lists/hooks';
2121
import {
2222
calculatePositionWidth,
23-
getAllDefiedgeStrategies,
2423
getAllGammaPairs,
2524
getTokenFromAddress,
2625
percentageToMultiplier,
@@ -37,7 +36,7 @@ import { useGammaData, useGammaRewards } from './useGammaData';
3736
import { useActiveWeb3React } from 'hooks';
3837
import { useSteerVaults } from './useSteerData';
3938
import { useICHIVaultAPRs, useICHIVaults } from 'hooks/useICHIData';
40-
// import { useDefiEdgeStrategiesAPR } from 'state/mint/v3/hooks';
39+
4140
import {
4241
useEternalFarmAprs,
4342
useEternalFarmPoolAPRs,
@@ -455,27 +454,6 @@ export const useMerklFarms = () => {
455454
usdPrices,
456455
);
457456

458-
const defiEdgeIdsFiltered = useMemo(() => {
459-
if (!merklFarms) return [];
460-
461-
return getAllDefiedgeStrategies(chainId)
462-
.filter(
463-
(vault) =>
464-
!!merklFarms.find(
465-
(item) =>
466-
!!item.forwarders.find(
467-
(alm: any) =>
468-
alm.label.includes('DefiEdge') &&
469-
vault.id.toLowerCase() === alm.almAddress.toLowerCase(),
470-
),
471-
),
472-
)
473-
.map((e) => e.id);
474-
}, [chainId, merklFarms]);
475-
// const {
476-
// isLoading: loadingDefiEdgeAPRs,
477-
// data: defiedgeAprs,
478-
// } = useDefiEdgeStrategiesAPR(defiEdgeIdsFiltered);
479457
const {
480458
data: eternalFarmPoolAprs,
481459
isLoading: eternalFarmPoolAprsLoading,
@@ -499,10 +477,6 @@ export const useMerklFarms = () => {
499477
return IchiVaults[chainId]?.find(
500478
(address) => address.toLowerCase() === alm.almAddress.toLowerCase(),
501479
);
502-
} else if (alm.label.includes('DefiEdge')) {
503-
return getAllDefiedgeStrategies(chainId).find(
504-
(item) => item.id.toLowerCase() === alm.almAddress.toLowerCase(),
505-
);
506480
}
507481
return false;
508482
});
@@ -562,13 +536,6 @@ export const useMerklFarms = () => {
562536
item.address.toLowerCase() === alm.almAddress.toLowerCase(),
563537
);
564538
allowToken0 = ichiVault?.allowToken0;
565-
} else if (alm.label.includes('DefiEdge')) {
566-
poolAPR = 0;
567-
// defiedgeAprs?.find(
568-
// (e: any) =>
569-
// e.strategy.address.toLowerCase() ===
570-
// alm.almAddress.toLowerCase(),
571-
// )?.strategy?.fees_apr ?? 0;
572539
} else if (
573540
alm.label.toLowerCase().includes('quickswap') &&
574541
eternalFarmPoolAprs
@@ -588,7 +555,6 @@ export const useMerklFarms = () => {
588555
});
589556
}, [
590557
chainId,
591-
// defiedgeAprs,
592558
eternalFarmPoolAprs,
593559
gammaData,
594560
ichiAPRs,
@@ -599,7 +565,6 @@ export const useMerklFarms = () => {
599565
return {
600566
loading: loadingMerkl,
601567
loadingPoolAPRs:
602-
// loadingDefiEdgeAPRs ||
603568
loadingICHIAPRs ||
604569
loadingUSDPrices ||
605570
eternalFarmPoolAprsLoading ||

src/pages/FarmPage/V3/AllMerklFarms.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ import MerklFarmCard from './MerklFarmCard';
1616
import useParsedQueryString from 'hooks/useParsedQueryString';
1717
import CustomSelector from 'components/v3/CustomSelector';
1818
import MerklPairFarmCard from './MerklPairFarmCard';
19-
import { getAllDefiedgeStrategies, getAllGammaPairs } from 'utils';
19+
import { getAllGammaPairs } from 'utils';
2020
import { useActiveWeb3React } from 'hooks';
2121
import { useHistory } from 'react-router-dom';
2222
import { useCurrency } from 'hooks/v3/Tokens';
2323
import { KeyboardArrowLeft } from '@material-ui/icons';
24-
import { useDefiEdgeRangeTitles } from 'hooks/v3/useDefiedgeStrategyData';
2524
import { useUSDCPricesFromAddresses } from 'utils/useUSDCPrice';
2625

2726
interface Props {
@@ -274,15 +273,6 @@ const AllMerklFarms: React.FC<Props> = ({
274273
const currency0 = useCurrency(selectedPool?.token0);
275274
const currency1 = useCurrency(selectedPool?.token1);
276275

277-
const selectedDefiEdgeIds = getAllDefiedgeStrategies(chainId)
278-
.filter(
279-
(item) =>
280-
!!(selectedPool?.alm ?? []).find(
281-
(alm: any) => alm.almAddress.toLowerCase() === item.id.toLowerCase(),
282-
),
283-
)
284-
.map((item) => item.id);
285-
const defiEdgeTitles = useDefiEdgeRangeTitles(selectedDefiEdgeIds);
286276
const selectedFarms: any[] = useMemo(() => {
287277
const almFarms: any[] = selectedPool?.alm ?? [];
288278
return almFarms.map((alm) => {
@@ -293,12 +283,6 @@ const AllMerklFarms: React.FC<Props> = ({
293283
(item) =>
294284
item.address.toLowerCase() === alm.almAddress.toLowerCase(),
295285
)?.title ?? '';
296-
} else if (alm.label.includes('DefiEdge')) {
297-
title =
298-
defiEdgeTitles.find(
299-
(item) =>
300-
item.address.toLowerCase() === alm.almAddress.toLowerCase(),
301-
)?.title ?? '';
302286
}
303287
return {
304288
...alm,
@@ -311,7 +295,7 @@ const AllMerklFarms: React.FC<Props> = ({
311295
: undefined,
312296
};
313297
});
314-
}, [chainId, defiEdgeTitles, selectedPool]);
298+
}, [chainId, selectedPool]);
315299

316300
const farmTypes = useMemo(() => {
317301
const mTypes = selectedFarms.reduce((memo: string[], item) => {

src/pages/FarmPage/V3/MerklFarmAPRTooltipItem.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Box, Button } from '@material-ui/core';
22
import { useActiveWeb3React } from 'hooks';
3-
import { useDefiEdgeRangeTitles } from 'hooks/v3/useDefiedgeStrategyData';
43
import React, { useMemo } from 'react';
54
import { useTranslation } from 'react-i18next';
65
import { formatNumber, getAllGammaPairs } from 'utils';
@@ -13,12 +12,6 @@ export const MerklFarmAPRTooltipItem: React.FC<{
1312
const { t } = useTranslation();
1413
const { chainId } = useActiveWeb3React();
1514
const farmType = farm.label ? farm.label.split(' ')[0] : '';
16-
const defiEdgeFarmTitleData = useDefiEdgeRangeTitles(
17-
farmType === 'DefiEdge' ? [farm.almAddress] : [],
18-
);
19-
const defiEdgeFarmTitle = defiEdgeFarmTitleData[0]
20-
? defiEdgeFarmTitleData[0].title
21-
: undefined;
2215

2316
const farmTitle = useMemo(() => {
2417
if (farm.label) {
@@ -29,15 +22,13 @@ export const MerklFarmAPRTooltipItem: React.FC<{
2922
item.address.toLowerCase() === farm.almAddress.toLowerCase(),
3023
)?.title ?? ''
3124
);
32-
} else if (farm.label.includes('DefiEdge')) {
33-
return defiEdgeFarmTitle ?? '';
3425
} else if (farm.label.includes('Steer')) {
3526
return farm.title;
3627
}
3728
return '';
3829
}
3930
return '';
40-
}, [chainId, defiEdgeFarmTitle, farm]);
31+
}, [chainId, farm]);
4132

4233
return (
4334
<Box>

src/pages/FarmPage/V3/MerklPairFarmCard.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { DoubleCurrencyLogo } from 'components';
44
import { formatNumber, getTokenFromAddress } from 'utils';
55
import APRHover from 'assets/images/aprHover.png';
66
import QuickSwapLogo from 'assets/images/quickLogo.png';
7-
import DefiedgeLogo from 'assets/images/defiedge.png';
87
import GammaLogo from 'assets/images/gammaLogo.png';
98
import IchiLogo from 'assets/images/ichi_logo.png';
109
import SteerLogo from 'assets/images/SteerLogo.png';
@@ -30,15 +29,6 @@ export const MerklPairFarmCard: React.FC<Props> = ({ farm }) => {
3029
<img src={GammaLogo} alt='Gamma Logo' style={{ height: 10 }} />
3130
);
3231
break;
33-
case 'DefiEdge':
34-
poolIcon = (
35-
<img
36-
src={DefiedgeLogo}
37-
alt='Defiedge Logo'
38-
style={{ height: 36, marginLeft: '-10px' }}
39-
/>
40-
);
41-
break;
4232
case 'Ichi':
4333
poolIcon = <img src={IchiLogo} alt='ICHI Logo' style={{ height: 18 }} />;
4434
break;

src/pages/FarmPage/V3/MerklPairFarmCardDetails.tsx

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ import { CurrencyLogo, CustomMenu } from 'components';
44
import RangeBadge from 'components/v3/Badge/RangeBadge';
55
import { useActiveWeb3React } from 'hooks';
66
import { useICHIPosition } from 'hooks/useICHIData';
7-
import { useDefiEdgePosition } from 'hooks/v3/useDefiedgeStrategyData';
87
import { useGammaPosition } from 'hooks/v3/useGammaData';
98
import { usePool } from 'hooks/v3/usePools';
109
import { useSteerPosition } from 'hooks/v3/useSteerData';
1110
import {
1211
useGetMerklRewards,
1312
useV3PositionsFromPool,
1413
} from 'hooks/v3/useV3Farms';
15-
import IncreaseDefiedgeLiquidityModal from 'pages/PoolsPage/v3/MyDefiedgePoolsV3/IncreaseDefiedgeLiquidityModal';
16-
import WithdrawDefiedgeLiquidityModal from 'pages/PoolsPage/v3/MyDefiedgePoolsV3/WithdrawDefiedgeLiquidityModal';
1714
import IncreaseGammaLiquidityModal from 'pages/PoolsPage/v3/MyGammaPoolsV3/IncreaseGammaLiquidityModal';
1815
import WithdrawGammaLiquidityModal from 'pages/PoolsPage/v3/MyGammaPoolsV3/WithdrawGammaLiquidityModal';
1916
import IncreaseICHILiquidityModal from 'pages/PoolsPage/v3/MyICHIPools/IncreaseICHILiquidityModal';
@@ -50,7 +47,6 @@ export const MerklPairFarmCardDetails: React.FC<Props> = ({ farm }) => {
5047
const farmType = farm.label.split(' ')[0];
5148
const isICHI = !!farm.label.includes('Ichi');
5249
const isGamma = !!farm.label.includes('Gamma');
53-
const isDefiEdge = !!farm.label.includes('DefiEdge');
5450
const isQuickswap = farm.label.toLowerCase().includes('quickswap');
5551
const isSteer = !!farm.label.includes('Steer');
5652

@@ -64,14 +60,6 @@ export const MerklPairFarmCardDetails: React.FC<Props> = ({ farm }) => {
6460
farm?.token0,
6561
farm?.token1,
6662
);
67-
const {
68-
loading: loadingDefiEdge,
69-
data: defiEdgePosition,
70-
} = useDefiEdgePosition(
71-
isDefiEdge ? farm.almAddress : undefined,
72-
farm?.token0,
73-
farm?.token1,
74-
);
7563
const { loading: loadingSteer, data: steerPosition } = useSteerPosition(
7664
isSteer ? farm.almAddress : undefined,
7765
);
@@ -136,8 +124,6 @@ export const MerklPairFarmCardDetails: React.FC<Props> = ({ farm }) => {
136124
? loadingICHI
137125
: isGamma
138126
? loadingGamma
139-
: isDefiEdge
140-
? loadingDefiEdge
141127
: isQuickswap
142128
? loadingQS
143129
: isSteer
@@ -150,9 +136,6 @@ export const MerklPairFarmCardDetails: React.FC<Props> = ({ farm }) => {
150136
if (isGamma) {
151137
return gammaPosition?.balance0 ?? 0;
152138
}
153-
if (isDefiEdge) {
154-
return defiEdgePosition?.balance0 ?? 0;
155-
}
156139
if (isQuickswap) {
157140
return Number(qsPosition?.amount0.toExact() ?? 0);
158141
}
@@ -163,12 +146,10 @@ export const MerklPairFarmCardDetails: React.FC<Props> = ({ farm }) => {
163146
}, [
164147
isICHI,
165148
isGamma,
166-
isDefiEdge,
167149
isQuickswap,
168150
isSteer,
169151
ichiPosition?.token0Balance,
170152
gammaPosition?.balance0,
171-
defiEdgePosition?.balance0,
172153
qsPosition?.amount0,
173154
steerPosition?.token0BalanceWallet,
174155
]);
@@ -180,9 +161,6 @@ export const MerklPairFarmCardDetails: React.FC<Props> = ({ farm }) => {
180161
if (isGamma) {
181162
return gammaPosition?.balance1 ?? 0;
182163
}
183-
if (isDefiEdge) {
184-
return defiEdgePosition?.balance1 ?? 0;
185-
}
186164
if (isQuickswap) {
187165
return Number(qsPosition?.amount1.toExact() ?? 0);
188166
}
@@ -193,12 +171,10 @@ export const MerklPairFarmCardDetails: React.FC<Props> = ({ farm }) => {
193171
}, [
194172
isICHI,
195173
isGamma,
196-
isDefiEdge,
197174
isQuickswap,
198175
isSteer,
199176
ichiPosition?.token1Balance,
200177
gammaPosition?.balance1,
201-
defiEdgePosition?.balance1,
202178
qsPosition?.amount1,
203179
steerPosition?.token1BalanceWallet,
204180
]);
@@ -303,20 +279,6 @@ export const MerklPairFarmCardDetails: React.FC<Props> = ({ farm }) => {
303279
position={gammaPosition}
304280
/>
305281
)}
306-
{defiEdgePosition && openAdd && (
307-
<IncreaseDefiedgeLiquidityModal
308-
open={openAdd}
309-
onClose={() => setOpenAdd(false)}
310-
position={defiEdgePosition}
311-
/>
312-
)}
313-
{defiEdgePosition && openWithdraw && (
314-
<WithdrawDefiedgeLiquidityModal
315-
open={openWithdraw}
316-
onClose={() => setOpenWithdraw(false)}
317-
position={defiEdgePosition}
318-
/>
319-
)}
320282
{steerPosition && openAdd && (
321283
<IncreaseSteerLiquidityModal
322284
open={openAdd}

src/pages/FarmPage/V3/MyRewardFarms.tsx

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@ import { useMerklFarms } from 'hooks/v3/useV3Farms';
66
import Loader from 'components/Loader';
77
import CustomSelector from 'components/v3/CustomSelector';
88
import MerklPairFarmCard from './MerklPairFarmCard';
9-
import { getAllDefiedgeStrategies, getAllGammaPairs } from 'utils';
9+
import { getAllGammaPairs } from 'utils';
1010
import { useActiveWeb3React } from 'hooks';
11-
import { useDefiEdgeRangeTitles } from 'hooks/v3/useDefiedgeStrategyData';
12-
import { useUSDCPricesFromAddresses } from 'utils/useUSDCPrice';
11+
1312
import {
14-
useDefiedgePositions,
1513
useICHIPositions,
1614
useUnipilotPositions,
1715
useV3Positions,
@@ -36,15 +34,10 @@ const MyRewardFarms: React.FC<Props> = ({
3634

3735
const myPositionIds: any = [];
3836
const { positions } = useV3Positions(account, true);
39-
const { positions: defiedgePositions } = useDefiedgePositions(
40-
account,
41-
chainId,
42-
);
4337
const { unipilotPositions } = useUnipilotPositions(account, chainId);
4438
const { positions: ichiPositions } = useICHIPositions();
4539
const steerPositions = useV3SteerPositions();
4640
const gammaPositions = useGammaPositions();
47-
defiedgePositions.map((item) => myPositionIds.push(item?.id));
4841
unipilotPositions.map((item) => myPositionIds.push(item?.id));
4942
ichiPositions.map((item) => myPositionIds.push(item?.address));
5043
steerPositions.map((item) => myPositionIds.push(item?.address));
@@ -264,17 +257,6 @@ const MyRewardFarms: React.FC<Props> = ({
264257
}
265258
});
266259

267-
const selectedDefiEdgeIds = getAllDefiedgeStrategies(chainId)
268-
.filter((item) => {
269-
// Check if any pool in selectedPool contains the almAddress
270-
return (selectedPool ?? []).some((pool: any) =>
271-
(pool.alm ?? []).some(
272-
(alm: any) => alm.almAddress.toLowerCase() === item.id.toLowerCase(),
273-
),
274-
);
275-
})
276-
.map((item) => item.id);
277-
const defiEdgeTitles = useDefiEdgeRangeTitles(selectedDefiEdgeIds);
278260
const selectedFarmsPre: any[] = useMemo(() => {
279261
return selectedPool.map((pool: any) => {
280262
const almFarms: any[] = pool?.alm ?? [];
@@ -286,12 +268,6 @@ const MyRewardFarms: React.FC<Props> = ({
286268
(item) =>
287269
item.address.toLowerCase() === alm.almAddress.toLowerCase(),
288270
)?.title ?? '';
289-
} else if (alm.label.includes('DefiEdge')) {
290-
title =
291-
defiEdgeTitles.find(
292-
(item) =>
293-
item.address.toLowerCase() === alm.almAddress.toLowerCase(),
294-
)?.title ?? '';
295271
}
296272

297273
return {
@@ -306,7 +282,7 @@ const MyRewardFarms: React.FC<Props> = ({
306282
};
307283
});
308284
});
309-
}, [chainId, defiEdgeTitles, selectedPool]);
285+
}, [chainId, selectedPool]);
310286
const combinedArray = [].concat(...selectedFarmsPre);
311287

312288
const selectedFarms = combinedArray.filter((item: any) => {

0 commit comments

Comments
 (0)