Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 7 day average APR #1355

Open
wants to merge 1 commit into
base: dev2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -901,5 +901,7 @@
"last24hours": "Last 24 hours",
"liquidityhubvolumesincelaunch": "*Quickswap liquidity hub volume since launch.",
"mainnets": "Mainnets",
"testnets": "Testnets"
"testnets": "Testnets",
"currentApr": "Current APR",
"7dayApr": "7 Day APR"
}
1 change: 1 addition & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ export const GlobalConst = {
tvl: '2',
rewards: '3',
apr: '4',
sevendayApr: '5'
},
v3FarmFilter: {
allFarms: '0',
Expand Down
17 changes: 13 additions & 4 deletions src/pages/FarmPage/V3/AllMerklFarms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,25 @@ const AllMerklFarms: React.FC<Props> = ({ searchValue, farmStatus }) => {
{
text: t('pool'),
index: GlobalConst.utils.v3FarmSortBy.pool,
width: 0.3,
width: 0.25,
justify: 'flex-start',
},
{
text: t('tvl'),
index: GlobalConst.utils.v3FarmSortBy.tvl,
width: 0.2,
width: 0.15,
justify: 'flex-start',
},
{
text: t('apr'),
text: t('currentApr'),
index: GlobalConst.utils.v3FarmSortBy.apr,
width: 0.2,
width: 0.15,
justify: 'flex-start',
},
{
text: t('7dayApr'),
index: GlobalConst.utils.v3FarmSortBy.sevendayApr,
width: 0.15,
justify: 'flex-start',
},
{
Expand Down Expand Up @@ -219,6 +225,9 @@ const AllMerklFarms: React.FC<Props> = ({ searchValue, farmStatus }) => {
if (sortBy === GlobalConst.utils.v3FarmSortBy.apr) {
return farm1.apr > farm2.apr ? sortMultiplier : -1 * sortMultiplier;
}
if (sortBy === GlobalConst.utils.v3FarmSortBy.sevendayApr) {
return farm1.apr > farm2.apr ? sortMultiplier : -1 * sortMultiplier;
}
if (sortBy === GlobalConst.utils.v3FarmSortBy.rewards) {
return farm1.dailyRewardUSD > farm2.dailyRewardUSD
? sortMultiplier
Expand Down
27 changes: 24 additions & 3 deletions src/pages/FarmPage/V3/MerklFarmCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const MerklFarmCard: React.FC<Props> = ({ farm }) => {
className='flex items-center flex-wrap'
>
<Box
width={isMobile ? '80%' : '30%'}
width={isMobile ? '80%' : '25%'}
className='flex items-center'
gridGap={12}
>
Expand All @@ -117,14 +117,35 @@ export const MerklFarmCard: React.FC<Props> = ({ farm }) => {
</Box>
<Box
my={2}
width={isMobile ? '100%' : '20%'}
width={isMobile ? '100%' : '15%'}
className='flex items-center justify-between'
>
{isMobile && <p>{t('tvl')}</p>}
<p>${formatNumber(farm.tvl)}</p>
</Box>
<Box
width={isMobile ? '100%' : '20%'}
width={isMobile ? '100%' : '15%'}
className='flex items-center justify-between'
>
{isMobile && <p>{t('apr')}</p>}
<Box className={isMobile ? 'flex flex-col items-end' : ''}>
<small>{t('upTo')}</small>
<Box className='flex'>
<MerklFarmAPRTooltip
farms={farm.alm}
token0={farm.token0}
token1={farm.token1}
>
<Box className='farmCardAPR' gridGap={4}>
<p>{formatNumber(farm.apr)}%</p>
<img src={APRHover} width={16} />
</Box>
</MerklFarmAPRTooltip>
</Box>
</Box>
</Box>
<Box
width={isMobile ? '100%' : '15%'}
className='flex items-center justify-between'
>
{isMobile && <p>{t('apr')}</p>}
Expand Down
Loading