diff --git a/src/pages/Rewards/RewardPairs.ts b/src/pages/Rewards/RewardPairs.ts index 6cd18d42..662a0b9b 100644 --- a/src/pages/Rewards/RewardPairs.ts +++ b/src/pages/Rewards/RewardPairs.ts @@ -46,6 +46,42 @@ const pairs = [ tokenAddress: '0x53c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8', symbol: 'USDC' } + }, + { + rewardName: 'USDC/DAI', + poolAddress: '0x7582a77c9128e063c6f7d5a57acae969417f925904540edfac388bacaeb1fa6', + token0: { + tokenAddress: '0x53c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8', + symbol: 'USDC' + }, + token1: { + tokenAddress: '0x5574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad', + symbol: 'DAI' + } + }, + { + rewardName: 'WSTETH/ETH', + poolAddress: '0x70cda8400d7b1ee9e21f7194d320b9ad9c7a2b27e0d15a5a9967b9fefe10c76', + token0: { + tokenAddress: '0x42b8f0484674ca266ac5d08e4ac6a3fe65bd3129795def2dca5c34ecc5f96d2', + symbol: 'wstETH' + }, + token1: { + tokenAddress: '0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', + symbol: 'ETH' + } + }, + { + rewardName: 'WBTC/ETH', + poolAddress: '0x260e98362e0949fefff8b4de85367c035e44f734c9f8069b6ce2075ae86b45c', + token0: { + tokenAddress: '0x3fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac', + symbol: 'WBTC' + }, + token1: { + tokenAddress: '0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', + symbol: 'ETH' + } } ] diff --git a/src/pages/Rewards/index.tsx b/src/pages/Rewards/index.tsx index 00fadce4..5aacb4b6 100644 --- a/src/pages/Rewards/index.tsx +++ b/src/pages/Rewards/index.tsx @@ -459,24 +459,23 @@ export default function Rewards() { fetchPolicy: 'cache-first' }) const rewardsResp = await fetch(STARKNET_REWARDS_API_URL) - .then(res => res.text()) // Get the response as text - .then(text => { - const validJson = text.replace(/NaN/g, 'null') // Replace NaN with null - return JSON.parse(validJson) // Parse the corrected string as JSON - }) - const priceResp = await fetch(STRK_PRICE_API_URL).then(res => res.json()) + const rewardsRespStr = await rewardsResp.text() + const rewardsRespStrClean = rewardsRespStr.replace(/\bNaN\b/g, "null") + const rewardsRespJson = JSON.parse(rewardsRespStrClean) - const strkPrice = parseFloat(priceResp.price) - const jediRewards = rewardsResp.Jediswap_v1 + const jediRewards = rewardsRespJson.Jediswap_v1 const rewardsPositions: any = [] for (const pair of pairs) { const rewardsData = jediRewards[pair.rewardName].pop() + if (!rewardsData) { + continue + } const recentDate = rewardsData.date const pairDayData = pairsResp.data.pairDayDatas.find( dayData => dayData.pairId === pair.poolAddress && dayData.date === recentDate + 'T00:00:00' ) const aprFee = ((pairDayData.dailyVolumeUSD * 0.003) / pairDayData.reserveUSD) * 365 * 100 - const aprStarknet = (rewardsData.allocation / pairDayData.reserveUSD) * 365 * 100 * strkPrice + const aprStarknet = rewardsData.apr * 100 rewardsPositions.push({ ...pair, reserveUSD: pairDayData.reserveUSD, @@ -633,7 +632,7 @@ export default function Rewards() { pair.token1.symbol === 'ETH' ? pair.token1 : allTokens[validateAndParseAddress(pair.token1.tokenAddress)] return ( - +