From 791bdadc8a779eefc17f8229e21d5308335680f4 Mon Sep 17 00:00:00 2001 From: Nguyen Van Viet Date: Mon, 14 Aug 2023 17:37:17 +0700 Subject: [PATCH] fix: reward is wrapped token (#2167) --- src/state/farms/elasticv2/updater.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/state/farms/elasticv2/updater.tsx b/src/state/farms/elasticv2/updater.tsx index 87c6a14ef7..8eab30a27d 100644 --- a/src/state/farms/elasticv2/updater.tsx +++ b/src/state/farms/elasticv2/updater.tsx @@ -170,9 +170,9 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b const prices = await fetchPrices(tokens) const formattedData: ElasticFarmV2[] = data.farmV2S.map((farm: SubgraphFarmV2) => { - const getToken = (t: SubgraphToken) => { + const getToken = (t: SubgraphToken, keepWrapped = false) => { const address = isAddressString(chainId, t.id) - return address === WETH[chainId].address || address === ZERO_ADDRESS + return (keepWrapped ? false : address === WETH[chainId].address) || address === ZERO_ADDRESS ? NativeCurrencies[chainId] : new Token( chainId, @@ -211,7 +211,9 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b Number(tvlToken0.toExact() || '0') * (prices[farm.pool.token0.id] || 0) + Number(tvlToken1.toExact() || '0') * (prices[farm.pool.token1.id] || 0) - const totalRewards = farm.rewards.map(item => CurrencyAmount.fromRawAmount(getToken(item.token), item.amount)) + const totalRewards = farm.rewards.map(item => + CurrencyAmount.fromRawAmount(getToken(item.token, true), item.amount), + ) return { id: farm.id,