@merkl/api 0.20.109 → 0.20.110
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.
@@ -3,7 +3,6 @@ import { nftPositionByIdsQuery, positionMultipleOwnersQuery } from "@/libs/posit
|
|
3
3
|
import { fetchFarmedPositions } from "@/libs/positions/clamm/thegraph/fetchFarmedPositions";
|
4
4
|
import { TokenService } from "@/modules/v4/token/token.service";
|
5
5
|
import { log } from "@/utils/logger";
|
6
|
-
import { Pricer } from "@/utils/pricer";
|
7
6
|
import { isStrykeCampaign } from "@/utils/stryke";
|
8
7
|
import { A51Factory__factory, ALM, ALMMapping, AMM, AMMAlgorithm, AMMAlgorithmMapping, BN2Number, ChainInteractionService, DecodeLiquidity, EAprBreakdownType, ERC20Interface, Forwarder, JonesDoubleRewardTracker__factory, Liquidity, NETWORK_LABELS, NitroInterface, PoolInterface, PoolState, PriorityAMM, SqrtPrice, almName, ammName, getAmountsForLiquidity, getTickAtSqrtRatio, isBlacklisted, isWhitelisted, merklSubgraphAMMEndpoints, shortenAddress, spNFTInterface, withTimeout, } from "@sdk";
|
9
8
|
import axios from "axios";
|
@@ -15,7 +14,6 @@ import { fetchA51Strategies } from "../utils/fetchA51Strategies";
|
|
15
14
|
export class ClammDynamicData {
|
16
15
|
async build(chainId, campaigns) {
|
17
16
|
const dynamicData = [];
|
18
|
-
const pricer = await Pricer.load();
|
19
17
|
const calls = [];
|
20
18
|
const A51Interface = A51Factory__factory.createInterface();
|
21
19
|
/** Dedupe pools from campaigns to build pool list */
|
@@ -17,7 +17,6 @@ import moment from "moment";
|
|
17
17
|
const chainId = Number(process.env.CHAIN_ID);
|
18
18
|
if (!chainId)
|
19
19
|
throw new Error("Environment variable CHAIN_ID is required.");
|
20
|
-
const queryCampaignTypes = process.env.CAMPAIGN_TYPES ? JSON.parse(process.env.CAMPAIGN_TYPES) : [];
|
21
20
|
const highCampaignsChains = [ChainId.ARBITRUM, ChainId.POLYGON, ChainId.BLAST, ChainId.BASE];
|
22
21
|
export const main = async () => {
|
23
22
|
if (chainId === ChainId.MAINNET) {
|
@@ -57,17 +56,15 @@ export const main = async () => {
|
|
57
56
|
log.local(`Data length after filtering: ${staticData.length}`);
|
58
57
|
if (!!staticData) {
|
59
58
|
// Build list of existing campaign types for this chain
|
60
|
-
const campaignTypes =
|
61
|
-
?
|
62
|
-
:
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
.
|
67
|
-
|
68
|
-
|
69
|
-
return prev;
|
70
|
-
}, []);
|
59
|
+
const campaignTypes = !staticData
|
60
|
+
? []
|
61
|
+
: staticData
|
62
|
+
.map(campaign => campaign.campaignType)
|
63
|
+
.reduce((prev, campaignType) => {
|
64
|
+
if (!prev.includes(campaignType))
|
65
|
+
prev.push(campaignType);
|
66
|
+
return prev;
|
67
|
+
}, []);
|
71
68
|
// Fetch dynamic data for all these types
|
72
69
|
const promisesPerType = campaignTypes.map(async (campaignType) => {
|
73
70
|
const campaigns = staticData.filter(campaign => campaign.campaignType === campaignType);
|
@@ -199,7 +199,8 @@ export class TokenService {
|
|
199
199
|
static async getPrice(query) {
|
200
200
|
const tokensFound = (await TokenRepository.findMany(query)).map(TokenService.format);
|
201
201
|
if (tokensFound.length === 0) {
|
202
|
-
|
202
|
+
log.warn(`TokenService.getPrice: No token found for ${query.address} on ${query.chainId ? NETWORK_LABELS[query.chainId] : "unknwon"}. Returning 0 as price.`);
|
203
|
+
return 0;
|
203
204
|
}
|
204
205
|
// In the case of points, we want to be able to compute X points distributed per $ of TVL, hence returning 1.
|
205
206
|
const priceToken = tokensFound[0].isPoint ? 1 : (tokensFound[0].price ?? 0);
|