Skip to content

Commit

Permalink
Merge pull request #290 from jediswaplabs/iamoskvin_fix_rewards_pair_…
Browse files Browse the repository at this point in the history
…search

case-insensitive search
  • Loading branch information
iamoskvin authored May 21, 2024
2 parents 147095b + e658ee1 commit 53ffd42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/pages/Pool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ export default function Pool() {
}
const poolsData: any = {}
poolsDataRaw?.forEach((data: any) => {
const rewardName = data?.token0?.symbol + '/' + data?.token1?.symbol
const rewardsData = jediRewards?.[rewardName]

if (rewardsData) {
const rewardName = (data?.token0?.symbol + '/' + data?.token1?.symbol).toLowerCase()
const pairKey = jediRewards ? Object.keys(jediRewards).find(key => key.toLowerCase() === rewardName) : null

if (pairKey) {
const rewardsData = jediRewards?.[pairKey]
data.aprStarknet = rewardsData.apr
}

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 @@ -456,9 +456,10 @@ export default function Rewards() {
const eligiblePools = []
try {
for (const pool of pools?.data?.poolsData) {
const pair = `${pool?.pool?.token0.symbol}/${pool?.pool?.token1.symbol}`
if (jediRewards[pair]) {
const rewardsData = jediRewards[pair]
const pair = (`${pool?.pool?.token0.symbol}/${pool?.pool?.token1.symbol}`).toLowerCase()
const pairKey = jediRewards ? Object.keys(jediRewards).find(key => key.toLowerCase() === pair) : null
if (pairKey && jediRewards[pairKey]) {
const rewardsData = jediRewards[pairKey]
const aprStarknet = rewardsData.apr * 100
// const closestAPRPeriod = findClosestAPRPeriod(pool?.period)
const closestAPRPeriod = pool?.period?.[apiTimeframeOptions.oneDay]
Expand Down

0 comments on commit 53ffd42

Please sign in to comment.