@merkl/api 0.20.126 → 0.20.128
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/implementations/MultiLog/metadata.js +1 -1
- package/dist/src/engine/implementations/MultiLog/tvl.d.ts +12 -1
- package/dist/src/engine/implementations/MultiLog/tvl.js +69 -2
- package/dist/src/engine/tvl/factory.js +1 -0
- package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +14 -2
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +15 -1
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +235 -1
- package/dist/src/modules/v4/token/token.service.js +7 -7
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -2,7 +2,7 @@ import { ComposedType } from "@sdk";
|
|
2
2
|
import { metadataBuilderFactory } from "@/engine/metadata/factory";
|
3
3
|
export class MultiLogMetaData {
|
4
4
|
async build(campaign) {
|
5
|
-
const mainComposed = campaign.params.composedCampaigns.find(composedCampaign => composedCampaign.composedType === ComposedType.
|
5
|
+
const mainComposed = campaign.params.composedCampaigns.find(composedCampaign => composedCampaign.composedType === ComposedType.MAIN);
|
6
6
|
if (!mainComposed) {
|
7
7
|
throw new Error("Main composed campaign not found");
|
8
8
|
}
|
@@ -1,7 +1,18 @@
|
|
1
1
|
import type { TVLBuilder, TVLData } from "@/engine/tvl/interface";
|
2
|
-
import { type CampaignParameters,
|
2
|
+
import { type CampaignParameters, Campaign as CampaignType, type MerklChainId } from "@sdk";
|
3
3
|
type campaignType = CampaignType.MULTILOG;
|
4
|
+
type composedType = CampaignType.ERC20LOGPROCESSOR | CampaignType.EVENT_BASED | CampaignType.ERC20REBASELOGPROCESSOR;
|
4
5
|
export declare class MultiLogTVLBuilder implements TVLBuilder<campaignType> {
|
5
6
|
build(_computeChainId: MerklChainId, campaigns: CampaignParameters<campaignType>[]): Promise<TVLData<CampaignType.MULTILOG>>;
|
7
|
+
getIdPerCampaignType(campaignType: CampaignType, campaign: CampaignParameters<composedType>): string | undefined;
|
8
|
+
/**
|
9
|
+
* Compute TVL
|
10
|
+
* @dev important: using the most recent state save with current prices
|
11
|
+
* it's only an estimate
|
12
|
+
*/
|
13
|
+
computeEventBasedPoolRewardsFromMostRecentStateSave(chainId: MerklChainId, campaignType: CampaignType, campaign: CampaignParameters<composedType>): Promise<{
|
14
|
+
distributedRewards: number;
|
15
|
+
blockNumber: number;
|
16
|
+
}>;
|
6
17
|
}
|
7
18
|
export {};
|
@@ -1,10 +1,19 @@
|
|
1
|
+
import { BucketService } from "@/modules/v4/bucket/bucket.service";
|
1
2
|
import { DynamicDataService } from "@/modules/v4/dynamicData/dynamicData.service";
|
2
|
-
import {
|
3
|
+
import { engineDbClient } from "@db";
|
4
|
+
import { BN2Number, Campaign as CampaignType, ChainInteractionService, ComposedType, } from "@sdk";
|
3
5
|
export class MultiLogTVLBuilder {
|
4
6
|
async build(_computeChainId, campaigns) {
|
5
7
|
const tvls = [];
|
6
8
|
for (const campaign of campaigns) {
|
7
|
-
const
|
9
|
+
const mainComposedList = campaign.campaignParameters.composedCampaigns.filter(composedCampaign => composedCampaign.composedType === ComposedType.MAIN);
|
10
|
+
if (mainComposedList.length === 0) {
|
11
|
+
throw new Error("Main composed campaign not found");
|
12
|
+
}
|
13
|
+
if (mainComposedList.length > 1) {
|
14
|
+
// TODO: handle multiple main composed campaigns
|
15
|
+
}
|
16
|
+
const mainComposed = mainComposedList[0];
|
8
17
|
if (mainComposed) {
|
9
18
|
const mainCampaignTVL = (await DynamicDataService.update(mainComposed.computeChainId, mainComposed.campaignType, [mainComposed], true))[0];
|
10
19
|
tvls.push({
|
@@ -16,4 +25,62 @@ export class MultiLogTVLBuilder {
|
|
16
25
|
}
|
17
26
|
return tvls;
|
18
27
|
}
|
28
|
+
// TODO: handle multiple main composed campaigns
|
29
|
+
getIdPerCampaignType(campaignType, campaign) {
|
30
|
+
switch (campaignType) {
|
31
|
+
case CampaignType.ERC20LOGPROCESSOR:
|
32
|
+
case CampaignType.ERC20REBASELOGPROCESSOR:
|
33
|
+
campaign = campaign;
|
34
|
+
return `ERC20LogProcessor_${campaign.computeChainId}_${campaign.campaignParameters.targetToken}`;
|
35
|
+
case CampaignType.EVENT_BASED:
|
36
|
+
campaign = campaign;
|
37
|
+
return `EventBasedProcessor_${campaign.computeChainId}_${campaign.campaignId}`;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* Compute TVL
|
42
|
+
* @dev important: using the most recent state save with current prices
|
43
|
+
* it's only an estimate
|
44
|
+
*/
|
45
|
+
// TODO: handle multiple main composed campaigns
|
46
|
+
async computeEventBasedPoolRewardsFromMostRecentStateSave(chainId, campaignType, campaign) {
|
47
|
+
let stateSave;
|
48
|
+
let blockNumber;
|
49
|
+
let states = {};
|
50
|
+
try {
|
51
|
+
const currentBlock = await ChainInteractionService(chainId).getBlockNumber();
|
52
|
+
const mostRecentStateSave = await engineDbClient.stateSave.findFirst({
|
53
|
+
where: {
|
54
|
+
id: this.getIdPerCampaignType(campaignType, campaign),
|
55
|
+
blockNumber: {
|
56
|
+
lte: currentBlock,
|
57
|
+
},
|
58
|
+
},
|
59
|
+
orderBy: {
|
60
|
+
blockNumber: "desc",
|
61
|
+
},
|
62
|
+
});
|
63
|
+
stateSave = mostRecentStateSave.state;
|
64
|
+
blockNumber = mostRecentStateSave?.blockNumber;
|
65
|
+
states = stateSave.states;
|
66
|
+
// const globalState = stateSave.globalState as { tick: number; liquidity: string };
|
67
|
+
}
|
68
|
+
catch { }
|
69
|
+
const { fileName, bucketName } = states;
|
70
|
+
// Bucket service
|
71
|
+
let distributedRewards = 0;
|
72
|
+
if (!fileName || !bucketName) {
|
73
|
+
return { distributedRewards, blockNumber: blockNumber };
|
74
|
+
}
|
75
|
+
try {
|
76
|
+
const bucket = new BucketService("merkl-production-states", "merkl-production");
|
77
|
+
const storedStates = JSON.parse(await bucket.pull(fileName));
|
78
|
+
for (const [_, { value, params: _params }] of Object.entries(storedStates)) {
|
79
|
+
distributedRewards += BN2Number(value.allTimeValue, 18);
|
80
|
+
}
|
81
|
+
distributedRewards = Math.max(distributedRewards, 1);
|
82
|
+
}
|
83
|
+
catch { }
|
84
|
+
return { distributedRewards, blockNumber: blockNumber };
|
85
|
+
}
|
19
86
|
}
|
@@ -11,6 +11,7 @@ import { MultiLogTVLBuilder } from "../implementations/MultiLog/tvl";
|
|
11
11
|
* @dev Casts are made to enforce type safety
|
12
12
|
* @dev A type error must be thrown if a new campaign type is added and the corresponding builder is not implemented
|
13
13
|
*/
|
14
|
+
// @ts-ignore
|
14
15
|
const map = {
|
15
16
|
[Campaign.AJNA]: new AjnaTVLBuilder(),
|
16
17
|
[Campaign.EIGENLAYER]: new EigenLayerTVLBuilder(),
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Campaign, CompFork, CompoundSubCampaignType, CompoundV3SubCampaignType, Forwarder, ForwarderParameters, HOOK, HookParameters, MerklChainId, MorphoSubCampaignType } from "@sdk";
|
1
|
+
import type { Campaign, CompFork, CompoundSubCampaignType, CompoundV3SubCampaignType, ComputeScoreMethod, ComputeScoreParameters, Forwarder, ForwarderParameters, GenericCampaignConfigComposed, HOOK, HookParameters, MerklChainId, MorphoSubCampaignType } from "@sdk";
|
2
2
|
export declare const CampaignPayloadInputDto: import("@sinclair/typebox").TObject<{
|
3
3
|
campaign: import("@sinclair/typebox").TString;
|
4
4
|
program: import("@sinclair/typebox").TString;
|
@@ -155,6 +155,18 @@ export type partialConfigERC20 = {
|
|
155
155
|
forwarders: ForwarderParameters<Forwarder>[];
|
156
156
|
apr?: string;
|
157
157
|
};
|
158
|
+
export type partialConfigMultiLog = {
|
159
|
+
composedCampaigns: GenericCampaignConfigComposed[];
|
160
|
+
composedCampaignsCompute: string;
|
161
|
+
computeScoreParameters: ComputeScoreParameters<ComputeScoreMethod> | string;
|
162
|
+
computeChainId?: MerklChainId;
|
163
|
+
hooks?: (HookParameters<HOOK> | string)[];
|
164
|
+
campaignType: Campaign;
|
165
|
+
whitelist: string[];
|
166
|
+
blacklist: string[];
|
167
|
+
url?: string;
|
168
|
+
apr?: string;
|
169
|
+
};
|
158
170
|
export type partialConfigCompoundV3 = {
|
159
171
|
computeChainId?: MerklChainId;
|
160
172
|
hooks?: (HookParameters<HOOK> | string)[];
|
@@ -211,7 +223,7 @@ export type partialConfigAirdrop = {
|
|
211
223
|
hooks?: (HookParameters<HOOK> | string)[];
|
212
224
|
campaignType: Campaign;
|
213
225
|
};
|
214
|
-
export type partialConfig = partialConfigERC20 | partialConfigMorpho | partialConfigCLAMM | partialConfigIonic | partialConfigCompoundV3 | partialConfigAirdrop;
|
226
|
+
export type partialConfig = partialConfigERC20 | partialConfigMorpho | partialConfigCLAMM | partialConfigIonic | partialConfigCompoundV3 | partialConfigMultiLog | partialConfigAirdrop;
|
215
227
|
export declare const safeTemplate: {
|
216
228
|
version: string;
|
217
229
|
chainId: string;
|
@@ -143,7 +143,21 @@ export declare enum reserveCampaigns {
|
|
143
143
|
CoinDesk_DeFi_Select_Index_Reserve = "CoinDesk DeFi Select Index Reserve Mainnet 0x188D12Eb13a5Eadd0867074ce8354B1AD6f4790b",
|
144
144
|
RWA_Index_Reserve = "RWA Index Reserve Mainnet 0xA5cdea03B11042fc10B52aF9eCa48bb17A2107d2",
|
145
145
|
Imagine_the_SMEL_Reserve = "Imagine the SMEL Reserve Mainnet 0xF91384484F4717314798E8975BCd904A35fc2BF1",
|
146
|
-
BTC_ETH_DCA_Index_Reserve = "BTC ETH DCA Index Reserve Mainnet 0x4E3B170DcBe704b248df5f56D488114acE01B1C5"
|
146
|
+
BTC_ETH_DCA_Index_Reserve = "BTC ETH DCA Index Reserve Mainnet 0x4E3B170DcBe704b248df5f56D488114acE01B1C5",
|
147
|
+
trading_competition_ABX_base = "trading competition on 0xE207FAb5839CA5bCc0d930761755cC7d82C1f19c",
|
148
|
+
trading_competition_CLX_base = "trading competition on 0xFdCCD04DDCa9eCf052E8e9eF6BD09a9b323fBF49",
|
149
|
+
trading_competition_AI_base = "trading competition on 0xeD5210Bd97d855E8BEc2389439B8487eEcC3FC60",
|
150
|
+
trading_competition_VTF_base = "trading competition on 0x130C5bc30567987861620971C6B60C08D3784eF8",
|
151
|
+
trading_competition_MVDA25_base = "trading competition on 0xF37631E6481e61011FbDccbCE714ab06A031FBa8",
|
152
|
+
trading_competition_BGCI_base = "trading competition on 0xD38d1AB8A150e6eE0AE70C86A8E9Fb0c83255b76",
|
153
|
+
trading_competition_MVTT10F_base = "trading competition on 0xd19c0dbbC5Ba2eC4faa0e3FFf892F0E95F23D9e0",
|
154
|
+
trading_competition_BDTF_base = "trading competition on 0x477172B5176CC93e8766860fd58b0C640898080d",
|
155
|
+
trading_competition_mvDEFI_mainnet = "trading competition on 0x479e82b60f5885A3569d618d027Ef1Ac2020Ee82",
|
156
|
+
trading_competition_DGI_mainnet = "trading competition on 0x4BaF786bd59022c942DceE4282b17D1bc681C99f",
|
157
|
+
trading_competition_DFX_mainnet = "trading competition on 0x1914256C2F70aAc87e097Cd8B07958e9F17F2BCd",
|
158
|
+
trading_competition_mvRWA_mainnet = "trading competition on 0xB986a32F468EdaD2F2F890094Ea39aE484FBCaF4",
|
159
|
+
trading_competition_SMEL_mainnet = "trading competition on 0xB76726B4befE761a1859C1c02E7d157142E077c0",
|
160
|
+
trading_competition_BED_mainnet = "trading competition on 0xAED9261caa6A795178a4ab4D3Be62f2D01b2c214"
|
147
161
|
}
|
148
162
|
export declare enum sonicmarketCampaigns {
|
149
163
|
USDCe_S_Vault_Sonic_Market = "USDC.e/S Vault Sonic Market 0x46107Ec44112675689053b96aea2127fD952bd47",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BalanceCallType, Campaign, ChainId, CompFork, CompoundSubCampaignType, CompoundV3SubCampaignType, ComputeScoreMethod, Forwarder, HOOK, MorphoSubCampaignType, StandardType, boostingFunction, boostingReferralFunction, contractStateBoost, defaultBoost, defaultReferralBoost, selectionRaffleMethod, } from "@sdk";
|
1
|
+
import { BalanceCallType, Campaign, ChainId, CompFork, ComposedType, CompoundSubCampaignType, CompoundV3SubCampaignType, ComputeScoreMethod, Forwarder, HOOK, MorphoSubCampaignType, StandardType, boostingFunction, boostingReferralFunction, contractStateBoost, defaultBoost, defaultReferralBoost, selectionRaffleMethod, } from "@sdk";
|
2
2
|
import { id } from "ethers/lib/utils";
|
3
3
|
export var program;
|
4
4
|
(function (program) {
|
@@ -213,6 +213,20 @@ export var reserveCampaigns;
|
|
213
213
|
reserveCampaigns["RWA_Index_Reserve"] = "RWA Index Reserve Mainnet 0xA5cdea03B11042fc10B52aF9eCa48bb17A2107d2";
|
214
214
|
reserveCampaigns["Imagine_the_SMEL_Reserve"] = "Imagine the SMEL Reserve Mainnet 0xF91384484F4717314798E8975BCd904A35fc2BF1";
|
215
215
|
reserveCampaigns["BTC_ETH_DCA_Index_Reserve"] = "BTC ETH DCA Index Reserve Mainnet 0x4E3B170DcBe704b248df5f56D488114acE01B1C5";
|
216
|
+
reserveCampaigns["trading_competition_ABX_base"] = "trading competition on 0xE207FAb5839CA5bCc0d930761755cC7d82C1f19c";
|
217
|
+
reserveCampaigns["trading_competition_CLX_base"] = "trading competition on 0xFdCCD04DDCa9eCf052E8e9eF6BD09a9b323fBF49";
|
218
|
+
reserveCampaigns["trading_competition_AI_base"] = "trading competition on 0xeD5210Bd97d855E8BEc2389439B8487eEcC3FC60";
|
219
|
+
reserveCampaigns["trading_competition_VTF_base"] = "trading competition on 0x130C5bc30567987861620971C6B60C08D3784eF8";
|
220
|
+
reserveCampaigns["trading_competition_MVDA25_base"] = "trading competition on 0xF37631E6481e61011FbDccbCE714ab06A031FBa8";
|
221
|
+
reserveCampaigns["trading_competition_BGCI_base"] = "trading competition on 0xD38d1AB8A150e6eE0AE70C86A8E9Fb0c83255b76";
|
222
|
+
reserveCampaigns["trading_competition_MVTT10F_base"] = "trading competition on 0xd19c0dbbC5Ba2eC4faa0e3FFf892F0E95F23D9e0";
|
223
|
+
reserveCampaigns["trading_competition_BDTF_base"] = "trading competition on 0x477172B5176CC93e8766860fd58b0C640898080d";
|
224
|
+
reserveCampaigns["trading_competition_mvDEFI_mainnet"] = "trading competition on 0x479e82b60f5885A3569d618d027Ef1Ac2020Ee82";
|
225
|
+
reserveCampaigns["trading_competition_DGI_mainnet"] = "trading competition on 0x4BaF786bd59022c942DceE4282b17D1bc681C99f";
|
226
|
+
reserveCampaigns["trading_competition_DFX_mainnet"] = "trading competition on 0x1914256C2F70aAc87e097Cd8B07958e9F17F2BCd";
|
227
|
+
reserveCampaigns["trading_competition_mvRWA_mainnet"] = "trading competition on 0xB986a32F468EdaD2F2F890094Ea39aE484FBCaF4";
|
228
|
+
reserveCampaigns["trading_competition_SMEL_mainnet"] = "trading competition on 0xB76726B4befE761a1859C1c02E7d157142E077c0";
|
229
|
+
reserveCampaigns["trading_competition_BED_mainnet"] = "trading competition on 0xAED9261caa6A795178a4ab4D3Be62f2D01b2c214";
|
216
230
|
})(reserveCampaigns || (reserveCampaigns = {}));
|
217
231
|
export var sonicmarketCampaigns;
|
218
232
|
(function (sonicmarketCampaigns) {
|
@@ -2298,7 +2312,227 @@ const ReserveInterfaceCampaigns = {
|
|
2298
2312
|
url: "https://feature-dtf.register-app.pages.dev/ethereum/index-dtf/0x4e3b170dcbe704b248df5f56d488114ace01b1c5/overview",
|
2299
2313
|
forwarders: [],
|
2300
2314
|
},
|
2315
|
+
[reserveCampaigns.trading_competition_ABX_base]: {
|
2316
|
+
campaignType: Campaign.MULTILOG,
|
2317
|
+
computeScoreParameters: {
|
2318
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2319
|
+
},
|
2320
|
+
whitelist: [],
|
2321
|
+
blacklist: [],
|
2322
|
+
hooks: [],
|
2323
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xE207FAb5839CA5bCc0d930761755cC7d82C1f19c", 0, ChainId.BASE),
|
2324
|
+
composedCampaignsCompute: "1-2",
|
2325
|
+
},
|
2326
|
+
[reserveCampaigns.trading_competition_AI_base]: {
|
2327
|
+
campaignType: Campaign.MULTILOG,
|
2328
|
+
computeScoreParameters: {
|
2329
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2330
|
+
},
|
2331
|
+
whitelist: [],
|
2332
|
+
blacklist: [],
|
2333
|
+
hooks: [],
|
2334
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xeD5210Bd97d855E8BEc2389439B8487eEcC3FC60", 0, ChainId.BASE),
|
2335
|
+
composedCampaignsCompute: "1-2",
|
2336
|
+
},
|
2337
|
+
[reserveCampaigns.trading_competition_BDTF_base]: {
|
2338
|
+
campaignType: Campaign.MULTILOG,
|
2339
|
+
computeScoreParameters: {
|
2340
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2341
|
+
},
|
2342
|
+
whitelist: [],
|
2343
|
+
blacklist: [],
|
2344
|
+
hooks: [],
|
2345
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0x477172B5176CC93e8766860fd58b0C640898080d", 0, ChainId.BASE),
|
2346
|
+
composedCampaignsCompute: "1-2",
|
2347
|
+
},
|
2348
|
+
[reserveCampaigns.trading_competition_BED_mainnet]: {
|
2349
|
+
campaignType: Campaign.MULTILOG,
|
2350
|
+
computeScoreParameters: {
|
2351
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2352
|
+
},
|
2353
|
+
whitelist: [],
|
2354
|
+
blacklist: [],
|
2355
|
+
hooks: [],
|
2356
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xAED9261caa6A795178a4ab4D3Be62f2D01b2c214", 1, ChainId.MAINNET),
|
2357
|
+
composedCampaignsCompute: "1-2",
|
2358
|
+
},
|
2359
|
+
[reserveCampaigns.trading_competition_BGCI_base]: {
|
2360
|
+
campaignType: Campaign.MULTILOG,
|
2361
|
+
computeScoreParameters: {
|
2362
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2363
|
+
},
|
2364
|
+
whitelist: [],
|
2365
|
+
blacklist: [],
|
2366
|
+
hooks: [],
|
2367
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xD38d1AB8A150e6eE0AE70C86A8E9Fb0c83255b76", 1, ChainId.BASE),
|
2368
|
+
composedCampaignsCompute: "1-2",
|
2369
|
+
},
|
2370
|
+
[reserveCampaigns.trading_competition_CLX_base]: {
|
2371
|
+
campaignType: Campaign.MULTILOG,
|
2372
|
+
computeScoreParameters: {
|
2373
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2374
|
+
},
|
2375
|
+
whitelist: [],
|
2376
|
+
blacklist: [],
|
2377
|
+
hooks: [],
|
2378
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xFdCCD04DDCa9eCf052E8e9eF6BD09a9b323fBF49", 0, ChainId.BASE),
|
2379
|
+
composedCampaignsCompute: "1-2",
|
2380
|
+
},
|
2381
|
+
[reserveCampaigns.trading_competition_DFX_mainnet]: {
|
2382
|
+
campaignType: Campaign.MULTILOG,
|
2383
|
+
computeScoreParameters: {
|
2384
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2385
|
+
},
|
2386
|
+
whitelist: [],
|
2387
|
+
blacklist: [],
|
2388
|
+
hooks: [],
|
2389
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0x1914256C2F70aAc87e097Cd8B07958e9F17F2BCd", 1, ChainId.MAINNET),
|
2390
|
+
composedCampaignsCompute: "1-2",
|
2391
|
+
},
|
2392
|
+
[reserveCampaigns.trading_competition_DGI_mainnet]: {
|
2393
|
+
campaignType: Campaign.MULTILOG,
|
2394
|
+
computeScoreParameters: {
|
2395
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2396
|
+
},
|
2397
|
+
whitelist: [],
|
2398
|
+
blacklist: [],
|
2399
|
+
hooks: [],
|
2400
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0x4BaF786bd59022c942DceE4282b17D1bc681C99f", 1, ChainId.MAINNET),
|
2401
|
+
composedCampaignsCompute: "1-2",
|
2402
|
+
},
|
2403
|
+
[reserveCampaigns.trading_competition_MVDA25_base]: {
|
2404
|
+
campaignType: Campaign.MULTILOG,
|
2405
|
+
computeScoreParameters: {
|
2406
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2407
|
+
},
|
2408
|
+
whitelist: [],
|
2409
|
+
blacklist: [],
|
2410
|
+
hooks: [],
|
2411
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xF37631E6481e61011FbDccbCE714ab06A031FBa8", 0, ChainId.BASE),
|
2412
|
+
composedCampaignsCompute: "1-2",
|
2413
|
+
},
|
2414
|
+
[reserveCampaigns.trading_competition_MVTT10F_base]: {
|
2415
|
+
campaignType: Campaign.MULTILOG,
|
2416
|
+
computeScoreParameters: {
|
2417
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2418
|
+
},
|
2419
|
+
whitelist: [],
|
2420
|
+
blacklist: [],
|
2421
|
+
hooks: [],
|
2422
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xd19c0dbbC5Ba2eC4faa0e3FFf892F0E95F23D9e0", 0, ChainId.BASE),
|
2423
|
+
composedCampaignsCompute: "1-2",
|
2424
|
+
},
|
2425
|
+
[reserveCampaigns.trading_competition_SMEL_mainnet]: {
|
2426
|
+
campaignType: Campaign.MULTILOG,
|
2427
|
+
computeScoreParameters: {
|
2428
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2429
|
+
},
|
2430
|
+
whitelist: [],
|
2431
|
+
blacklist: [],
|
2432
|
+
hooks: [],
|
2433
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xB76726B4befE761a1859C1c02E7d157142E077c0", 0, ChainId.MAINNET),
|
2434
|
+
composedCampaignsCompute: "1-2",
|
2435
|
+
},
|
2436
|
+
[reserveCampaigns.trading_competition_VTF_base]: {
|
2437
|
+
campaignType: Campaign.MULTILOG,
|
2438
|
+
computeScoreParameters: {
|
2439
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2440
|
+
},
|
2441
|
+
whitelist: [],
|
2442
|
+
blacklist: [],
|
2443
|
+
hooks: [],
|
2444
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0x130C5bc30567987861620971C6B60C08D3784eF8", 0, ChainId.BASE),
|
2445
|
+
composedCampaignsCompute: "1-2",
|
2446
|
+
},
|
2447
|
+
[reserveCampaigns.trading_competition_mvDEFI_mainnet]: {
|
2448
|
+
campaignType: Campaign.MULTILOG,
|
2449
|
+
computeScoreParameters: {
|
2450
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2451
|
+
},
|
2452
|
+
whitelist: [],
|
2453
|
+
blacklist: [],
|
2454
|
+
hooks: [],
|
2455
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0x479e82b60f5885A3569d618d027Ef1Ac2020Ee82", 1, ChainId.MAINNET),
|
2456
|
+
composedCampaignsCompute: "1-2",
|
2457
|
+
},
|
2458
|
+
[reserveCampaigns.trading_competition_mvRWA_mainnet]: {
|
2459
|
+
campaignType: Campaign.MULTILOG,
|
2460
|
+
computeScoreParameters: {
|
2461
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2462
|
+
},
|
2463
|
+
whitelist: [],
|
2464
|
+
blacklist: [],
|
2465
|
+
hooks: [],
|
2466
|
+
composedCampaigns: generateComposedCampaignForTradingCompetitionForReserve("0xB986a32F468EdaD2F2F890094Ea39aE484FBCaF4", 1, ChainId.MAINNET),
|
2467
|
+
composedCampaignsCompute: "1-2",
|
2468
|
+
},
|
2301
2469
|
};
|
2470
|
+
function generateComposedCampaignForTradingCompetitionForReserve(pool, wethIndex, chainId) {
|
2471
|
+
return [
|
2472
|
+
{
|
2473
|
+
composedIndex: 1,
|
2474
|
+
computeChainId: chainId,
|
2475
|
+
composedType: ComposedType.MAIN,
|
2476
|
+
campaignType: Campaign.EVENT_BASED,
|
2477
|
+
contract: pool,
|
2478
|
+
eventID: id("Swap(address,address,int256,int256,uint160,uint128,int24)"),
|
2479
|
+
topicToData: [
|
2480
|
+
{
|
2481
|
+
topicIndex: 1,
|
2482
|
+
decodeKeyTopic: "address",
|
2483
|
+
dataIndexes: [wethIndex],
|
2484
|
+
multipliers: ["ETH"],
|
2485
|
+
computeFormula: wethIndex.toString(),
|
2486
|
+
},
|
2487
|
+
],
|
2488
|
+
computeScoreParameters: {
|
2489
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2490
|
+
},
|
2491
|
+
decodeDataValue: ["int256", "int256", "uint160", "uint128", "int24"],
|
2492
|
+
expectedChecks: [
|
2493
|
+
{
|
2494
|
+
index: wethIndex,
|
2495
|
+
key: "greaterThan",
|
2496
|
+
expectedValue: "0",
|
2497
|
+
},
|
2498
|
+
],
|
2499
|
+
whitelist: [],
|
2500
|
+
blacklist: [],
|
2501
|
+
forwarders: [],
|
2502
|
+
},
|
2503
|
+
{
|
2504
|
+
composedIndex: 2,
|
2505
|
+
computeChainId: chainId,
|
2506
|
+
composedType: ComposedType.MAIN,
|
2507
|
+
campaignType: Campaign.EVENT_BASED,
|
2508
|
+
contract: pool,
|
2509
|
+
eventID: id("Swap(address,address,int256,int256,uint160,uint128,int24)"),
|
2510
|
+
topicToData: [
|
2511
|
+
{
|
2512
|
+
topicIndex: 1,
|
2513
|
+
decodeKeyTopic: "address",
|
2514
|
+
dataIndexes: [wethIndex],
|
2515
|
+
multipliers: ["ETH"],
|
2516
|
+
computeFormula: wethIndex.toString(),
|
2517
|
+
},
|
2518
|
+
],
|
2519
|
+
computeScoreParameters: {
|
2520
|
+
computeMethod: ComputeScoreMethod.genericScorePunctual,
|
2521
|
+
},
|
2522
|
+
decodeDataValue: ["int256", "int256", "uint160", "uint128", "int24"],
|
2523
|
+
expectedChecks: [
|
2524
|
+
{
|
2525
|
+
index: wethIndex,
|
2526
|
+
key: "lessThan",
|
2527
|
+
expectedValue: "0",
|
2528
|
+
},
|
2529
|
+
],
|
2530
|
+
whitelist: [],
|
2531
|
+
blacklist: [],
|
2532
|
+
forwarders: [],
|
2533
|
+
},
|
2534
|
+
];
|
2535
|
+
}
|
2302
2536
|
const SonicmarketInterfaceCampaigns = {
|
2303
2537
|
[sonicmarketCampaigns.USDCe_S_Vault_Sonic_Market]: {
|
2304
2538
|
campaignType: Campaign.ERC20,
|
@@ -300,12 +300,12 @@ export class TokenService {
|
|
300
300
|
}));
|
301
301
|
}
|
302
302
|
static async getAllValidRewardTokens(query) {
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
:
|
307
|
-
|
308
|
-
|
303
|
+
const chainIds = !!query.chainId
|
304
|
+
? query.chainId?.split(",").map(n => Number.parseInt(n))
|
305
|
+
: (await ChainService.findMany({
|
306
|
+
test: true,
|
307
|
+
})).map(chain => chain.id);
|
308
|
+
return await CacheService.wrap(TTLPresets.MIN_5, async (chainIds) => {
|
309
309
|
/** Fetch current Merkle Roots */
|
310
310
|
const promises = await Promise.allSettled(chainIds.map(chainId => withTimeout(TokenService.getValidRewardTokens(chainId), 5_000)));
|
311
311
|
/** Filter out unsuccessful chainIds */
|
@@ -316,7 +316,7 @@ export class TokenService {
|
|
316
316
|
acc[chainIds[index]] = promise.value;
|
317
317
|
return acc;
|
318
318
|
}, {});
|
319
|
-
});
|
319
|
+
}, chainIds);
|
320
320
|
}
|
321
321
|
static async getValidRewardTokens(chainId) {
|
322
322
|
const validRewardTokens = await DistributionCreatorService(chainId).validRewardTokens();
|