Skip to content

Commit

Permalink
fix: reward is wrapped token
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv committed Aug 14, 2023
1 parent 629739b commit 08b49e0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/state/farms/elasticv2/updater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 08b49e0

Please sign in to comment.