Skip to content

Commit

Permalink
chore(subgraph): Choose pools with a untracked USD thresholds (Uniswa…
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeki authored May 17, 2024
1 parent e1095da commit 7879ae8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/providers/v2/subgraph-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,16 @@ export class V2SubgraphProvider implements IV2SubgraphProvider {
// TODO: Remove. Temporary fix to ensure tokens without trackedReserveETH are in the list.
const FEI = '0x956f47f50a910163d8bf957cf5846d573e7f87ca';

const untrackedPools = pools.filter(pool =>
const tracked = pools.filter(pool =>
pool.token0.id == FEI ||
pool.token1.id == FEI ||
parseFloat(pool.trackedReserveETH) > this.trackedEthThreshold ||
parseFloat(pool.reserveUSD) > this.untrackedUsdThreshold
parseFloat(pool.trackedReserveETH) > this.trackedEthThreshold
);

metric.putMetric(`V2SubgraphProvider.chain_${this.chainId}.getPools.untracked.length`, untrackedPools.length);
metric.putMetric(`V2SubgraphProvider.chain_${this.chainId}.getPools.filter.length`, tracked.length);
metric.putMetric(
`V2SubgraphProvider.chain_${this.chainId}.getPools.untracked.percent`,
(untrackedPools.length / pools.length) * 100
`V2SubgraphProvider.chain_${this.chainId}.getPools.filter.percent`,
(tracked.length / pools.length) * 100
);

const beforeFilter = Date.now();
Expand All @@ -248,7 +247,8 @@ export class V2SubgraphProvider implements IV2SubgraphProvider {
return (
pool.token0.id == FEI ||
pool.token1.id == FEI ||
parseFloat(pool.trackedReserveETH) > this.trackedEthThreshold
parseFloat(pool.trackedReserveETH) > this.trackedEthThreshold ||
parseFloat(pool.reserveUSD) > this.untrackedUsdThreshold
);
})
.map((pool) => {
Expand All @@ -267,9 +267,9 @@ export class V2SubgraphProvider implements IV2SubgraphProvider {
});

metric.putMetric(`V2SubgraphProvider.chain_${this.chainId}.getPools.filter.latency`, Date.now() - beforeFilter);
metric.putMetric(`V2SubgraphProvider.chain_${this.chainId}.getPools.filter.length`, poolsSanitized.length);
metric.putMetric(`V2SubgraphProvider.chain_${this.chainId}.getPools.untracked.length`, poolsSanitized.length);
metric.putMetric(
`V2SubgraphProvider.chain_${this.chainId}.getPools.filter.percent`,
`V2SubgraphProvider.chain_${this.chainId}.getPools.untracked.percent`,
(poolsSanitized.length / pools.length) * 100
);
metric.putMetric(`V2SubgraphProvider.chain_${this.chainId}.getPools`, 1);
Expand Down

0 comments on commit 7879ae8

Please # to comment.