Skip to content

Commit

Permalink
Iamoskvin/rewards page sorting pools (#312)
Browse files Browse the repository at this point in the history
* sorts pools by tvl instead of APR

* change apr color
  • Loading branch information
iamoskvin authored May 28, 2024
1 parent a07e03e commit 709773b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Pools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function PairList({
const displayAprStarknet = formattedPercent(cleanedAprStarknet, true)

const cleanedAprCommon = cleanedAprFee + cleanedAprStarknet
const displayAprCommon = formattedPercent(cleanedAprCommon, true, darkTheme.jediBlue, 700)
const displayAprCommon = formattedPercent(cleanedAprCommon, true, darkTheme.signalGreen, 700)

// const apy = ((1 + feeRatio24H) ** 365 - 1) * 100
// const cleanedApy = isNaN(apy) || !isFinite(apy) ? 0 : apy
Expand Down
7 changes: 4 additions & 3 deletions src/pages/Rewards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -551,14 +551,15 @@ export default function Rewards() {
console.log(e)
}

// Function to filter unique pairs with highest cleanedAprCommon value
// Function to filter unique pairs with highest totalValueLockedUSD value
const filterUniquePairs = (data: any) => {
const pairsMap = new Map()
data.forEach((obj: any) => {
const pair = obj.pair
const cleanedAprCommon = obj.cleanedAprCommon
// const cleanedAprCommon = obj.cleanedAprCommon
const totalValueLockedUSD = parseFloat(obj.totalValueLockedUSD)

if (!pairsMap.has(pair) || pairsMap.get(pair).cleanedAprCommon < cleanedAprCommon) {
if (!pairsMap.has(pair) || parseFloat(pairsMap.get(pair).totalValueLockedUSD) < totalValueLockedUSD) {
pairsMap.set(pair, obj)
}
})
Expand Down

0 comments on commit 709773b

Please sign in to comment.