@merkl/api 0.10.199 → 0.10.200
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/eden/index.d.ts +2 -6398
- package/dist/src/errors/HttpError.d.ts +5 -0
- package/dist/src/errors/HttpError.js +6 -0
- package/dist/src/errors/NotFound.error.d.ts +4 -0
- package/dist/src/errors/NotFound.error.js +5 -0
- package/dist/src/index.d.ts +1 -2464
- package/dist/src/index.js +56 -7
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +15 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GammaProcessor.d.ts +43 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GammaProcessor.js +63 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.d.ts +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.d.ts +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.js +51 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.d.ts +0 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +15 -7
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.js +13 -572
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.d.ts +2 -21
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +197 -1174
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.d.ts +1 -5
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.js +11 -634
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.d.ts +1 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.js +10 -380
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.d.ts +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.js +11 -312
- package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.js +8 -8
- package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +3 -4
- package/dist/src/libs/campaigns/campaignsDynamicData.js +0 -5
- package/dist/src/modules/v4/accounting/accounting.controller.js +1 -1
- package/dist/src/modules/v4/apr/apr.model.d.ts +26 -0
- package/dist/src/modules/v4/apr/apr.model.js +15 -1
- package/dist/src/modules/v4/blacklist/blacklist.controller.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -4
- package/dist/src/modules/v4/campaign/campaign.controller.js +14 -4
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +50 -5
- package/dist/src/modules/v4/campaign/campaign.model.js +47 -13
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +2 -2
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +2 -2
- package/dist/src/modules/v4/chain/chain.controller.d.ts +2 -2
- package/dist/src/modules/v4/chain/chain.controller.js +7 -2
- package/dist/src/modules/v4/chain/chain.model.d.ts +6 -1
- package/dist/src/modules/v4/chain/chain.model.js +8 -1
- package/dist/src/modules/v4/chain/chain.repository.js +1 -1
- package/dist/src/modules/v4/claims/claims.controller.js +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +4 -1
- package/dist/src/modules/v4/enso/enso.model.d.ts +1 -1
- package/dist/src/modules/v4/enso/enso.model.js +2 -1
- package/dist/src/modules/v4/enso/enso.service.d.ts +0 -1
- package/dist/src/modules/v4/enso/enso.service.js +4 -4
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +26 -17
- package/dist/src/modules/v4/interaction/interaction.controller.js +19 -28
- package/dist/src/modules/v4/interaction/interaction.model.d.ts +17 -5
- package/dist/src/modules/v4/interaction/interaction.model.js +3 -3
- package/dist/src/modules/v4/interaction/interaction.service.d.ts +18 -3
- package/dist/src/modules/v4/interaction/interaction.service.js +89 -11
- package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +72 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +79 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +15 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +84 -0
- package/dist/src/modules/v4/liquidity/liquidity.controller.js +1 -1
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +224 -213
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +39 -10
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +252 -22
- package/dist/src/modules/v4/opportunity/opportunity.model.js +58 -15
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +11 -11
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +12 -232
- package/dist/src/modules/v4/opportunity/opportunity.service.js +0 -32
- package/dist/src/modules/v4/price/price.controller.js +1 -1
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +23 -24
- package/dist/src/modules/v4/protocol/protocol.controller.js +15 -9
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +13 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +12 -8
- package/dist/src/modules/v4/reward/reward.controller.js +1 -1
- package/dist/src/modules/v4/reward/reward.model.d.ts +44 -1
- package/dist/src/modules/v4/reward/reward.model.js +15 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.service.d.ts +11 -11
- package/dist/src/modules/v4/reward/reward.service.js +1 -1
- package/dist/src/modules/v4/router.d.ts +287 -268
- package/dist/src/modules/v4/status/status.controller.js +2 -3
- package/dist/src/modules/v4/status/status.model.d.ts +12 -0
- package/dist/src/modules/v4/status/status.model.js +12 -0
- package/dist/src/modules/v4/token/token.controller.d.ts +4 -4
- package/dist/src/modules/v4/token/token.controller.js +1 -1
- package/dist/src/modules/v4/token/token.model.d.ts +12 -0
- package/dist/src/modules/v4/token/token.model.js +12 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +2 -2
- package/dist/src/modules/v4/token/token.service.d.ts +7 -7
- package/dist/src/modules/v4/tvl/tvl.model.d.ts +24 -0
- package/dist/src/modules/v4/tvl/tvl.model.js +15 -1
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +1 -1
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +9 -8
- package/dist/src/modules/v4/user/user.controller.d.ts +4 -4
- package/dist/src/modules/v4/user/user.controller.js +20 -17
- package/dist/src/modules/v4/user/user.model.d.ts +30 -0
- package/dist/src/modules/v4/user/user.model.js +27 -0
- package/dist/src/modules/v4/zyfi/zyfi.model.d.ts +45 -0
- package/dist/src/modules/v4/zyfi/zyfi.model.js +1 -0
- package/dist/src/modules/v4/zyfi/zyfi.service.d.ts +30 -0
- package/dist/src/modules/v4/zyfi/zyfi.service.js +35 -0
- package/dist/src/plugins/error-handling.plugin.d.ts +2 -2
- package/dist/src/plugins/error-handling.plugin.js +9 -3
- package/dist/src/plugins/logger.plugin.js +1 -20
- package/dist/src/routes/v1/allowances.d.ts +1 -1
- package/dist/src/routes/v1/allowances.js +1 -1
- package/dist/src/routes/v1/balances.d.ts +1 -1
- package/dist/src/routes/v1/balances.js +1 -1
- package/dist/src/routes/v1/prices.d.ts +1 -1
- package/dist/src/routes/v1/prices.js +1 -1
- package/dist/src/routes/v1/router.d.ts +102 -0
- package/dist/src/routes/v1/router.js +6 -0
- package/dist/src/routes/v1/tokens.d.ts +1 -1
- package/dist/src/routes/v1/tokens.js +1 -1
- package/dist/src/routes/v2/merkl.d.ts +5 -5
- package/dist/src/routes/v2/merkl.js +1 -1
- package/dist/src/routes/v2/router.d.ts +46 -0
- package/dist/src/routes/v2/router.js +3 -0
- package/dist/src/routes/v3/app.d.ts +1 -1
- package/dist/src/routes/v3/app.js +1 -1
- package/dist/src/routes/v3/blacklist.d.ts +1 -2479
- package/dist/src/routes/v3/blacklist.js +1 -1
- package/dist/src/routes/v3/campaignClaims.d.ts +1 -1
- package/dist/src/routes/v3/campaignClaims.js +1 -1
- package/dist/src/routes/v3/campaignReport.d.ts +1 -1
- package/dist/src/routes/v3/campaignReport.js +1 -1
- package/dist/src/routes/v3/campaignUnclaimed.d.ts +1 -1
- package/dist/src/routes/v3/campaignUnclaimed.js +1 -1
- package/dist/src/routes/v3/campaigns.d.ts +1 -2483
- package/dist/src/routes/v3/campaigns.js +1 -1
- package/dist/src/routes/v3/campaignsForMainParameter.d.ts +1 -1
- package/dist/src/routes/v3/campaignsForMainParameter.js +1 -1
- package/dist/src/routes/v3/campaignsInfo.d.ts +1 -2481
- package/dist/src/routes/v3/campaignsInfo.js +1 -1
- package/dist/src/routes/v3/campaignsRewardsReport.d.ts +1 -1
- package/dist/src/routes/v3/campaignsRewardsReport.js +1 -1
- package/dist/src/routes/v3/claims.d.ts +1 -1
- package/dist/src/routes/v3/claims.js +1 -1
- package/dist/src/routes/v3/compoundV2.d.ts +1 -1
- package/dist/src/routes/v3/compoundV2.js +1 -1
- package/dist/src/routes/v3/createCampaign.d.ts +1 -1
- package/dist/src/routes/v3/createCampaign.js +1 -1
- package/dist/src/routes/v3/dolomite.d.ts +1 -1
- package/dist/src/routes/v3/dolomite.js +1 -1
- package/dist/src/routes/v3/euler.d.ts +1 -1
- package/dist/src/routes/v3/euler.js +1 -1
- package/dist/src/routes/v3/fetch.d.ts +1 -1
- package/dist/src/routes/v3/fetch.js +1 -1
- package/dist/src/routes/v3/health.d.ts +1 -1
- package/dist/src/routes/v3/health.js +1 -1
- package/dist/src/routes/v3/lostyield.d.ts +1 -1
- package/dist/src/routes/v3/lostyield.js +1 -1
- package/dist/src/routes/v3/merkl.d.ts +1 -1
- package/dist/src/routes/v3/merkl.js +1 -1
- package/dist/src/routes/v3/morphoMarkets.d.ts +1 -1
- package/dist/src/routes/v3/morphoMarkets.js +1 -1
- package/dist/src/routes/v3/morphoVaults.d.ts +1 -1
- package/dist/src/routes/v3/morphoVaults.js +1 -1
- package/dist/src/routes/v3/multiChainPositions.d.ts +1 -2480
- package/dist/src/routes/v3/multiChainPositions.js +1 -1
- package/dist/src/routes/v3/opportunity.d.ts +1 -2483
- package/dist/src/routes/v3/opportunity.js +1 -1
- package/dist/src/routes/v3/overview.d.ts +1 -1
- package/dist/src/routes/v3/overview.js +1 -1
- package/dist/src/routes/v3/parse.d.ts +1 -1
- package/dist/src/routes/v3/parse.js +1 -1
- package/dist/src/routes/v3/payload.d.ts +1 -1
- package/dist/src/routes/v3/payload.js +1 -1
- package/dist/src/routes/v3/poolInfo.js +1 -1
- package/dist/src/routes/v3/positions.d.ts +1 -2479
- package/dist/src/routes/v3/positions.js +1 -1
- package/dist/src/routes/v3/radiant.d.ts +1 -1
- package/dist/src/routes/v3/radiant.js +1 -1
- package/dist/src/routes/v3/recipients.d.ts +1 -1
- package/dist/src/routes/v3/recipients.js +1 -1
- package/dist/src/routes/v3/rewards.d.ts +1 -2508
- package/dist/src/routes/v3/rewards.js +1 -1
- package/dist/src/routes/v3/rewardsReport.d.ts +1 -1
- package/dist/src/routes/v3/rewardsReport.js +1 -1
- package/dist/src/routes/v3/router.d.ts +1 -0
- package/dist/src/routes/v3/router.js +74 -0
- package/dist/src/routes/v3/silo.d.ts +1 -1
- package/dist/src/routes/v3/silo.js +1 -1
- package/dist/src/routes/v3/token.d.ts +1 -1
- package/dist/src/routes/v3/token.js +1 -1
- package/dist/src/routes/v3/tokenUnclaimed.d.ts +1 -1
- package/dist/src/routes/v3/tokenUnclaimed.js +1 -1
- package/dist/src/routes/v3/updates.d.ts +1 -2483
- package/dist/src/routes/v3/updates.js +1 -1
- package/dist/src/routes/v3/userRewards.d.ts +1 -2499
- package/dist/src/routes/v3/userRewards.js +1 -1
- package/dist/src/utils/decodeCalls.js +12 -1
- package/dist/src/utils/encodeCalls.js +26 -3
- package/dist/src/utils/generateCardName.js +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +0 -155
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.js +0 -24
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +0 -230
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.js +0 -75
package/package.json
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
"@elysiajs/cors": "^1.1.1",
|
34
34
|
"@elysiajs/eden": "^1.1.3",
|
35
35
|
"@elysiajs/opentelemetry": "^1.1.7",
|
36
|
-
"@elysiajs/swagger": "^
|
36
|
+
"@elysiajs/swagger": "^1.1.6",
|
37
37
|
"@ethersproject/abi": "^5.7.0",
|
38
38
|
"@google-cloud/storage": "^7.14.0",
|
39
39
|
"@opentelemetry/auto-instrumentations-node": "^0.55.0",
|
@@ -51,7 +51,6 @@
|
|
51
51
|
"commander": "^12.1.0",
|
52
52
|
"crypto-js": "^4.2.0",
|
53
53
|
"elysia": "1.1.26",
|
54
|
-
"elysia-autoroutes": "^0.5.0",
|
55
54
|
"elysia-rate-limit": "^4.1.0",
|
56
55
|
"ethers": "^5.7.2",
|
57
56
|
"ethers-types": "3.17.0",
|
@@ -90,5 +89,5 @@
|
|
90
89
|
"access": "public",
|
91
90
|
"registry": "https://registry.npmjs.org/"
|
92
91
|
},
|
93
|
-
"version": "v0.10.
|
92
|
+
"version": "v0.10.200"
|
94
93
|
}
|
@@ -1,3 +0,0 @@
|
|
1
|
-
import { type Campaign, type CampaignDynamicData, type CampaignParameters, type MerklChainId } from "@sdk";
|
2
|
-
import type { UncachedResult } from "../../../utils/execute";
|
3
|
-
export declare function ERC20DynamicDataRefacto(chainId: MerklChainId, campaigns: CampaignParameters<Campaign.ERC20>[]): Promise<UncachedResult<Partial<CampaignDynamicData<Campaign.ERC20>[]>>>;
|
@@ -1,155 +0,0 @@
|
|
1
|
-
import { merklChainDataWithCache } from "../../merklChainData";
|
2
|
-
import { BN2Number, BalancerPoolInterface, ERC20Interface, EnzymeInterface, FactoryInterface, MetamorphoInterface, YEAR, } from "@sdk";
|
3
|
-
import { batchMulticallCallWithRetry } from "../../../utils/generic";
|
4
|
-
import { Pricer } from "../../../utils/pricer";
|
5
|
-
import { getLastEligibilityRatio } from "../utils/getLastEligibilityRatio";
|
6
|
-
import { tokenType } from "./ERC20SubTypes/helpers/tokenType";
|
7
|
-
import { getTokenPricesInfo } from "./ERC20SubTypes/subtypesPricesRefactoFinal";
|
8
|
-
import { getTokenTypeRound1 } from "./ERC20SubTypes/subtypesRound1RefactoFinal";
|
9
|
-
import { getTokenTypeRound2 } from "./ERC20SubTypes/subtypesRound2RefactoFinal";
|
10
|
-
import { getTokenTypeRound3 } from "./ERC20SubTypes/subtypesRound3RefactoFinal";
|
11
|
-
import { getTokenTypeRound4 } from "./ERC20SubTypes/subtypesRound4RefactoFinal";
|
12
|
-
export async function ERC20DynamicDataRefacto(chainId, campaigns) {
|
13
|
-
const pricer = await Pricer.load();
|
14
|
-
const currentRoot = (await merklChainDataWithCache(chainId)).merkleRoot;
|
15
|
-
// Round 1: Get the high level type for each token (will need to be refined lated with more calls)
|
16
|
-
const callsRounds1 = [];
|
17
|
-
for (const campaign of campaigns) {
|
18
|
-
// Keep this commented, only use for tests
|
19
|
-
// if (campaign.campaignId === "0xf09492c6d3bd475e269e9f90c92d7e11a671a8fc43470b424ccbb0eea67b762e") {
|
20
|
-
// // Filament test
|
21
|
-
// campaign.campaignParameters.targetToken = "0xe855B8018C22A05F84724e93693caf166912aDD5";
|
22
|
-
// }
|
23
|
-
if ([
|
24
|
-
"0xb9bf1ace04e702363bd76b5828ca64a00984af9118672be96c1c200943da941f",
|
25
|
-
"0x1ad188dd597199ca8e6d6a01d5af362769f46bb749da5c08d27eaec4397f53b5",
|
26
|
-
].includes(campaign.campaignId)) {
|
27
|
-
campaign.campaignParameters.url = "https://moonwell.fi/markets/supply/base/usdc";
|
28
|
-
}
|
29
|
-
if (campaign.campaignId === "0xb656fa534c487d3d7c94a5ac2c265acde0d5b7a7c562548c58cfcbf4f7f552f4") {
|
30
|
-
campaign.campaignParameters.url = "https://app.indexcoop.com/swap/eth/hyeth";
|
31
|
-
}
|
32
|
-
callsRounds1.push({
|
33
|
-
allowFailure: true,
|
34
|
-
callData: FactoryInterface.encodeFunctionData("factory"),
|
35
|
-
target: campaign.campaignParameters.targetToken,
|
36
|
-
}, {
|
37
|
-
allowFailure: true,
|
38
|
-
callData: MetamorphoInterface.encodeFunctionData("MORPHO"),
|
39
|
-
target: campaign.campaignParameters.targetToken,
|
40
|
-
}, {
|
41
|
-
allowFailure: true,
|
42
|
-
callData: ERC20Interface.encodeFunctionData("name"),
|
43
|
-
target: campaign.campaignParameters.targetToken,
|
44
|
-
}, {
|
45
|
-
allowFailure: true,
|
46
|
-
callData: BalancerPoolInterface.encodeFunctionData("getPoolId"),
|
47
|
-
target: campaign.campaignParameters.targetToken,
|
48
|
-
}, {
|
49
|
-
allowFailure: true,
|
50
|
-
callData: EnzymeInterface.encodeFunctionData("getCreator"),
|
51
|
-
target: campaign.campaignParameters.targetToken,
|
52
|
-
});
|
53
|
-
}
|
54
|
-
const resultRound1 = await batchMulticallCallWithRetry(chainId, {
|
55
|
-
calls: callsRounds1,
|
56
|
-
});
|
57
|
-
const tokenTypesByCampaign = {};
|
58
|
-
// Round 2: Decode result from round 1 and get some additional info for the types before the final calls
|
59
|
-
const callsRounds2 = [];
|
60
|
-
let i = 0;
|
61
|
-
for (const campaign of campaigns) {
|
62
|
-
let typeStruct = {
|
63
|
-
type: tokenType.unknown,
|
64
|
-
calls: [],
|
65
|
-
typeInfo: {},
|
66
|
-
};
|
67
|
-
typeStruct = getTokenTypeRound1(resultRound1, campaign.campaignParameters.targetToken, i, campaign);
|
68
|
-
i += 5;
|
69
|
-
tokenTypesByCampaign[campaign.campaignId] = typeStruct;
|
70
|
-
callsRounds2.push(...typeStruct.calls);
|
71
|
-
}
|
72
|
-
const resultRound2 = await batchMulticallCallWithRetry(chainId, {
|
73
|
-
calls: callsRounds2,
|
74
|
-
});
|
75
|
-
// Round 3: Decode result from round 2 and get some additional info for the types before the final calls
|
76
|
-
const callsRounds3 = [];
|
77
|
-
let j = 0;
|
78
|
-
for (const campaign of campaigns) {
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
80
|
-
const callsForCampaign = tokenTypesByCampaign[campaign.campaignId].calls.length;
|
81
|
-
tokenTypesByCampaign[campaign.campaignId] = getTokenTypeRound2(j, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, resultRound2);
|
82
|
-
j += callsForCampaign;
|
83
|
-
callsRounds3.push(...tokenTypesByCampaign[campaign.campaignId].calls);
|
84
|
-
}
|
85
|
-
const resultRound3 = await batchMulticallCallWithRetry(chainId, {
|
86
|
-
calls: callsRounds3,
|
87
|
-
});
|
88
|
-
// Final round before execute
|
89
|
-
let callsFinal = [];
|
90
|
-
j = 0;
|
91
|
-
for (const campaign of campaigns) {
|
92
|
-
const callsForCampaign = tokenTypesByCampaign[campaign.campaignId].calls.length;
|
93
|
-
tokenTypesByCampaign[campaign.campaignId] = getTokenTypeRound3(j, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, resultRound3);
|
94
|
-
j += callsForCampaign;
|
95
|
-
callsFinal = callsFinal.concat(tokenTypesByCampaign[campaign.campaignId].calls);
|
96
|
-
}
|
97
|
-
// Round 4: Get the final data
|
98
|
-
const resultsFinal = await batchMulticallCallWithRetry(chainId, {
|
99
|
-
calls: callsFinal,
|
100
|
-
});
|
101
|
-
j = 0;
|
102
|
-
let calls = [];
|
103
|
-
for (const campaign of campaigns) {
|
104
|
-
const callsForCampaign = tokenTypesByCampaign[campaign.campaignId].calls.length;
|
105
|
-
tokenTypesByCampaign[campaign.campaignId] = getTokenTypeRound4(j, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, resultsFinal, campaign);
|
106
|
-
j += callsForCampaign;
|
107
|
-
calls = calls.concat(tokenTypesByCampaign[campaign.campaignId].calls);
|
108
|
-
}
|
109
|
-
return {
|
110
|
-
cached: false,
|
111
|
-
call: {
|
112
|
-
callData: calls,
|
113
|
-
handler: () => { },
|
114
|
-
reducer: async (result) => {
|
115
|
-
let i = 0;
|
116
|
-
const dynamicData = [];
|
117
|
-
for (const campaign of campaigns) {
|
118
|
-
const priceRewardToken = (await pricer.get({
|
119
|
-
address: campaign.rewardToken,
|
120
|
-
chainId,
|
121
|
-
symbol: campaign.campaignParameters.symbolRewardToken,
|
122
|
-
})) ?? 0;
|
123
|
-
// Get the data from the final round and process it to get the price of the target token and some extra info
|
124
|
-
const callsForCampaign = tokenTypesByCampaign[campaign.campaignId].calls.length;
|
125
|
-
tokenTypesByCampaign[campaign.campaignId] = await getTokenPricesInfo(i, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, result, campaign, pricer);
|
126
|
-
i += callsForCampaign;
|
127
|
-
const whitelistedSupplyTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.whitelistedSupplyTargetToken;
|
128
|
-
const totalSupplyTargetToken = whitelistedSupplyTargetToken;
|
129
|
-
const priceTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.priceTargetToken;
|
130
|
-
let lastEligibilityRatio = 1;
|
131
|
-
if (!!campaign.campaignParameters.hooks?.length) {
|
132
|
-
lastEligibilityRatio = await getLastEligibilityRatio(campaign, chainId, currentRoot, []);
|
133
|
-
}
|
134
|
-
dynamicData.push({
|
135
|
-
...campaign,
|
136
|
-
apr: (lastEligibilityRatio *
|
137
|
-
(priceRewardToken *
|
138
|
-
BN2Number(campaign.amount, campaign.campaignParameters.decimalsRewardToken) *
|
139
|
-
YEAR *
|
140
|
-
100)) /
|
141
|
-
campaign.campaignParameters.duration /
|
142
|
-
(whitelistedSupplyTargetToken * priceTargetToken),
|
143
|
-
totalSupplyTargetToken,
|
144
|
-
tvl: whitelistedSupplyTargetToken * priceTargetToken,
|
145
|
-
type: tokenTypesByCampaign[campaign.campaignId].type,
|
146
|
-
typeInfo: tokenTypesByCampaign[campaign.campaignId].typeInfo,
|
147
|
-
priceRewardToken: priceRewardToken,
|
148
|
-
lastEligibilityRatio,
|
149
|
-
});
|
150
|
-
}
|
151
|
-
return dynamicData;
|
152
|
-
},
|
153
|
-
},
|
154
|
-
};
|
155
|
-
}
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import type { Pricer } from "../../../../utils/pricer";
|
2
|
-
import type { Campaign, CampaignParameters } from "@sdk";
|
3
|
-
import { tokenType, type tokenTypeStruct } from "./helpers/tokenType";
|
4
|
-
export declare function getTokenPricesInfo(index: number, type: tokenType, typeInfo: any, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<tokenTypeStruct>;
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { tokenType } from "./helpers/tokenType";
|
2
|
-
import { processorMapping } from "./processor/processorMapping";
|
3
|
-
export async function getTokenPricesInfo(index, type, typeInfo, calls, campaign, pricer) {
|
4
|
-
const ProcessorClass = processorMapping[type];
|
5
|
-
try {
|
6
|
-
if (!ProcessorClass) {
|
7
|
-
throw new Error(`Processor not found for key: ${type}`);
|
8
|
-
}
|
9
|
-
const processorObject = new ProcessorClass();
|
10
|
-
return processorObject.computeRound5(index, type, typeInfo, calls, campaign, pricer);
|
11
|
-
}
|
12
|
-
catch (error) {
|
13
|
-
console.error(error);
|
14
|
-
return {
|
15
|
-
type: tokenType.unknown,
|
16
|
-
calls: [],
|
17
|
-
typeInfo: {
|
18
|
-
totalSupply: 0,
|
19
|
-
blacklistedSupply: 0,
|
20
|
-
priceTargetToken: 0,
|
21
|
-
},
|
22
|
-
};
|
23
|
-
}
|
24
|
-
}
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import type { Campaign, CampaignParameters } from "@sdk";
|
2
|
-
import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
|
3
|
-
import { type tokenTypeStruct } from "./helpers/tokenType";
|
4
|
-
export declare function getTokenTypeRound1(calls: Multicall3.ResultStructOutput[], targetToken: string, index: number, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
|
@@ -1,230 +0,0 @@
|
|
1
|
-
import { decodeCall } from "../../../../utils/decodeCalls";
|
2
|
-
import { enzymeFundValueCalculatorRouterMapping, getTypeFromFactoryAddress } from "./helpers/factoryFinder";
|
3
|
-
import { tokenType } from "./helpers/tokenType";
|
4
|
-
import { processorMapping } from "./processor/processorMapping";
|
5
|
-
function satisfiesNameConditions(name, type) {
|
6
|
-
const lowerCaseName = name.toLowerCase();
|
7
|
-
switch (type) {
|
8
|
-
case tokenType.fraxlend:
|
9
|
-
return lowerCaseName.includes("fraxlend interest bearing");
|
10
|
-
case tokenType.sturdy_aggregator:
|
11
|
-
return lowerCaseName.includes("aggregator");
|
12
|
-
case tokenType.sturdy_silo:
|
13
|
-
return lowerCaseName.includes("sturdy interest bearing");
|
14
|
-
case tokenType.aura:
|
15
|
-
return lowerCaseName.includes("aura deposit vault");
|
16
|
-
case tokenType.poolside:
|
17
|
-
return lowerCaseName.includes("poolside");
|
18
|
-
case tokenType.balancerGauge:
|
19
|
-
return lowerCaseName.includes("balancer") && !lowerCaseName.includes("aura deposit vault");
|
20
|
-
case tokenType.gearbox:
|
21
|
-
return lowerCaseName.includes("farming of");
|
22
|
-
case tokenType.euler_borrow:
|
23
|
-
return lowerCaseName.startsWith("debt token of evk vault");
|
24
|
-
case tokenType.euler_lend:
|
25
|
-
return lowerCaseName.includes("evk vault");
|
26
|
-
case tokenType.fluid:
|
27
|
-
return lowerCaseName.startsWith("fluid");
|
28
|
-
case tokenType.filament:
|
29
|
-
return lowerCaseName.startsWith("filament");
|
30
|
-
case tokenType.radiant_lend:
|
31
|
-
return lowerCaseName.includes("radiant interest");
|
32
|
-
case tokenType.radiant_borrow:
|
33
|
-
return lowerCaseName.includes("radiant variable debt");
|
34
|
-
case tokenType.ionic:
|
35
|
-
return lowerCaseName.includes("ionic");
|
36
|
-
case tokenType.rfx:
|
37
|
-
return lowerCaseName.includes("rfx");
|
38
|
-
case tokenType.layerbank:
|
39
|
-
return lowerCaseName.includes("layerbank");
|
40
|
-
case tokenType.moonwell:
|
41
|
-
return lowerCaseName.includes("moonwell");
|
42
|
-
case tokenType.curve_2:
|
43
|
-
return (lowerCaseName === "crvusd/frax" ||
|
44
|
-
lowerCaseName === "ezeth/wfrxeth" ||
|
45
|
-
lowerCaseName === "pufeth/wsteth" ||
|
46
|
-
lowerCaseName === "hai/lusd");
|
47
|
-
case tokenType.silostaking:
|
48
|
-
return lowerCaseName === "isei";
|
49
|
-
case tokenType.beefy:
|
50
|
-
return lowerCaseName.startsWith("moo velo");
|
51
|
-
case tokenType.uniswapv2:
|
52
|
-
return lowerCaseName.includes("uniswap");
|
53
|
-
case tokenType.fenix:
|
54
|
-
return lowerCaseName.includes("stablev1 amm");
|
55
|
-
case tokenType.ra:
|
56
|
-
return lowerCaseName.includes("volatile pair -") || lowerCaseName.includes("correlated pair -");
|
57
|
-
case tokenType.syncswap:
|
58
|
-
return lowerCaseName.includes("syncswap");
|
59
|
-
case tokenType.aave_lending:
|
60
|
-
return lowerCaseName.includes("aave");
|
61
|
-
case tokenType.aave_borrowing:
|
62
|
-
return lowerCaseName.includes("aave") && lowerCaseName.includes("debt");
|
63
|
-
case tokenType.yei_borrowing:
|
64
|
-
return ((lowerCaseName.startsWith("yei") || (lowerCaseName.includes("aave") && lowerCaseName.includes("yei"))) &&
|
65
|
-
lowerCaseName.includes("debt"));
|
66
|
-
case tokenType.ironclad_borrowing:
|
67
|
-
return ((lowerCaseName.startsWith("ironclad") ||
|
68
|
-
(lowerCaseName.includes("aave") && lowerCaseName.includes("ironclad"))) &&
|
69
|
-
lowerCaseName.includes("debt") &&
|
70
|
-
name.toLowerCase() !== "ironclad token");
|
71
|
-
case tokenType.zerolend_borrowing:
|
72
|
-
return lowerCaseName.includes("zerolend") && lowerCaseName.includes("debt");
|
73
|
-
case tokenType.yei_lending:
|
74
|
-
return lowerCaseName.startsWith("yei") || (lowerCaseName.includes("aave") && lowerCaseName.includes("yei"));
|
75
|
-
case tokenType.ironclad_lending:
|
76
|
-
return ((lowerCaseName.startsWith("ironclad") ||
|
77
|
-
(lowerCaseName.includes("aave") && lowerCaseName.includes("ironclad"))) &&
|
78
|
-
name.toLowerCase() !== "ironclad token");
|
79
|
-
case tokenType.zerolend_lending:
|
80
|
-
return lowerCaseName.includes("zerolend");
|
81
|
-
case tokenType.compound:
|
82
|
-
return lowerCaseName.includes("compound");
|
83
|
-
case tokenType.ironcladStaking:
|
84
|
-
return lowerCaseName === "ironclad token";
|
85
|
-
case tokenType.woofi:
|
86
|
-
return lowerCaseName.includes("woofi");
|
87
|
-
case tokenType.maverickBoostedPosition:
|
88
|
-
return lowerCaseName.includes("maverick");
|
89
|
-
case tokenType.zkSwapThreePool:
|
90
|
-
return lowerCaseName.includes("zf");
|
91
|
-
case tokenType.maha:
|
92
|
-
return lowerCaseName.includes("staked") && lowerCaseName.includes("maha");
|
93
|
-
case tokenType.tempest:
|
94
|
-
return lowerCaseName.startsWith("ts");
|
95
|
-
case tokenType.tempestStaking:
|
96
|
-
return lowerCaseName.startsWith("tempest");
|
97
|
-
case tokenType.holdstation:
|
98
|
-
return lowerCaseName.startsWith("hs");
|
99
|
-
default:
|
100
|
-
return false;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
function generateResult(type, name, targetToken, typeInfo) {
|
104
|
-
const ProcessorClass = processorMapping[type];
|
105
|
-
if (!ProcessorClass) {
|
106
|
-
throw new Error(`Processor not found for key: ${type}`);
|
107
|
-
}
|
108
|
-
const processorObject = new ProcessorClass();
|
109
|
-
typeInfo = {
|
110
|
-
...typeInfo,
|
111
|
-
name: name,
|
112
|
-
tokenAddress: targetToken,
|
113
|
-
totalSupply: 0,
|
114
|
-
blacklistedSupply: 0,
|
115
|
-
};
|
116
|
-
return processorObject.computeRound1(type, typeInfo);
|
117
|
-
}
|
118
|
-
function processNamingConditions(type, name, targetToken) {
|
119
|
-
if (satisfiesNameConditions(name, type)) {
|
120
|
-
return generateResult(type, name, targetToken, {});
|
121
|
-
}
|
122
|
-
}
|
123
|
-
function processNamingConditionsInOrder(types, name, targetToken) {
|
124
|
-
for (const type of types) {
|
125
|
-
const result = processNamingConditions(type, name, targetToken);
|
126
|
-
if (result)
|
127
|
-
return result;
|
128
|
-
}
|
129
|
-
}
|
130
|
-
function parseForFactory(calls, index, targetToken) {
|
131
|
-
try {
|
132
|
-
const factory = decodeCall(calls, index, "factory");
|
133
|
-
const name = decodeCall(calls, index + 2, "name");
|
134
|
-
const type = getTypeFromFactoryAddress(factory);
|
135
|
-
if (type !== tokenType.unknown)
|
136
|
-
return generateResult(type, name, targetToken, { factory });
|
137
|
-
}
|
138
|
-
catch (e) {
|
139
|
-
// No factory on this token
|
140
|
-
}
|
141
|
-
}
|
142
|
-
function parseForEnzyme(calls, index, targetToken) {
|
143
|
-
// Enzyme check
|
144
|
-
try {
|
145
|
-
const dispatcher = decodeCall(calls, index + 4, "getCreator");
|
146
|
-
const name = decodeCall(calls, index + 2, "name");
|
147
|
-
const type = getTypeFromFactoryAddress(dispatcher);
|
148
|
-
const fundValueCalculator = enzymeFundValueCalculatorRouterMapping[dispatcher];
|
149
|
-
const typeInfo = {
|
150
|
-
fundValueCalculator,
|
151
|
-
dispatcher,
|
152
|
-
};
|
153
|
-
if (type === tokenType.enzyme) {
|
154
|
-
return generateResult(type, name, targetToken, typeInfo);
|
155
|
-
}
|
156
|
-
}
|
157
|
-
catch (e) {
|
158
|
-
// No factory on this token
|
159
|
-
}
|
160
|
-
}
|
161
|
-
function parseForMetamorpho(calls, index, targetToken) {
|
162
|
-
// MetaMorpho check
|
163
|
-
try {
|
164
|
-
decodeCall(calls, index + 1, "MORPHO");
|
165
|
-
const name = decodeCall(calls, index + 2, "name");
|
166
|
-
return generateResult(tokenType.metamorpho, name, targetToken, {});
|
167
|
-
}
|
168
|
-
catch (e) {
|
169
|
-
// Not a metamorpho token
|
170
|
-
}
|
171
|
-
}
|
172
|
-
function parseForBalancer(calls, index, targetToken, name) {
|
173
|
-
// Check for balancer pools
|
174
|
-
try {
|
175
|
-
decodeCall(calls, index + 3, "getPoolId");
|
176
|
-
return generateResult(tokenType.balancerPool, name, targetToken, {});
|
177
|
-
}
|
178
|
-
catch (e) {
|
179
|
-
// Not a balancer pool
|
180
|
-
}
|
181
|
-
}
|
182
|
-
function parseForStaking(campaign, calls, index, targetToken) {
|
183
|
-
try {
|
184
|
-
const whitelist = campaign.campaignParameters.whitelist;
|
185
|
-
if (whitelist.length === 1) {
|
186
|
-
const forwarders = campaign.campaignParameters.forwarders;
|
187
|
-
if (forwarders.length === 1) {
|
188
|
-
if (forwarders[0].sender === whitelist[0]) {
|
189
|
-
const name = decodeCall(calls, index + 2, "name");
|
190
|
-
return generateResult(tokenType.staking, name, targetToken, { stakingContract: whitelist[0] });
|
191
|
-
}
|
192
|
-
}
|
193
|
-
}
|
194
|
-
}
|
195
|
-
catch (e) {
|
196
|
-
// No factory on this token
|
197
|
-
// console.log(e);
|
198
|
-
}
|
199
|
-
}
|
200
|
-
export function getTokenTypeRound1(calls, targetToken, index, campaign) {
|
201
|
-
const returnValueOfCalls = calls.map(call => call.returnData);
|
202
|
-
let result = parseForFactory(returnValueOfCalls, index, targetToken);
|
203
|
-
if (result)
|
204
|
-
return result;
|
205
|
-
result = parseForEnzyme(returnValueOfCalls, index, targetToken);
|
206
|
-
if (result)
|
207
|
-
return result;
|
208
|
-
result = parseForMetamorpho(returnValueOfCalls, index, targetToken);
|
209
|
-
if (result)
|
210
|
-
return result;
|
211
|
-
result = parseForStaking(campaign, returnValueOfCalls, index, targetToken);
|
212
|
-
if (result)
|
213
|
-
return result;
|
214
|
-
let name;
|
215
|
-
try {
|
216
|
-
name = decodeCall(returnValueOfCalls, index + 2, "name");
|
217
|
-
}
|
218
|
-
catch (e) {
|
219
|
-
return generateResult(tokenType.unknown, "Unknown", targetToken, {});
|
220
|
-
}
|
221
|
-
result = parseForBalancer(returnValueOfCalls, index, targetToken, name);
|
222
|
-
if (result)
|
223
|
-
return result;
|
224
|
-
// Order matters
|
225
|
-
const ordered_token_Type = Object.values(tokenType).filter(value => typeof value === "string");
|
226
|
-
result = processNamingConditionsInOrder(ordered_token_Type, name, targetToken);
|
227
|
-
if (result)
|
228
|
-
return result;
|
229
|
-
return generateResult(tokenType.unknown, name, targetToken, {});
|
230
|
-
}
|
@@ -1,3 +0,0 @@
|
|
1
|
-
import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
|
2
|
-
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
3
|
-
export declare function getTokenTypeRound2(index: number, type: tokenType, typeInfo: any, calls: Multicall3.ResultStructOutput[]): tokenTypeStruct;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { processorMapping } from "./processor/processorMapping";
|
2
|
-
export function getTokenTypeRound2(index, type, typeInfo, calls) {
|
3
|
-
try {
|
4
|
-
const returnValueOfCalls = calls.map(call => call.returnData);
|
5
|
-
const ProcessorClass = processorMapping[type];
|
6
|
-
if (!ProcessorClass) {
|
7
|
-
throw new Error(`Processor not found for key: ${type}`);
|
8
|
-
}
|
9
|
-
const processorObject = new ProcessorClass();
|
10
|
-
return processorObject.computeRound2(index, type, typeInfo, returnValueOfCalls);
|
11
|
-
}
|
12
|
-
catch (error) {
|
13
|
-
console.error(error);
|
14
|
-
return {
|
15
|
-
type: type,
|
16
|
-
calls: [],
|
17
|
-
typeInfo: {
|
18
|
-
...typeInfo,
|
19
|
-
},
|
20
|
-
};
|
21
|
-
}
|
22
|
-
}
|
@@ -1,3 +0,0 @@
|
|
1
|
-
import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
|
2
|
-
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
3
|
-
export declare function getTokenTypeRound3(index: number, type: tokenType, typeInfo: any, calls: Multicall3.ResultStructOutput[]): tokenTypeStruct;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { processorMapping } from "./processor/processorMapping";
|
2
|
-
export function getTokenTypeRound3(index, type, typeInfo, calls) {
|
3
|
-
try {
|
4
|
-
const ProcessorClass = processorMapping[type];
|
5
|
-
const returnValueOfCalls = calls.map(call => call.returnData);
|
6
|
-
if (!ProcessorClass) {
|
7
|
-
throw new Error(`Processor not found for key: ${type}`);
|
8
|
-
}
|
9
|
-
const processorObject = new ProcessorClass();
|
10
|
-
return processorObject.computeRound3(index, type, typeInfo, returnValueOfCalls);
|
11
|
-
}
|
12
|
-
catch (error) {
|
13
|
-
console.error(error);
|
14
|
-
return {
|
15
|
-
type: type,
|
16
|
-
calls: [],
|
17
|
-
typeInfo: {
|
18
|
-
...typeInfo,
|
19
|
-
},
|
20
|
-
};
|
21
|
-
}
|
22
|
-
}
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import type { Campaign, CampaignParameters } from "@sdk";
|
2
|
-
import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
|
3
|
-
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
4
|
-
export declare function getTokenTypeRound4(index: number, type: tokenType, typeInfo: any, calls: Multicall3.ResultStructOutput[], campaign: CampaignParameters<Campaign.ERC20>): tokenTypeStruct;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { processorMapping } from "./processor/processorMapping";
|
2
|
-
export function getTokenTypeRound4(index, type, typeInfo, calls, campaign) {
|
3
|
-
try {
|
4
|
-
const ProcessorClass = processorMapping[type];
|
5
|
-
const returnValueOfCalls = calls.map(call => call.returnData);
|
6
|
-
if (!ProcessorClass) {
|
7
|
-
throw new Error(`Processor not found for key: ${type}`);
|
8
|
-
}
|
9
|
-
const processorObject = new ProcessorClass();
|
10
|
-
return processorObject.computeRound4(index, type, typeInfo, returnValueOfCalls, campaign);
|
11
|
-
}
|
12
|
-
catch (error) {
|
13
|
-
console.error(error);
|
14
|
-
return {
|
15
|
-
type: type,
|
16
|
-
calls: [],
|
17
|
-
typeInfo: {
|
18
|
-
...typeInfo,
|
19
|
-
},
|
20
|
-
};
|
21
|
-
}
|
22
|
-
}
|
@@ -1,3 +0,0 @@
|
|
1
|
-
import { Campaign, type CampaignDynamicData, type CampaignParameters, type MerklChainId } from "@sdk";
|
2
|
-
import type { UncachedResult } from "../../utils/execute";
|
3
|
-
export declare function campaignsDynamicDataRefacto<T extends Campaign>(chainId: MerklChainId, campaigns: CampaignParameters<T>[], type: T, nextVersion?: boolean): Promise<UncachedResult<Partial<CampaignDynamicData<T>[]>>>;
|
@@ -1,75 +0,0 @@
|
|
1
|
-
import { engineDbClient } from "../../utils/prisma";
|
2
|
-
import { Campaign } from "@sdk";
|
3
|
-
import { getAddress } from "ethers/lib/utils";
|
4
|
-
import { AjnaDynamicData } from "./campaignTypes/AjnaDynamicData";
|
5
|
-
import { BadgerDynamicData } from "./campaignTypes/BadgerDynamicData";
|
6
|
-
import { CLAMMDynamicData } from "./campaignTypes/CLAMMDynamicData";
|
7
|
-
import { CompoundDynamicData } from "./campaignTypes/CompoundDynamicData";
|
8
|
-
import { DolomiteDynamicData } from "./campaignTypes/DolomiteDynamicData";
|
9
|
-
import { ERC20DynamicDataRefacto } from "./campaignTypes/ERC20DynamicDataRefacto";
|
10
|
-
import { ERC20_SNAPSHOTDynamicData } from "./campaignTypes/ERC20_SNAPSHOTDynamicData";
|
11
|
-
import { EulerDynamicData } from "./campaignTypes/EulerDynamicData";
|
12
|
-
import { JSON_AIRDROPDynamicData } from "./campaignTypes/JSON_AIRDROPDynamicData";
|
13
|
-
import { MORPHODynamicData } from "./campaignTypes/MORPHODynamicData";
|
14
|
-
import { RadiantDynamicData } from "./campaignTypes/RadiantDynamicData";
|
15
|
-
import { SILODynamicData } from "./campaignTypes/SILODynamicData";
|
16
|
-
export async function campaignsDynamicDataRefacto(chainId, campaigns, type, nextVersion = false) {
|
17
|
-
try {
|
18
|
-
const tags = (await engineDbClient.campaignCreators.findMany()).reduce((acc, curr) => {
|
19
|
-
acc[getAddress(curr.address)] = curr.tags.split(",");
|
20
|
-
return acc;
|
21
|
-
}, {});
|
22
|
-
for (const campaign of campaigns) {
|
23
|
-
campaign.tags = tags[getAddress(campaign.creator)] || [];
|
24
|
-
}
|
25
|
-
}
|
26
|
-
catch (e) { }
|
27
|
-
switch (type) {
|
28
|
-
case Campaign.ERC20: {
|
29
|
-
return ERC20DynamicDataRefacto(chainId, campaigns);
|
30
|
-
}
|
31
|
-
case Campaign.CLAMM: {
|
32
|
-
return CLAMMDynamicData(chainId, campaigns);
|
33
|
-
}
|
34
|
-
case Campaign.ERC20_SNAPSHOT: {
|
35
|
-
return ERC20_SNAPSHOTDynamicData(chainId, campaigns);
|
36
|
-
}
|
37
|
-
case Campaign.JSON_AIRDROP: {
|
38
|
-
return JSON_AIRDROPDynamicData(chainId, campaigns);
|
39
|
-
}
|
40
|
-
case Campaign.SILO: {
|
41
|
-
return SILODynamicData(chainId, campaigns);
|
42
|
-
}
|
43
|
-
case Campaign.RADIANT: {
|
44
|
-
return RadiantDynamicData(chainId, campaigns);
|
45
|
-
}
|
46
|
-
case Campaign.MORPHO: {
|
47
|
-
return MORPHODynamicData(chainId, campaigns);
|
48
|
-
}
|
49
|
-
case Campaign.EULER: {
|
50
|
-
return EulerDynamicData(chainId, campaigns);
|
51
|
-
}
|
52
|
-
case Campaign.DOLOMITE: {
|
53
|
-
return DolomiteDynamicData(chainId, campaigns);
|
54
|
-
}
|
55
|
-
case Campaign.BADGER: {
|
56
|
-
return BadgerDynamicData(chainId, campaigns);
|
57
|
-
}
|
58
|
-
case Campaign.AJNA: {
|
59
|
-
return AjnaDynamicData(chainId, campaigns);
|
60
|
-
}
|
61
|
-
case Campaign.COMPOUND: {
|
62
|
-
return CompoundDynamicData(chainId, campaigns);
|
63
|
-
}
|
64
|
-
}
|
65
|
-
return {
|
66
|
-
cached: false,
|
67
|
-
call: {
|
68
|
-
callData: [],
|
69
|
-
handler: () => { },
|
70
|
-
reducer: async (_) => {
|
71
|
-
return campaigns;
|
72
|
-
},
|
73
|
-
},
|
74
|
-
};
|
75
|
-
}
|