Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
feat(beethoven-x): Update TVL fetcher (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwele authored Jun 16, 2022
1 parent 0d94f3f commit 7c983d5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/apps/beethoven-x/fantom/beethoven-x.tvl-fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Inject } from '@nestjs/common';
import { gql } from 'graphql-request';
import { sumBy } from 'lodash';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { Register } from '~app-toolkit/decorators';
Expand All @@ -10,16 +9,16 @@ import { Network } from '~types/network.interface';
import { BEETHOVEN_X_DEFINITION } from '../beethoven-x.definition';

type QueryResponse = {
pools: { totalLiquidity: string }[];
balancers: { totalLiquidity: string }[];
};
const QUERY = gql`
{
pools {
balancers(first: 1) {
totalLiquidity
}
}
`;
const subgraphUrl = 'https://backend.beets-ftm-node.com/graphql';
const subgraphUrl = 'https://api.thegraph.com/subgraphs/name/beethovenxfi/beethovenx';

@Register.TvlFetcher({ appId: BEETHOVEN_X_DEFINITION.id, network: Network.FANTOM_OPERA_MAINNET })
export class FantomBeethovenXTvlFetcher implements TvlFetcher {
Expand All @@ -34,7 +33,7 @@ export class FantomBeethovenXTvlFetcher implements TvlFetcher {
headers: { 'Content-Type': 'application/json' },
});

const tvl = sumBy(response.pools, pool => Number(pool.totalLiquidity));
const tvl = Number(response.balancers[0]?.totalLiquidity ?? 0);

return tvl;
}
Expand Down

0 comments on commit 7c983d5

Please sign in to comment.