Skip to content

Commit

Permalink
Merge pull request #39 from ReflectiveChimp/fix/apr-calc
Browse files Browse the repository at this point in the history
fix apr calc
  • Loading branch information
ReflectiveChimp authored Sep 16, 2024
2 parents 6cb1e8f + c49d397 commit 3f69d8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/queries/Vaults.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ query Vaults($since: BigInt!, $first: Int = 1000, $skip: Int = 0) {
orderDirection: desc
) {
timestamp
underlyingMainAmount0
underlyingMainAmount1
underlyingAltAmount0
underlyingAltAmount1
underlyingAmount0
underlyingAmount1
collectedAmount0
collectedAmount1
token0ToNativePrice
Expand Down
9 changes: 4 additions & 5 deletions src/routes/v1/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ const getVaultApy = (vault: VaultsQuery['clms'][0], periodSeconds: number, now:
)
),
collectTimestamp: fromUnixTime(fee.timestamp),
totalValueLocked: interpretAsDecimal(fee.underlyingMainAmount0, token0.decimals)
.plus(interpretAsDecimal(fee.underlyingAltAmount0, token0.decimals))
totalValueLocked: interpretAsDecimal(fee.underlyingAmount0, token0.decimals)
.times(interpretAsDecimal(fee.token0ToNativePrice, 18))
.plus(
interpretAsDecimal(fee.underlyingMainAmount1, token1.decimals)
.plus(interpretAsDecimal(fee.underlyingAltAmount1, token1.decimals))
.times(interpretAsDecimal(fee.token1ToNativePrice, 18))
interpretAsDecimal(fee.underlyingAmount1, token1.decimals).times(
interpretAsDecimal(fee.token1ToNativePrice, 18)
)
),
}))
);
Expand Down

0 comments on commit 3f69d8e

Please sign in to comment.