@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.
- package/dist/src/engine/dynamicData/implementations/UniswapV4.js +2 -1
- package/dist/src/scripts/fill-unknown-tokens.js +58 -0
- package/dist/src/scripts/reparse-opportunities.d.ts +1 -0
- package/dist/src/{jobs → scripts}/reparse-opportunities.js +1 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- /package/dist/src/{jobs/reparse-opportunities.d.ts → scripts/fill-unknown-tokens.d.ts} +0 -0
@@ -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 =
|
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 {};
|