@merkl/api 0.20.108 → 0.20.109
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/constants.d.ts +1 -23
- package/dist/src/constants.js +1 -36
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpectraProcessor.js +3 -3
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js +3 -3
- package/dist/src/engine/implementations/Erc20/metadata.d.ts +0 -2
- package/dist/src/engine/implementations/Erc20/metadata.js +3 -10
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/gearbox/tvl.js +1 -1
- package/dist/src/engine/implementations/Erc20/tvl.js +2 -1
- package/dist/src/jobs/dynamic-data.js +1 -1
- package/dist/src/routes/v3/campaigns.js +2 -2
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/entities/campaign.d.ts +0 -58
- package/dist/src/entities/campaign.js +0 -136
- package/dist/src/modules/v4/dynamicData/dynamicData.repository.d.ts +0 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.repository.js +0 -1
- package/dist/src/types/returnTypes.d.ts +0 -19
- package/dist/src/types/returnTypes.js +0 -1
- package/dist/src/types/utils.d.ts +0 -5
- package/dist/src/types/utils.js +0 -1
package/dist/src/constants.d.ts
CHANGED
@@ -1,35 +1,13 @@
|
|
1
1
|
import { ChainId, type MerklChainId } from "@sdk";
|
2
|
-
import Big from "big.js";
|
3
|
-
export declare const zeroBN: Big.Big;
|
4
|
-
export declare const baseTestAnalyticsGraphUrl = "https://api.thegraph.com/subgraphs/name/angleprotocol/test-analytics-";
|
5
|
-
export declare const baseAnalyticsGraphUrl = "https://api.thegraph.com/subgraphs/name/angleprotocol/test-analytics-";
|
6
|
-
export declare const EXPORTER_URL = "https://exporter.angle.money";
|
7
2
|
export declare const DEFAULT_LOCAL_TTL = 120;
|
8
|
-
export declare const subgraphSuffixMapping: {
|
9
|
-
[chainId in ChainId]?: string;
|
10
|
-
};
|
11
3
|
export declare const MAX_NUM_SUBCALLS = 100;
|
12
|
-
export declare const MERKL_TREE_OPTIONS: {
|
13
|
-
hashLeaves: boolean;
|
14
|
-
sortLeaves: boolean;
|
15
|
-
sortPairs: boolean;
|
16
|
-
};
|
17
4
|
export declare const MERKL_USER_POSITION_FETCHING_TIMEOUT = 8000;
|
18
5
|
export declare const MERKL_USER_POSITION_FETCHING_GLOBAL_TIMEOUT = 10000;
|
19
|
-
export declare const MERKL_USER_CLAIMED_TOKENS_TIMEOUT = 10000;
|
20
|
-
export declare const MERKL_ALM_FETCHING_TIMEOUT = 10000;
|
21
6
|
export declare const MERKL_ALM_POSITION_FETCHING_TIMEOUT = 100000;
|
22
|
-
export declare const MERKL_USER_REWARDS_FETCHING_TIMEOUT = 10000;
|
23
|
-
export declare const GITHUB_MERKL_REWARDS_URL = "https://raw.githubusercontent.com/AngleProtocol/merkl-rewards/main/";
|
24
|
-
export declare const GCLOUD_STORAGE_MERKL_PUBLIC_URL = "https://storage.googleapis.com/merkl-production-rewards/";
|
25
|
-
export declare const MERKL_BLACKLIST: string[];
|
26
7
|
export declare const EBTC_ADDRESS = "0x661c70333AA1850CcDBAe82776Bb436A0fCfeEfB";
|
27
8
|
export declare const CDPMANAGER_ADDRESS = "0xc4cbaE499bb4Ca41E78f52F07f5d98c375711774";
|
28
9
|
export declare const SORTEDCDPS_ADDRESS = "0x591AcB5AE192c147948c12651a0a5f24f0529BE3";
|
29
10
|
export declare const RFX_DATASTORE = "0x895124783008C6c68eFcccac24c482Fdf30439B2";
|
30
|
-
export declare const DOPEX_OPTION_MARKET: {
|
31
|
-
[market: string]: string;
|
32
|
-
};
|
33
11
|
export declare const constantChain: {
|
34
12
|
[ChainId.MAINNET]: {
|
35
13
|
apw: string;
|
@@ -103,6 +81,6 @@ export declare const constantChain: {
|
|
103
81
|
};
|
104
82
|
};
|
105
83
|
export declare const MAVERICK_ZKSYNC_BP_LENS_ADDRESS = "0xd32CE31CaC98CAC0631764B8286358c0606D87F9";
|
106
|
-
export declare const
|
84
|
+
export declare const SPECTRA_NETWORK_SLUGS: {
|
107
85
|
[chainId in MerklChainId]?: string;
|
108
86
|
};
|
package/dist/src/constants.js
CHANGED
@@ -1,48 +1,13 @@
|
|
1
1
|
import { ChainId } from "@sdk";
|
2
|
-
import Big from "big.js";
|
3
|
-
export const zeroBN = new Big(0);
|
4
|
-
export const baseTestAnalyticsGraphUrl = "https://api.thegraph.com/subgraphs/name/angleprotocol/test-analytics-";
|
5
|
-
export const baseAnalyticsGraphUrl = "https://api.thegraph.com/subgraphs/name/angleprotocol/test-analytics-";
|
6
|
-
export const EXPORTER_URL = "https://exporter.angle.money";
|
7
2
|
export const DEFAULT_LOCAL_TTL = 120;
|
8
|
-
export const subgraphSuffixMapping = {
|
9
|
-
[ChainId.ARBITRUM]: "arb",
|
10
|
-
[ChainId.MAINNET]: "eth",
|
11
|
-
[ChainId.OPTIMISM]: "opt",
|
12
|
-
[ChainId.POLYGON]: "pol",
|
13
|
-
[ChainId.BASE]: "bas",
|
14
|
-
[ChainId.POLYGONZKEVM]: "zke",
|
15
|
-
};
|
16
3
|
export const MAX_NUM_SUBCALLS = 100;
|
17
|
-
export const MERKL_TREE_OPTIONS = { hashLeaves: true, sortLeaves: true, sortPairs: true };
|
18
4
|
export const MERKL_USER_POSITION_FETCHING_TIMEOUT = 8000;
|
19
5
|
export const MERKL_USER_POSITION_FETCHING_GLOBAL_TIMEOUT = 10000;
|
20
|
-
export const MERKL_USER_CLAIMED_TOKENS_TIMEOUT = 10000;
|
21
|
-
export const MERKL_ALM_FETCHING_TIMEOUT = 10000;
|
22
6
|
export const MERKL_ALM_POSITION_FETCHING_TIMEOUT = 100000;
|
23
|
-
export const MERKL_USER_REWARDS_FETCHING_TIMEOUT = 10000;
|
24
|
-
export const GITHUB_MERKL_REWARDS_URL = "https://raw.githubusercontent.com/AngleProtocol/merkl-rewards/main/";
|
25
|
-
export const GCLOUD_STORAGE_MERKL_PUBLIC_URL = "https://storage.googleapis.com/merkl-production-rewards/";
|
26
|
-
export const MERKL_BLACKLIST = [
|
27
|
-
"0xa6161c3e1bc3c743819f0be91322e108946c1a0e7666ae2885ce03c2068cbef7", // ETH - stETH fucked up by gauntlet
|
28
|
-
];
|
29
7
|
export const EBTC_ADDRESS = "0x661c70333AA1850CcDBAe82776Bb436A0fCfeEfB";
|
30
8
|
export const CDPMANAGER_ADDRESS = "0xc4cbaE499bb4Ca41E78f52F07f5d98c375711774";
|
31
9
|
export const SORTEDCDPS_ADDRESS = "0x591AcB5AE192c147948c12651a0a5f24f0529BE3";
|
32
10
|
export const RFX_DATASTORE = "0x895124783008C6c68eFcccac24c482Fdf30439B2";
|
33
|
-
export const DOPEX_OPTION_MARKET = {
|
34
|
-
// UniswapV3 pools
|
35
|
-
["0xC6962004f452bE9203591991D15f6b388e09E8D0".toLowerCase()]: "0x501B03BdB431154b8Df17BF1c00756E3a8F21744",
|
36
|
-
["0x0E4831319A50228B9e450861297aB92dee15B44F".toLowerCase()]: "0x550e7E236912DaA302F7d5D0d6e5D7b6EF191f04", // wBTC / USDC
|
37
|
-
["0xb0f6cA40411360c03d41C5fFc5F179b8403CdcF8".toLowerCase()]: "0x4eed3A2b797Bf5630517EcCe2e31C1438A76bb92",
|
38
|
-
["0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443".toLowerCase()]: "0x764fA09d0B3de61EeD242099BD9352C1C61D3d27",
|
39
|
-
["0xac70bD92F89e6739B3a08Db9B6081a923912f73D".toLowerCase()]: "0x3808E8C983023a125fFE2714E2A703A3BF02bE0d",
|
40
|
-
["0xcDa53B1F66614552F834cEeF361A8D12a0B8DaD8".toLowerCase()]: "0x77b6f45a3Dcf0493f1B9Ac9874e5982AB526AA9e",
|
41
|
-
// PCS pools
|
42
|
-
["0x843aC8dc6D34AEB07a56812b8b36429eE46BDd07".toLowerCase()]: "0x550e7E236912DaA302F7d5D0d6e5D7b6EF191f04", // wBTC / USDC
|
43
|
-
["0xd9e2a1a61b6e61b275cec326465d417e52c1b95c".toLowerCase()]: "0x501B03BdB431154b8Df17BF1c00756E3a8F21744", // wETH / USDC
|
44
|
-
["0x9fFCA51D23Ac7F7df82da414865Ef1055E5aFCc3".toLowerCase()]: "0x4eed3A2b797Bf5630517EcCe2e31C1438A76bb92", // ARB / USDC
|
45
|
-
};
|
46
11
|
const COMMON_PREFIX_STAKE = "https://lockers.stakedao.org/api/strategies/cache/curve";
|
47
12
|
const COMMON_PREFIX_CONVEX = "https://www.convexfinance.com/api/curve-apys";
|
48
13
|
export const constantChain = {
|
@@ -118,7 +83,7 @@ export const constantChain = {
|
|
118
83
|
},
|
119
84
|
};
|
120
85
|
export const MAVERICK_ZKSYNC_BP_LENS_ADDRESS = "0xd32CE31CaC98CAC0631764B8286358c0606D87F9";
|
121
|
-
export const
|
86
|
+
export const SPECTRA_NETWORK_SLUGS = {
|
122
87
|
[ChainId.MAINNET]: "mainnet",
|
123
88
|
[ChainId.ARBITRUM]: "arbitrum",
|
124
89
|
[ChainId.OPTIMISM]: "optimism",
|
package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpectraProcessor.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { SPECTRA_NETWORK_SLUGS } from "@/constants";
|
2
2
|
import { generateCardName } from "@/utils/generateCardName";
|
3
3
|
import { GenericProcessor } from "../GenericProcessor";
|
4
4
|
export class SpectraProcessor extends GenericProcessor {
|
@@ -10,11 +10,11 @@ export class SpectraProcessor extends GenericProcessor {
|
|
10
10
|
};
|
11
11
|
async processingRound5(_index, type, typeInfo, _calls, campaign, _pricer) {
|
12
12
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
13
|
-
if (!
|
13
|
+
if (!SPECTRA_NETWORK_SLUGS[campaign.computeChainId]) {
|
14
14
|
throw new Error("Network slug not found");
|
15
15
|
}
|
16
16
|
const curvePool = typeInfo.curvePool.toLowerCase();
|
17
|
-
const spectraData = (await (await fetch(`https://app.spectra.finance/api/v1/${
|
17
|
+
const spectraData = (await (await fetch(`https://app.spectra.finance/api/v1/${SPECTRA_NETWORK_SLUGS[campaign.computeChainId]}/pools`, {
|
18
18
|
headers: {
|
19
19
|
"x-client-id": "Merkl Studio",
|
20
20
|
source: "Merkl Studio",
|
package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { SPECTRA_NETWORK_SLUGS } from "@/constants";
|
2
2
|
import { generateCardName } from "@/utils/generateCardName";
|
3
3
|
import { GenericProcessor } from "../GenericProcessor";
|
4
4
|
export class SpectraYTProcessor extends GenericProcessor {
|
@@ -10,11 +10,11 @@ export class SpectraYTProcessor extends GenericProcessor {
|
|
10
10
|
};
|
11
11
|
async processingRound5(_index, type, typeInfo, _calls, campaign, _pricer) {
|
12
12
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
13
|
-
if (!
|
13
|
+
if (!SPECTRA_NETWORK_SLUGS[campaign.computeChainId]) {
|
14
14
|
throw new Error("Network slug not found");
|
15
15
|
}
|
16
16
|
const principalToken = typeInfo.principalToken.toLowerCase();
|
17
|
-
const spectraData = (await (await fetch(`https://app.spectra.finance/api/v1/${
|
17
|
+
const spectraData = (await (await fetch(`https://app.spectra.finance/api/v1/${SPECTRA_NETWORK_SLUGS[campaign.computeChainId]}/pools`, {
|
18
18
|
headers: {
|
19
19
|
"x-client-id": "Merkl Studio",
|
20
20
|
source: "Merkl Studio",
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import type { Erc20LikeCampaignEnum } from "@/engine/implementations/Erc20/subTypes";
|
2
2
|
import type { CampaignWithParams } from "@/modules/v4/campaign";
|
3
3
|
import type { OpportunityAction } from "@db/api";
|
4
|
-
import { type CampaignDynamicData, type CampaignParameters, type ChainId } from "@sdk";
|
5
4
|
import type { MetadataBuilder } from "../../metadata/interface";
|
6
5
|
type campaignType = Erc20LikeCampaignEnum;
|
7
6
|
export declare class Erc20Metadata implements MetadataBuilder<campaignType> {
|
@@ -26,6 +25,5 @@ export declare class Erc20Metadata implements MetadataBuilder<campaignType> {
|
|
26
25
|
depositUrl: string;
|
27
26
|
explorerAddress: `0x${string}`;
|
28
27
|
}>;
|
29
|
-
static generateUrl(_computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], dynamicData: CampaignDynamicData<campaignType>): string;
|
30
28
|
}
|
31
29
|
export {};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { dynamicDataBuilderFactory } from "@/engine/deprecated/dynamicData/factory";
|
2
2
|
import { OpportunityConvertorService } from "@/modules/v4/opportunity/opportunity.converter";
|
3
3
|
import { log } from "@/utils/logger";
|
4
|
-
import { Campaign as CampaignEnum
|
4
|
+
import { Campaign as CampaignEnum } from "@sdk";
|
5
5
|
import { getAddress } from "viem";
|
6
6
|
import { ProtocolService } from "../../../modules/v4/protocol/protocol.service";
|
7
7
|
import { detectSubType } from "./subTypes/detect";
|
@@ -12,6 +12,7 @@ export class Erc20Metadata {
|
|
12
12
|
const [subType] = await detectSubType(computeChainId, [
|
13
13
|
OpportunityConvertorService.convertV4CampaignToV3(CampaignEnum[type], campaign, opportunityIdentifier),
|
14
14
|
]);
|
15
|
+
log.info(`building metadata for subtype ${subType}`);
|
15
16
|
const builder = erc20SubTypeMetadataBuilderFactory(subType);
|
16
17
|
if (!!builder) {
|
17
18
|
return builder.build(campaign, opportunityIdentifier);
|
@@ -20,7 +21,7 @@ export class Erc20Metadata {
|
|
20
21
|
let action = "HOLD";
|
21
22
|
let name = `Hold ${params.symbolTargetToken}`;
|
22
23
|
let mainProtocolId = undefined;
|
23
|
-
|
24
|
+
const depositUrl = params?.url;
|
24
25
|
let tokens = [{ chainId: computeChainId, address: params.targetToken }];
|
25
26
|
try {
|
26
27
|
const [dynamicData] = await dynamicDataBuilderFactory(CampaignEnum.ERC20).build(computeChainId, [
|
@@ -44,7 +45,6 @@ export class Erc20Metadata {
|
|
44
45
|
if (!!protocol) {
|
45
46
|
mainProtocolId = protocol?.id;
|
46
47
|
}
|
47
|
-
depositUrl = Erc20Metadata.generateUrl(computeChainId, params, dynamicData);
|
48
48
|
}
|
49
49
|
catch {
|
50
50
|
log.warn(`failed to fetch dynamic data for ERC20 campaign ${campaignId}`);
|
@@ -61,11 +61,4 @@ export class Erc20Metadata {
|
|
61
61
|
explorerAddress: getAddress(params.targetToken),
|
62
62
|
};
|
63
63
|
}
|
64
|
-
static generateUrl(_computeChainId, params, dynamicData) {
|
65
|
-
const erc20type = dynamicData.typeInfo?.type;
|
66
|
-
if (erc20type === "gearbox") {
|
67
|
-
return `https://app.gearbox.fi/pools/${params.targetToken}`;
|
68
|
-
}
|
69
|
-
return params?.url;
|
70
|
-
}
|
71
64
|
}
|
@@ -20,7 +20,7 @@ export class GearboxTVLBuilder {
|
|
20
20
|
const result = await ChainInteractionService(computeChainId).fetchState(calls);
|
21
21
|
for (const [index, campaign] of campaigns.entries()) {
|
22
22
|
const underlyingTokenAddress = GearboxVaultInterface.decodeFunctionResult("underlyingToken", result[2 * index].returnData)[0];
|
23
|
-
const totalAssets =
|
23
|
+
const totalAssets = ERC4626Interface.decodeFunctionResult("totalAssets", result[2 * index + 1].returnData)[0];
|
24
24
|
const underlyingToken = await TokenService.findUniqueOrThrow({
|
25
25
|
chainId: computeChainId,
|
26
26
|
address: underlyingTokenAddress,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Erc20DynamicData } from "@/engine/deprecated/dynamicData/implementations/Erc20";
|
2
2
|
import { detectSubType } from "@/engine/implementations/Erc20/subTypes/detect";
|
3
|
+
import { log } from "@/utils/logger";
|
3
4
|
import { BN2Number, ChainInteractionService, ERC20Interface } from "@sdk";
|
4
5
|
import { erc20SubTypeTVLBuilderFactory } from "./subTypes/factories";
|
5
6
|
export class Erc20TVLBuilder {
|
@@ -11,6 +12,7 @@ export class Erc20TVLBuilder {
|
|
11
12
|
const builder = erc20SubTypeTVLBuilderFactory(subType);
|
12
13
|
const campaignsOfSubType = campaigns.filter((_campaign, index) => subTypes[index] === subType);
|
13
14
|
if (!!builder) {
|
15
|
+
log.info(`building TVLs for subtype ${subType}`);
|
14
16
|
const subTypeTVLs = await builder.build(computeChainId, campaignsOfSubType);
|
15
17
|
// Impact blacklist or whitelist
|
16
18
|
const calls = [];
|
@@ -71,7 +73,6 @@ export class Erc20TVLBuilder {
|
|
71
73
|
tvls = tvls.concat(subTypeTVLs);
|
72
74
|
}
|
73
75
|
else {
|
74
|
-
console.log(`building TVLs for subtype ${subType}`);
|
75
76
|
// @deprecated In case we don't have the new builder, use the old erc20 dynamic data
|
76
77
|
const dynamicDataList = await new Erc20DynamicData().build(computeChainId, campaignsOfSubType);
|
77
78
|
if (dynamicDataList.length !== campaignsOfSubType.length) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
@deprecated Used only for the v3/campaigns route
|
4
4
|
*/
|
5
5
|
import { Redis } from "@/cache";
|
6
|
-
import { dynamicDataBuilderFactory } from "@/engine/dynamicData/factory";
|
6
|
+
import { dynamicDataBuilderFactory } from "@/engine/deprecated/dynamicData/factory";
|
7
7
|
import { campaignsToOldFormat } from "@/libs/deprecated-merklv3";
|
8
8
|
import { merklChainData } from "@/libs/merklChainData";
|
9
9
|
import { staticCampaignWithCache } from "@/libs/staticCampaigns";
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { Redis } from "@/cache";
|
2
|
-
import { removeTestTokens } from "@/entities/campaign";
|
3
2
|
import { CampaignService } from "@/modules/v4/campaign";
|
4
3
|
import { OpportunityConvertorService } from "@/modules/v4/opportunity/opportunity.converter";
|
5
4
|
import { UnsupportedNetwork } from "@/utils/error";
|
@@ -101,7 +100,8 @@ export default (app) => app.get("/campaigns", async ({ query }) => {
|
|
101
100
|
if (!!allData) {
|
102
101
|
prev[chainIds[index]] = Object.keys(allData).reduce((acc, curr) => {
|
103
102
|
if ((types.length === 0 || types.includes(Number.parseInt(curr.split("_")[0]))) &&
|
104
|
-
(!hideTestTokens ||
|
103
|
+
(!hideTestTokens ||
|
104
|
+
!["aglamerkl", "test"].includes(allData[curr].campaignParameters.symbolRewardToken?.toLowerCase()))) {
|
105
105
|
acc[curr] = allData[curr];
|
106
106
|
}
|
107
107
|
return acc;
|