Skip to content

Commit

Permalink
fix tracking tokens without price
Browse files Browse the repository at this point in the history
  • Loading branch information
vrtnd committed Sep 30, 2024
1 parent 3ca9166 commit 364cde5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/utils/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { defaultConfidenceThreshold } from "./constants";
import { transformTokenDecimals, transformTokens } from "../helpers/tokenMappings";
import { blacklist } from "../data/blacklist";
import { PublicKey } from "@solana/web3.js";
import sdk from "@defillama/sdk";
const sdk = require("@defillama/sdk");

const nullPriceCountThreshold = 10; // insert error when there are more than this many prices missing per hour/day for a bridge

Expand Down
5 changes: 2 additions & 3 deletions src/utils/wrappa/postgres/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,9 @@ export const closeIdleConnections = async (idleTimeMinutes = 3) => {
export const insertOrUpdateTokenWithoutPrice = async (token: string, symbol: string) => {
try {
await sql`
INSERT INTO bridges.tokens_without_price (token, occurrence_count, symbol)
VALUES (${token}, 1, ${symbol})
INSERT INTO bridges.tokens_without_price ${sql({ token, occurrence_count: 1, symbol })}
ON CONFLICT (token)
DO UPDATE SET occurrence_count = bridges.tokens_without_price.occurrence_count + 1;
DO UPDATE SET occurrence_count = bridges.tokens_without_price.occurrence_count + 1, symbol = ${symbol};
`;
} catch (e) {
console.error(`Could not insert or update token without price: ${token}`, e);
Expand Down

0 comments on commit 364cde5

Please sign in to comment.