@merkl/api 0.20.37 → 0.20.38

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.
@@ -172,7 +172,8 @@ export class UniswapV4DynamicData {
172
172
  const poolBalanceToken0WithoutBlacklist = poolBalanceToken0;
173
173
  const poolBalanceToken1WithoutBlacklist = poolBalanceToken1;
174
174
  // const poolLiquidityWithoutBlacklist = poolTotalLiquidity - (blacklistedLiquidity ?? 0);
175
- const tvl = poolBalanceToken0WithoutBlacklist * priceToken0 + poolBalanceToken1WithoutBlacklist * priceToken1;
175
+ const tvl = (!!priceToken0 ? poolBalanceToken0 * priceToken0 : 0) +
176
+ (!!priceToken1 ? poolBalanceToken1 * priceToken1 : 0);
176
177
  distributionMeanAPR = (yearlyToken0Rewards + yearlyToken1Rewards + yearlyFeeRewards) / tvl;
177
178
  distributionMeanAPR = !distributionMeanAPR || Number.isNaN(distributionMeanAPR) ? 0 : distributionMeanAPR;
178
179
  /**
@@ -0,0 +1,58 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
2
+ import { log } from "@/utils/logger";
3
+ import { apiDbClient } from "@db";
4
+ const tokens = await apiDbClient.token.findMany({
5
+ select: {
6
+ address: true,
7
+ chainId: true,
8
+ name: true,
9
+ symbol: true,
10
+ },
11
+ where: {
12
+ symbol: "UNKNOWN",
13
+ },
14
+ orderBy: {
15
+ id: "asc",
16
+ },
17
+ });
18
+ log.info(`found ${tokens.length} tokens with UNKNOWN symbol`);
19
+ for (const token of tokens) {
20
+ try {
21
+ const onchainData = await TokenService.fetchOnChain({
22
+ chainId: token.chainId,
23
+ address: token.address,
24
+ });
25
+ if (onchainData.name !== token.name) {
26
+ await apiDbClient.token.update({
27
+ where: {
28
+ chainId_address: {
29
+ address: token.address,
30
+ chainId: token.chainId,
31
+ },
32
+ },
33
+ data: {
34
+ name: onchainData.name,
35
+ },
36
+ });
37
+ log.info(`updated name for ${token.address} on ${token.chainId} from ${token.name} to ${onchainData.name}`);
38
+ }
39
+ if (onchainData.symbol !== token.symbol) {
40
+ await apiDbClient.token.update({
41
+ where: {
42
+ chainId_address: {
43
+ address: token.address,
44
+ chainId: token.chainId,
45
+ },
46
+ },
47
+ data: {
48
+ symbol: onchainData.symbol,
49
+ },
50
+ });
51
+ log.info(`updated name for ${token.address} on ${token.chainId} from ${token.name} to ${onchainData.name}`);
52
+ }
53
+ }
54
+ catch (e) {
55
+ console.error(e);
56
+ }
57
+ }
58
+ process.exit(0);
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ // One-off script to modify opportunity metadata
1
2
  import { metadataBuilderFactory } from "@/engine/opportunityMetadata/factory";
2
3
  import { log } from "@/utils/logger";
3
4
  import { apiDbClient } from "@db";