@stake-dao/reader 0.2.20 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/lockers/utils/getCherriesLeaderBoard.js +2 -2
- package/dist/esm/lockers/utils/getCherriesLeaderBoard.js.map +1 -1
- package/dist/esm/strategies/curve/fetch/curveApiData/getCurveApiData.js +6 -6
- package/dist/esm/strategies/curve/fetch/curveApiData/getCurveApiData.js.map +1 -1
- package/dist/esm/strategies/yearn/fetch/index.js +2 -2
- package/dist/esm/strategies/yearn/fetch/index.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/lockers/utils/getCherriesLeaderBoard.ts +2 -2
- package/src/strategies/curve/fetch/curveApiData/getCurveApiData.ts +6 -6
- package/src/strategies/yearn/fetch/index.ts +2 -2
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatUnits } from 'viem'
|
|
2
2
|
|
|
3
3
|
import { graphql } from '../../utils.js'
|
|
4
4
|
import { SDCAKE_AIRDROP_GLOBAL_QUERY, SDCAKE_AIRDROP_GRAPH_URL } from './endpoints.js'
|
|
@@ -23,7 +23,7 @@ export const getCherriesLeaderBoard = async () => {
|
|
|
23
23
|
)
|
|
24
24
|
return {
|
|
25
25
|
...user,
|
|
26
|
-
currentPoints: Number(
|
|
26
|
+
currentPoints: Number(formatUnits(currentPoints, 18)),
|
|
27
27
|
}
|
|
28
28
|
})
|
|
29
29
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ONE_YEAR, tokenWithId } from '@stake-dao/constants'
|
|
2
2
|
import { chunk, uniqBy } from 'lodash-es'
|
|
3
|
-
import { encodeAbiParameters,
|
|
3
|
+
import { encodeAbiParameters, formatUnits, parseAbiParameters, zeroAddress } from 'viem'
|
|
4
4
|
import { mainnet } from 'viem/chains'
|
|
5
5
|
import { LLAMA_API_URL } from '../../../../endpoints.js'
|
|
6
6
|
import { getLlamaTokenPrefix, getPricesFromCurve } from '../../../../prices.js'
|
|
@@ -125,7 +125,7 @@ export const getCurveApiData = async (rpc: string, chainId: number, gaugesWeight
|
|
|
125
125
|
})
|
|
126
126
|
|
|
127
127
|
const usdTotal = coinsWithUsdBalance.reduce((total: number, x) => (total += x.usdBalance), 0)
|
|
128
|
-
const lpPriceInUsd = p.totalSupply > BigInt(0) ? usdTotal / Number(
|
|
128
|
+
const lpPriceInUsd = p.totalSupply > BigInt(0) ? usdTotal / Number(formatUnits(p.totalSupply, 18)) : 0
|
|
129
129
|
|
|
130
130
|
let gaugeFromPool = CUSTOM_GAUGES[p.lp] ? CUSTOM_GAUGES[p.lp] : p.gauge
|
|
131
131
|
const gaugeData = gauges.find((g) => equalTlc(g.gauge, gaugeFromPool) || equalTlc(g.lpToken, p.lp))
|
|
@@ -139,9 +139,9 @@ export const getCurveApiData = async (rpc: string, chainId: number, gaugesWeight
|
|
|
139
139
|
const active = gaugeData && gaugeWeightData && !gaugeData.isKilled
|
|
140
140
|
|
|
141
141
|
if (active) {
|
|
142
|
-
const inflationRate = Number(
|
|
143
|
-
const relativeWeight = Number(
|
|
144
|
-
const workingSupply = Number(
|
|
142
|
+
const inflationRate = Number(formatUnits(BigInt(gaugeWeightData.inflationRate), 18))
|
|
143
|
+
const relativeWeight = Number(formatUnits(BigInt(gaugeWeightData.relativeWeight), 18))
|
|
144
|
+
const workingSupply = Number(formatUnits(gaugeData.workingSupply, 18))
|
|
145
145
|
|
|
146
146
|
if (lpPriceInUsd && lpPriceInUsd > 0 && workingSupply > 0) {
|
|
147
147
|
minCrvApr =
|
|
@@ -185,7 +185,7 @@ export const getCurveApiData = async (rpc: string, chainId: number, gaugesWeight
|
|
|
185
185
|
isLending,
|
|
186
186
|
lp: p.lp,
|
|
187
187
|
pool: p.pool,
|
|
188
|
-
totalSupply:
|
|
188
|
+
totalSupply: formatUnits(p.totalSupply, 18),
|
|
189
189
|
coins: coinsWithUsdBalance,
|
|
190
190
|
underlyingCoins: p.underlyingCoins,
|
|
191
191
|
usdTotal,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { chunk } from 'lodash-es'
|
|
2
|
-
import {
|
|
2
|
+
import { formatUnits } from 'viem'
|
|
3
3
|
|
|
4
4
|
import { ONE_YEAR, yearnStrats } from '@stake-dao/constants'
|
|
5
5
|
import multicallYearnStratsAbi from '../../../abis/yearnVaultsMulticall.js'
|
|
@@ -163,7 +163,7 @@ export const fetchYearn = async ({
|
|
|
163
163
|
]
|
|
164
164
|
|
|
165
165
|
const sdGaugeTotalSupply = chunkedRawData[index][10].result
|
|
166
|
-
const tvl = Number(
|
|
166
|
+
const tvl = Number(formatUnits(sdGaugeTotalSupply, s.lpToken.decimals)) * lpPriceInUsd
|
|
167
167
|
|
|
168
168
|
const rewardsData: RewardsData[] = s.rewards.map((rewardToken: any) => {
|
|
169
169
|
const fetchedRewardData = rewardsRawData.shift().result
|