@merkl/api 0.16.1 → 0.16.3
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/database/api/.generated/drizzle/schema.d.ts +8 -9
- package/dist/database/api/.generated/drizzle/schema.js +2 -3
- package/dist/database/api/.generated/drizzle/schema.ts +2 -4
- package/dist/database/api/.generated/edge.js +5 -33
- package/dist/database/api/.generated/index-browser.js +2 -30
- package/dist/database/api/.generated/index.d.ts +123 -210
- package/dist/database/api/.generated/index.js +5 -33
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +2 -32
- package/dist/database/api/.generated/wasm.js +2 -30
- package/dist/src/constants.d.ts +259 -13
- package/dist/src/eden/index.d.ts +98 -98
- package/dist/src/index.d.ts +19 -19
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +6 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +4 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +6 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.d.ts +44 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.js +69 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/HourglassProcessor.d.ts +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/HourglassProcessor.js +31 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +5 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +10 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +6 -6
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +5 -65
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -34
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +7 -7
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +14 -15
- package/dist/src/modules/v4/campaign/campaign.service.js +6 -6
- package/dist/src/modules/v4/chain/chain.repository.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +2 -2
- package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +2 -58
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +2 -3
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -8
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +4 -13
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +9 -9
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +3 -31
- package/dist/src/modules/v4/opportunity/opportunity.model.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +33 -18
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +9 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +15 -15
- package/dist/src/modules/v4/opportunity/opportunity.service.js +3 -2
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +2 -2
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getEulerMetadata.service.js +3 -2
- package/dist/src/modules/v4/opportunity/validate-id.pipe.js +3 -3
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.repository.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.service.d.ts +8 -8
- package/dist/src/modules/v4/reward/reward.service.js +2 -2
- package/dist/src/modules/v4/router.d.ts +19 -19
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -2
- package/dist/src/utils/decodeCalls.js +9 -1
- package/dist/src/utils/encodeCalls.js +25 -1
- package/dist/src/utils/generateCardName.d.ts +1 -1
- package/dist/src/utils/generateCardName.js +17 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,40 +1,7 @@
|
|
|
1
1
|
import { TokenResourceDto } from "../token";
|
|
2
|
-
import { CampaignType } from "../../../../database/api/.generated";
|
|
3
|
-
import { Campaign as CampaignTypeEnum } from "@sdk";
|
|
4
2
|
import { t } from "elysia";
|
|
5
3
|
import { ChainResourceDto } from "../chain/chain.model";
|
|
6
4
|
import { CampaignStatusResourceDto } from "../status/status.model";
|
|
7
|
-
// ─── Utils ───────────────────────────────────────────────────────────────────
|
|
8
|
-
export const campaignTypeToEnumMap = {
|
|
9
|
-
INVALID: CampaignTypeEnum.INVALID,
|
|
10
|
-
CLAMM: CampaignTypeEnum.CLAMM,
|
|
11
|
-
ERC20: CampaignTypeEnum.ERC20,
|
|
12
|
-
BADGER: CampaignTypeEnum.BADGER,
|
|
13
|
-
AJNA: CampaignTypeEnum.AJNA,
|
|
14
|
-
COMPOUND: CampaignTypeEnum.COMPOUND,
|
|
15
|
-
EULER: CampaignTypeEnum.EULER,
|
|
16
|
-
DOLOMITE: CampaignTypeEnum.DOLOMITE,
|
|
17
|
-
ERC20_SNAPSHOT: CampaignTypeEnum.ERC20_SNAPSHOT,
|
|
18
|
-
MORPHO: CampaignTypeEnum.MORPHO,
|
|
19
|
-
RADIANT: CampaignTypeEnum.RADIANT,
|
|
20
|
-
SILO: CampaignTypeEnum.SILO,
|
|
21
|
-
JSON_AIRDROP: CampaignTypeEnum.JSON_AIRDROP,
|
|
22
|
-
UNISWAP_V4: CampaignTypeEnum.UNISWAP_V4,
|
|
23
|
-
EIGENLAYER: CampaignTypeEnum.EIGENLAYER,
|
|
24
|
-
VEST: CampaignTypeEnum.VEST,
|
|
25
|
-
ERC20LOGPROCESSOR: CampaignTypeEnum.ERC20LOGPROCESSOR,
|
|
26
|
-
ERC20REBASELOGPROCESSOR: CampaignTypeEnum.ERC20REBASELOGPROCESSOR,
|
|
27
|
-
ION: CampaignTypeEnum.ION,
|
|
28
|
-
ERC20TRANSFERS: CampaignTypeEnum.ERC20TRANSFERS,
|
|
29
|
-
ERC20_FIX_APR: CampaignTypeEnum.ERC20_FIX_APR,
|
|
30
|
-
HYPERDRIVELOGPROCESSOR: CampaignTypeEnum.HYPERDRIVELOGPROCESSOR,
|
|
31
|
-
HYPERDRIVELOGFIXPROCESSOR: CampaignTypeEnum.HYPERDRIVELOGFIXPROCESSOR,
|
|
32
|
-
AMBIENTPROCESSOR: CampaignTypeEnum.AMBIENTPROCESSOR,
|
|
33
|
-
M0: CampaignTypeEnum.M0,
|
|
34
|
-
MORPHOSUPPLY: CampaignTypeEnum.MORPHOSUPPLY,
|
|
35
|
-
SYNCSWAP_VAULT: CampaignTypeEnum.SYNCSWAP_VAULT,
|
|
36
|
-
UNISWAP_V4_LP: CampaignTypeEnum.UNISWAP_V4,
|
|
37
|
-
};
|
|
38
5
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
|
39
6
|
export const CampaignUniqueDto = t.Object({
|
|
40
7
|
distributionChain: t.Numeric(),
|
|
@@ -93,7 +60,7 @@ export const GetCampaignQueryDto = t.Object({
|
|
|
93
60
|
chainId: t.Optional(t.Numeric({
|
|
94
61
|
description: "Filter by chain.<br>You can get the list of all supported chains by calling [GET /v4/chains](#tag/chains/GET/v4/chains/)",
|
|
95
62
|
})),
|
|
96
|
-
type: t.Optional(t.
|
|
63
|
+
type: t.Optional(t.String({ description: "Filter by type of campaign" })),
|
|
97
64
|
subType: t.Optional(t.Number({
|
|
98
65
|
description: "Silo, Radiant, Morpho, Dolomite, Compound, Ajna and Euler campaigns have a subtype attribute you can filter on",
|
|
99
66
|
})),
|
|
@@ -17,7 +17,7 @@ export declare abstract class CampaignRepository {
|
|
|
17
17
|
gte: number;
|
|
18
18
|
} | undefined;
|
|
19
19
|
subType: number | undefined;
|
|
20
|
-
type:
|
|
20
|
+
type: string | undefined;
|
|
21
21
|
creatorAddress: string | undefined;
|
|
22
22
|
RewardToken: {
|
|
23
23
|
address: string | undefined;
|
|
@@ -67,7 +67,7 @@ export declare abstract class CampaignRepository {
|
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
static upsert(campaign: CreateCampaignModel): Promise<{
|
|
70
|
-
type:
|
|
70
|
+
type: string;
|
|
71
71
|
id: string;
|
|
72
72
|
params: Prisma.JsonValue;
|
|
73
73
|
subType: number | null;
|
|
@@ -110,7 +110,7 @@ export declare abstract class CampaignRepository {
|
|
|
110
110
|
static checkIfExist(campaign: CampaignUnique): Promise<boolean>;
|
|
111
111
|
static checkIfIdExist(id: string): Promise<boolean>;
|
|
112
112
|
static findUnique(campaign: CampaignUnique): Promise<{
|
|
113
|
-
type:
|
|
113
|
+
type: string;
|
|
114
114
|
id: string;
|
|
115
115
|
params: Prisma.JsonValue;
|
|
116
116
|
subType: number | null;
|
|
@@ -125,7 +125,7 @@ export declare abstract class CampaignRepository {
|
|
|
125
125
|
creatorAddress: string;
|
|
126
126
|
} | null>;
|
|
127
127
|
static findUniqueOrThrow(id: string): Promise<{
|
|
128
|
-
type:
|
|
128
|
+
type: string;
|
|
129
129
|
id: string;
|
|
130
130
|
params: Prisma.JsonValue;
|
|
131
131
|
subType: number | null;
|
|
@@ -184,7 +184,7 @@ export declare abstract class CampaignRepository {
|
|
|
184
184
|
price: number | null;
|
|
185
185
|
};
|
|
186
186
|
} & {
|
|
187
|
-
type:
|
|
187
|
+
type: string;
|
|
188
188
|
id: string;
|
|
189
189
|
params: Prisma.JsonValue;
|
|
190
190
|
subType: number | null;
|
|
@@ -205,7 +205,7 @@ export declare abstract class CampaignRepository {
|
|
|
205
205
|
}[]>;
|
|
206
206
|
static findChains(): Promise<Record<string, ChainId>>;
|
|
207
207
|
static updateOpportunity(id: string, data: extendedUpdateCampaignModel): Promise<{
|
|
208
|
-
type:
|
|
208
|
+
type: string;
|
|
209
209
|
id: string;
|
|
210
210
|
params: Prisma.JsonValue;
|
|
211
211
|
subType: number | null;
|
|
@@ -220,7 +220,7 @@ export declare abstract class CampaignRepository {
|
|
|
220
220
|
creatorAddress: string;
|
|
221
221
|
}>;
|
|
222
222
|
static updateMetaData(id: string, params: string): Promise<{
|
|
223
|
-
type:
|
|
223
|
+
type: string;
|
|
224
224
|
id: string;
|
|
225
225
|
params: Prisma.JsonValue;
|
|
226
226
|
subType: number | null;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CampaignUnique, CampaignWithParams, CreateCampaignModel, GetCampaignQueryModel, UpdateCampaignModel, UpdateMetaDataCampaignModel } from "./";
|
|
2
2
|
import { CampaignRepository } from "./campaign.repository";
|
|
3
|
-
import type
|
|
4
|
-
import { type CampaignParameters, type Campaign as CampaignTypeV3, type ChainId } from "@sdk";
|
|
3
|
+
import { Campaign as CampaignEnum, type CampaignParameters, type ChainId } from "@sdk";
|
|
5
4
|
export declare abstract class CampaignService {
|
|
6
5
|
static hashId(campaign: CampaignUnique): string;
|
|
7
6
|
static splitIdOrThrow(chainAndCampaignId: `${number}-${string}` | string): CampaignUnique;
|
|
8
7
|
static create(campaign: Omit<CreateCampaignModel, "id">): Promise<{
|
|
9
|
-
type:
|
|
8
|
+
type: string;
|
|
10
9
|
id: string;
|
|
11
10
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
|
12
11
|
subType: number | null;
|
|
@@ -21,7 +20,7 @@ export declare abstract class CampaignService {
|
|
|
21
20
|
creatorAddress: string;
|
|
22
21
|
} | undefined>;
|
|
23
22
|
static updateMetaData(campaign: Omit<UpdateMetaDataCampaignModel, "id">): Promise<{
|
|
24
|
-
type:
|
|
23
|
+
type: string;
|
|
25
24
|
id: string;
|
|
26
25
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
|
27
26
|
subType: number | null;
|
|
@@ -78,12 +77,13 @@ export declare abstract class CampaignService {
|
|
|
78
77
|
computedUntil: bigint;
|
|
79
78
|
processingStarted: bigint;
|
|
80
79
|
};
|
|
80
|
+
creatorAddress: string;
|
|
81
81
|
Creator: {
|
|
82
82
|
tags: string[];
|
|
83
83
|
address: string;
|
|
84
84
|
creatorId: string | null;
|
|
85
85
|
};
|
|
86
|
-
type:
|
|
86
|
+
type: string;
|
|
87
87
|
id: string;
|
|
88
88
|
subType: number | null;
|
|
89
89
|
startTimestamp: bigint;
|
|
@@ -94,7 +94,6 @@ export declare abstract class CampaignService {
|
|
|
94
94
|
rewardTokenId: string;
|
|
95
95
|
amount: string;
|
|
96
96
|
opportunityId: string;
|
|
97
|
-
creatorAddress: string;
|
|
98
97
|
}[]>;
|
|
99
98
|
/**
|
|
100
99
|
* Counts the number of campaigns that complies to query
|
|
@@ -107,7 +106,7 @@ export declare abstract class CampaignService {
|
|
|
107
106
|
static checkIfExist(campaign: CampaignUnique): Promise<boolean>;
|
|
108
107
|
static checkIfIdExist(id: string): Promise<boolean>;
|
|
109
108
|
static findUnique(campaign: CampaignUnique): Promise<{
|
|
110
|
-
type:
|
|
109
|
+
type: string;
|
|
111
110
|
id: string;
|
|
112
111
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
|
113
112
|
subType: number | null;
|
|
@@ -122,7 +121,7 @@ export declare abstract class CampaignService {
|
|
|
122
121
|
creatorAddress: string;
|
|
123
122
|
} | null>;
|
|
124
123
|
static findUniqueOrThrow(campaign: CampaignUnique | string): Promise<{
|
|
125
|
-
type:
|
|
124
|
+
type: string;
|
|
126
125
|
id: string;
|
|
127
126
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
|
128
127
|
subType: number | null;
|
|
@@ -161,9 +160,9 @@ export declare abstract class CampaignService {
|
|
|
161
160
|
/**
|
|
162
161
|
* Returns the campaign data
|
|
163
162
|
* @param type index of Campaign enum from sdk
|
|
164
|
-
* @returns
|
|
163
|
+
* @returns a string
|
|
165
164
|
*/
|
|
166
|
-
static getTypeFromV3(type:
|
|
165
|
+
static getTypeFromV3(type: CampaignEnum): string;
|
|
167
166
|
/**
|
|
168
167
|
* Split a campaigns array into three array for each status
|
|
169
168
|
* @param campaigns
|
|
@@ -224,12 +223,13 @@ export declare abstract class CampaignService {
|
|
|
224
223
|
computedUntil: bigint;
|
|
225
224
|
processingStarted: bigint;
|
|
226
225
|
};
|
|
226
|
+
creatorAddress: string;
|
|
227
227
|
Creator: {
|
|
228
228
|
tags: string[];
|
|
229
229
|
address: string;
|
|
230
230
|
creatorId: string | null;
|
|
231
231
|
};
|
|
232
|
-
type:
|
|
232
|
+
type: string;
|
|
233
233
|
id: string;
|
|
234
234
|
subType: number | null;
|
|
235
235
|
startTimestamp: bigint;
|
|
@@ -240,9 +240,8 @@ export declare abstract class CampaignService {
|
|
|
240
240
|
rewardTokenId: string;
|
|
241
241
|
amount: string;
|
|
242
242
|
opportunityId: string;
|
|
243
|
-
creatorAddress: string;
|
|
244
243
|
};
|
|
245
|
-
static formatAsCampaignParameters<C extends
|
|
244
|
+
static formatAsCampaignParameters<C extends CampaignEnum>(campaign: CampaignWithParams["model"]): CampaignParameters<C>;
|
|
246
245
|
/**
|
|
247
246
|
* Fetches the campaign dynamic data for a v3 campaign onchain
|
|
248
247
|
* @param chainId
|
|
@@ -250,7 +249,7 @@ export declare abstract class CampaignService {
|
|
|
250
249
|
* @param campaigns of v3 type
|
|
251
250
|
* @returns
|
|
252
251
|
*/
|
|
253
|
-
static fetchDynamicData
|
|
252
|
+
static fetchDynamicData(chainId: number, campaignType: string, campaigns: CampaignParameters<any>[]): Promise<any>;
|
|
254
253
|
/**
|
|
255
254
|
* Shortcut to get daily amount from total
|
|
256
255
|
* @param start timestamp
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { HttpError } from "../../../errors";
|
|
2
2
|
import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
|
3
|
-
import { campaignTypeToEnumMap, } from "./";
|
|
4
3
|
import { CampaignRepository } from "./campaign.repository";
|
|
5
4
|
import { OpportunityService } from "../opportunity";
|
|
6
5
|
import { InvalidParameter } from "../../../utils/error";
|
|
7
6
|
import { executeSimple } from "../../../utils/execute";
|
|
8
7
|
import { log } from "../../../utils/logger";
|
|
9
|
-
import { NETWORK_LABELS, } from "@sdk";
|
|
8
|
+
import { Campaign as CampaignEnum, NETWORK_LABELS, } from "@sdk";
|
|
10
9
|
import { utils } from "ethers";
|
|
11
10
|
import moment from "moment";
|
|
12
11
|
import { StatusService } from "../status";
|
|
@@ -63,7 +62,7 @@ export class CampaignService {
|
|
|
63
62
|
creator: existingCampaign.creatorAddress,
|
|
64
63
|
rewardTokenAddress: token.address,
|
|
65
64
|
params: JSON.stringify(existingCampaign.params),
|
|
66
|
-
type:
|
|
65
|
+
type: CampaignEnum[existingCampaign.type],
|
|
67
66
|
subType: existingCampaign.subType ?? undefined,
|
|
68
67
|
startTimestamp: existingCampaign.startTimestamp.toString(),
|
|
69
68
|
endTimestamp: existingCampaign.endTimestamp.toString(),
|
|
@@ -211,10 +210,10 @@ export class CampaignService {
|
|
|
211
210
|
/**
|
|
212
211
|
* Returns the campaign data
|
|
213
212
|
* @param type index of Campaign enum from sdk
|
|
214
|
-
* @returns
|
|
213
|
+
* @returns a string
|
|
215
214
|
*/
|
|
216
215
|
static getTypeFromV3(type) {
|
|
217
|
-
return
|
|
216
|
+
return CampaignEnum[type];
|
|
218
217
|
}
|
|
219
218
|
/**
|
|
220
219
|
* Split a campaigns array into three array for each status
|
|
@@ -253,6 +252,7 @@ export class CampaignService {
|
|
|
253
252
|
distributionChain: DistributionChain === null ? undefined : DistributionChain,
|
|
254
253
|
// Todo: need to be change to single 1 to 1 with campaign
|
|
255
254
|
campaignStatus: CampaignStatus?.[0],
|
|
255
|
+
creatorAddress: c.Creator.address,
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
258
|
static formatAsCampaignParameters(campaign) {
|
|
@@ -273,7 +273,7 @@ export class CampaignService {
|
|
|
273
273
|
* @returns
|
|
274
274
|
*/
|
|
275
275
|
static async fetchDynamicData(chainId, campaignType, campaigns) {
|
|
276
|
-
const calls = campaignsDynamicData(chainId, campaigns,
|
|
276
|
+
const calls = campaignsDynamicData(chainId, campaigns, CampaignEnum[campaignType]);
|
|
277
277
|
return await executeSimple(chainId, calls);
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
@@ -73,7 +73,7 @@ export declare abstract class ChainRepository {
|
|
|
73
73
|
* @param campaigns of v3 type
|
|
74
74
|
* @returns
|
|
75
75
|
*/
|
|
76
|
-
static fetchDynamicDataV3<
|
|
76
|
+
static fetchDynamicDataV3<C extends Campaign>(chainId: number, campaignType: C, campaigns: CampaignParameters<C>[]): Promise<any>;
|
|
77
77
|
static update(id: number, data: UpdateChainModel): Promise<{
|
|
78
78
|
name: string;
|
|
79
79
|
id: number;
|
|
@@ -62,7 +62,7 @@ export declare const DynamicDataController: Elysia<"/dynamic-data", false, {
|
|
|
62
62
|
rewardTokenAddress?: string | undefined;
|
|
63
63
|
distributionChain?: {} | undefined;
|
|
64
64
|
opportunityIdentifier?: string | undefined;
|
|
65
|
-
type:
|
|
65
|
+
type: string;
|
|
66
66
|
params: {};
|
|
67
67
|
computeChainId: number;
|
|
68
68
|
};
|
|
@@ -84,7 +84,7 @@ export declare const DynamicDataController: Elysia<"/dynamic-data", false, {
|
|
|
84
84
|
body: unknown;
|
|
85
85
|
params: {};
|
|
86
86
|
query: {
|
|
87
|
-
type?:
|
|
87
|
+
type?: string | undefined;
|
|
88
88
|
items?: number | undefined;
|
|
89
89
|
subType?: number | undefined;
|
|
90
90
|
page?: number | undefined;
|
|
@@ -17,35 +17,7 @@ export declare const SimplifiedCampaignDto: import("@sinclair/typebox").TObject<
|
|
|
17
17
|
campaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
18
18
|
identifier: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
19
19
|
creatorAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
20
|
-
type: import("@sinclair/typebox").
|
|
21
|
-
INVALID: "INVALID";
|
|
22
|
-
ERC20: "ERC20";
|
|
23
|
-
CLAMM: "CLAMM";
|
|
24
|
-
ERC20_SNAPSHOT: "ERC20_SNAPSHOT";
|
|
25
|
-
JSON_AIRDROP: "JSON_AIRDROP";
|
|
26
|
-
SILO: "SILO";
|
|
27
|
-
RADIANT: "RADIANT";
|
|
28
|
-
MORPHO: "MORPHO";
|
|
29
|
-
DOLOMITE: "DOLOMITE";
|
|
30
|
-
BADGER: "BADGER";
|
|
31
|
-
COMPOUND: "COMPOUND";
|
|
32
|
-
AJNA: "AJNA";
|
|
33
|
-
EULER: "EULER";
|
|
34
|
-
UNISWAP_V4: "UNISWAP_V4";
|
|
35
|
-
ION: "ION";
|
|
36
|
-
EIGENLAYER: "EIGENLAYER";
|
|
37
|
-
ERC20TRANSFERS: "ERC20TRANSFERS";
|
|
38
|
-
ERC20LOGPROCESSOR: "ERC20LOGPROCESSOR";
|
|
39
|
-
ERC20REBASELOGPROCESSOR: "ERC20REBASELOGPROCESSOR";
|
|
40
|
-
VEST: "VEST";
|
|
41
|
-
ERC20_FIX_APR: "ERC20_FIX_APR";
|
|
42
|
-
HYPERDRIVELOGPROCESSOR: "HYPERDRIVELOGPROCESSOR";
|
|
43
|
-
HYPERDRIVELOGFIXPROCESSOR: "HYPERDRIVELOGFIXPROCESSOR";
|
|
44
|
-
AMBIENTPROCESSOR: "AMBIENTPROCESSOR";
|
|
45
|
-
M0: "M0";
|
|
46
|
-
MORPHOSUPPLY: "MORPHOSUPPLY";
|
|
47
|
-
SYNCSWAP_VAULT: "SYNCSWAP_VAULT";
|
|
48
|
-
}>;
|
|
20
|
+
type: import("@sinclair/typebox").TString;
|
|
49
21
|
subType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
50
22
|
rewardTokenAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
51
23
|
amount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -69,35 +41,7 @@ export declare const FilledCampaignDto: import("@sinclair/typebox").TObject<{
|
|
|
69
41
|
campaignId: import("@sinclair/typebox").TString;
|
|
70
42
|
identifier: import("@sinclair/typebox").TString;
|
|
71
43
|
creatorAddress: import("@sinclair/typebox").TString;
|
|
72
|
-
type: import("@sinclair/typebox").
|
|
73
|
-
INVALID: "INVALID";
|
|
74
|
-
ERC20: "ERC20";
|
|
75
|
-
CLAMM: "CLAMM";
|
|
76
|
-
ERC20_SNAPSHOT: "ERC20_SNAPSHOT";
|
|
77
|
-
JSON_AIRDROP: "JSON_AIRDROP";
|
|
78
|
-
SILO: "SILO";
|
|
79
|
-
RADIANT: "RADIANT";
|
|
80
|
-
MORPHO: "MORPHO";
|
|
81
|
-
DOLOMITE: "DOLOMITE";
|
|
82
|
-
BADGER: "BADGER";
|
|
83
|
-
COMPOUND: "COMPOUND";
|
|
84
|
-
AJNA: "AJNA";
|
|
85
|
-
EULER: "EULER";
|
|
86
|
-
UNISWAP_V4: "UNISWAP_V4";
|
|
87
|
-
ION: "ION";
|
|
88
|
-
EIGENLAYER: "EIGENLAYER";
|
|
89
|
-
ERC20TRANSFERS: "ERC20TRANSFERS";
|
|
90
|
-
ERC20LOGPROCESSOR: "ERC20LOGPROCESSOR";
|
|
91
|
-
ERC20REBASELOGPROCESSOR: "ERC20REBASELOGPROCESSOR";
|
|
92
|
-
VEST: "VEST";
|
|
93
|
-
ERC20_FIX_APR: "ERC20_FIX_APR";
|
|
94
|
-
HYPERDRIVELOGPROCESSOR: "HYPERDRIVELOGPROCESSOR";
|
|
95
|
-
HYPERDRIVELOGFIXPROCESSOR: "HYPERDRIVELOGFIXPROCESSOR";
|
|
96
|
-
AMBIENTPROCESSOR: "AMBIENTPROCESSOR";
|
|
97
|
-
M0: "M0";
|
|
98
|
-
MORPHOSUPPLY: "MORPHOSUPPLY";
|
|
99
|
-
SYNCSWAP_VAULT: "SYNCSWAP_VAULT";
|
|
100
|
-
}>;
|
|
44
|
+
type: import("@sinclair/typebox").TString;
|
|
101
45
|
subType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
102
46
|
rewardTokenAddress: import("@sinclair/typebox").TString;
|
|
103
47
|
amount: import("@sinclair/typebox").TString;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CampaignType } from "../../../../database/api/.generated";
|
|
2
1
|
import { t } from "elysia";
|
|
3
2
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
|
4
3
|
export const DynamicDataSourceIdentifier = t.Object({
|
|
@@ -19,7 +18,7 @@ export const SimplifiedCampaignDto = t.Object({
|
|
|
19
18
|
campaignId: t.Optional(t.String()),
|
|
20
19
|
identifier: t.Optional(t.String()),
|
|
21
20
|
creatorAddress: t.Optional(t.String()),
|
|
22
|
-
type: t.
|
|
21
|
+
type: t.String(),
|
|
23
22
|
subType: t.Optional(t.Number()),
|
|
24
23
|
rewardTokenAddress: t.Optional(t.String()),
|
|
25
24
|
amount: t.Optional(t.String()),
|
|
@@ -43,7 +42,7 @@ export const FilledCampaignDto = t.Object({
|
|
|
43
42
|
campaignId: t.String(),
|
|
44
43
|
identifier: t.String(),
|
|
45
44
|
creatorAddress: t.String(),
|
|
46
|
-
type: t.
|
|
45
|
+
type: t.String(),
|
|
47
46
|
subType: t.Optional(t.Number()),
|
|
48
47
|
rewardTokenAddress: t.String(),
|
|
49
48
|
amount: t.String(),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Campaign, type ChainId } from "@sdk";
|
|
1
|
+
import { type ChainId } from "@sdk";
|
|
3
2
|
import { type GetCampaignQueryModel } from "../campaign";
|
|
4
3
|
import type { FilledCampaignDtoModel, SimplifiedCampaignDtoModel } from "./dynamicData.model";
|
|
5
4
|
type output = {
|
|
@@ -19,11 +18,5 @@ export declare class DynamicDataService {
|
|
|
19
18
|
static queryDynamicData(campaign: SimplifiedCampaignDtoModel): Promise<any[]>;
|
|
20
19
|
static queryDynamicDataFromCampaignId(query: GetCampaignQueryModel): Promise<any[]>;
|
|
21
20
|
static queryDynamicDataFromManyCampaignId(query: GetCampaignQueryModel): Promise<any[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Returns the campaign type index from the CampaignType enum
|
|
24
|
-
* @param type CampaignType as db-related enum for v4
|
|
25
|
-
* @returns index of Campaign enum from sdk
|
|
26
|
-
*/
|
|
27
|
-
static getV3FromType(type: CampaignType): Campaign;
|
|
28
21
|
}
|
|
29
22
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
|
2
2
|
import { executeSimple } from "../../../utils/execute";
|
|
3
3
|
import { log } from "../../../utils/logger";
|
|
4
|
-
import { CampaignType } from "../../../../database/api/.generated";
|
|
5
4
|
import { Campaign, NETWORK_LABELS } from "@sdk";
|
|
6
5
|
import { utils } from "ethers";
|
|
7
|
-
import { CampaignService
|
|
6
|
+
import { CampaignService } from "../campaign";
|
|
8
7
|
import { CampaignRepository } from "../campaign/campaign.repository";
|
|
9
8
|
import { OpportunityService } from "../opportunity";
|
|
10
9
|
export class DynamicDataService {
|
|
@@ -117,17 +116,9 @@ export class DynamicDataService {
|
|
|
117
116
|
const formattedCampaigns = campaigns.map(campaign => DynamicDataService.generateDummyData(CampaignService.format(campaign)));
|
|
118
117
|
return DynamicDataService.#getMultipleDynamicData(formattedCampaigns);
|
|
119
118
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Returns the campaign type index from the CampaignType enum
|
|
122
|
-
* @param type CampaignType as db-related enum for v4
|
|
123
|
-
* @returns index of Campaign enum from sdk
|
|
124
|
-
*/
|
|
125
|
-
static getV3FromType(type) {
|
|
126
|
-
return Object.entries(campaignTypeToEnumMap).find(([v4]) => v4 === type)?.[1];
|
|
127
|
-
}
|
|
128
119
|
static async #getDynamicData(campaign) {
|
|
129
120
|
// const campaignType = DynamicDataService.getV3FromType(campaign.type);
|
|
130
|
-
if (campaign.type !==
|
|
121
|
+
if (campaign.type !== "INVALID") {
|
|
131
122
|
return await CampaignService.fetchDynamicData(campaign.computeChainId, campaign.type, [campaign]);
|
|
132
123
|
}
|
|
133
124
|
}
|
|
@@ -136,12 +127,12 @@ export class DynamicDataService {
|
|
|
136
127
|
// const campaignType = DynamicDataService.getV3FromType(campaign.type);
|
|
137
128
|
const campaign = campaigns[0];
|
|
138
129
|
const filteredCampaigns = campaigns.filter(c => c.type === campaign.type);
|
|
139
|
-
if (campaign.type !==
|
|
130
|
+
if (campaign.type !== Campaign[Campaign.INVALID]) {
|
|
140
131
|
const resultDynamicData = await CampaignService.fetchDynamicData(campaign.computeChainId, campaign.type, filteredCampaigns);
|
|
141
132
|
for (const campaign of campaigns) {
|
|
142
133
|
const resultMetaData = await OpportunityService.fakeCreateFromCampaign({
|
|
143
134
|
...campaign,
|
|
144
|
-
type:
|
|
135
|
+
type: Campaign[campaign.type],
|
|
145
136
|
params: JSON.stringify(campaign.campaignParameters),
|
|
146
137
|
creator: campaign.creatorAddress,
|
|
147
138
|
});
|
|
@@ -21,7 +21,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
21
21
|
depositUrl?: string | undefined;
|
|
22
22
|
protocols?: string[] | undefined;
|
|
23
23
|
mainProtocol?: string | undefined;
|
|
24
|
-
type:
|
|
24
|
+
type: string;
|
|
25
25
|
tokens: {
|
|
26
26
|
chainId: number;
|
|
27
27
|
address: string;
|
|
@@ -29,7 +29,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
29
29
|
status: "NONE" | "PAST" | "LIVE" | "SOON";
|
|
30
30
|
identifier: string;
|
|
31
31
|
chainId: number;
|
|
32
|
-
action: "
|
|
32
|
+
action: "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "INVALID";
|
|
33
33
|
};
|
|
34
34
|
params: {};
|
|
35
35
|
query: unknown;
|
|
@@ -39,7 +39,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
39
39
|
response: {
|
|
40
40
|
200: {
|
|
41
41
|
name: string;
|
|
42
|
-
type:
|
|
42
|
+
type: string;
|
|
43
43
|
id: string;
|
|
44
44
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
|
45
45
|
tags: string[];
|
|
@@ -73,7 +73,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
73
73
|
200: {
|
|
74
74
|
id: string;
|
|
75
75
|
chainId: number;
|
|
76
|
-
type:
|
|
76
|
+
type: string;
|
|
77
77
|
identifier: string;
|
|
78
78
|
name: string;
|
|
79
79
|
status: "PAST" | "LIVE" | "SOON";
|
|
@@ -203,7 +203,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
203
203
|
icon: string;
|
|
204
204
|
} | undefined;
|
|
205
205
|
name: string;
|
|
206
|
-
type:
|
|
206
|
+
type: string;
|
|
207
207
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
|
208
208
|
tags: string[];
|
|
209
209
|
identifier: string;
|
|
@@ -364,7 +364,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
364
364
|
body: unknown;
|
|
365
365
|
params: {};
|
|
366
366
|
query: {
|
|
367
|
-
type?:
|
|
367
|
+
type?: string | undefined;
|
|
368
368
|
items?: number | undefined;
|
|
369
369
|
subType?: number | undefined;
|
|
370
370
|
page?: number | undefined;
|
|
@@ -501,12 +501,13 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
501
501
|
computedUntil: bigint;
|
|
502
502
|
processingStarted: bigint;
|
|
503
503
|
};
|
|
504
|
+
creatorAddress: string;
|
|
504
505
|
Creator: {
|
|
505
506
|
tags: string[];
|
|
506
507
|
address: string;
|
|
507
508
|
creatorId: string | null;
|
|
508
509
|
};
|
|
509
|
-
type:
|
|
510
|
+
type: string;
|
|
510
511
|
id: string;
|
|
511
512
|
subType: number | null;
|
|
512
513
|
startTimestamp: bigint;
|
|
@@ -517,7 +518,6 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
517
518
|
rewardTokenId: string;
|
|
518
519
|
amount: string;
|
|
519
520
|
opportunityId: string;
|
|
520
|
-
creatorAddress: string;
|
|
521
521
|
}[];
|
|
522
522
|
})[];
|
|
523
523
|
readonly 404: {
|
|
@@ -821,7 +821,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
|
821
821
|
response: {
|
|
822
822
|
200: {
|
|
823
823
|
name: string;
|
|
824
|
-
type:
|
|
824
|
+
type: string;
|
|
825
825
|
id: string;
|
|
826
826
|
status: import("../../../../database/api/.generated").$Enums.Status;
|
|
827
827
|
tags: string[];
|
|
@@ -5,7 +5,7 @@ import { type Protocol, type ProtocolId } from "../protocol/protocol.model";
|
|
|
5
5
|
import { type DailyRewardsRecord } from "../reward/reward.model";
|
|
6
6
|
import { type Token } from "../token/token.model";
|
|
7
7
|
import { type TvlRecord } from "../tvl/tvl.model";
|
|
8
|
-
import {
|
|
8
|
+
import { OpportunityAction } from "../../../../database/api/.generated";
|
|
9
9
|
import type { ChainId } from "@sdk";
|
|
10
10
|
import { type Chain } from "../chain/chain.model";
|
|
11
11
|
import type { OpportunityRepository } from "./opportunity.repository";
|
|
@@ -37,7 +37,7 @@ export type OpportunityMetadata = {
|
|
|
37
37
|
};
|
|
38
38
|
export type OpportunityUnique = {
|
|
39
39
|
chainId: ChainId;
|
|
40
|
-
type:
|
|
40
|
+
type: string;
|
|
41
41
|
identifier: string;
|
|
42
42
|
};
|
|
43
43
|
export declare const OpportunityResourceDto: import("@sinclair/typebox").TObject<{
|
|
@@ -301,35 +301,7 @@ export declare const GetOpportunityQueryDto: import("@sinclair/typebox").TObject
|
|
|
301
301
|
}>;
|
|
302
302
|
export declare const CreateOpportunityDto: import("@sinclair/typebox").TObject<{
|
|
303
303
|
chainId: import("@sinclair/typebox").TNumber;
|
|
304
|
-
type: import("@sinclair/typebox").
|
|
305
|
-
INVALID: "INVALID";
|
|
306
|
-
ERC20: "ERC20";
|
|
307
|
-
CLAMM: "CLAMM";
|
|
308
|
-
ERC20_SNAPSHOT: "ERC20_SNAPSHOT";
|
|
309
|
-
JSON_AIRDROP: "JSON_AIRDROP";
|
|
310
|
-
SILO: "SILO";
|
|
311
|
-
RADIANT: "RADIANT";
|
|
312
|
-
MORPHO: "MORPHO";
|
|
313
|
-
DOLOMITE: "DOLOMITE";
|
|
314
|
-
BADGER: "BADGER";
|
|
315
|
-
COMPOUND: "COMPOUND";
|
|
316
|
-
AJNA: "AJNA";
|
|
317
|
-
EULER: "EULER";
|
|
318
|
-
UNISWAP_V4: "UNISWAP_V4";
|
|
319
|
-
ION: "ION";
|
|
320
|
-
EIGENLAYER: "EIGENLAYER";
|
|
321
|
-
ERC20TRANSFERS: "ERC20TRANSFERS";
|
|
322
|
-
ERC20LOGPROCESSOR: "ERC20LOGPROCESSOR";
|
|
323
|
-
ERC20REBASELOGPROCESSOR: "ERC20REBASELOGPROCESSOR";
|
|
324
|
-
VEST: "VEST";
|
|
325
|
-
ERC20_FIX_APR: "ERC20_FIX_APR";
|
|
326
|
-
HYPERDRIVELOGPROCESSOR: "HYPERDRIVELOGPROCESSOR";
|
|
327
|
-
HYPERDRIVELOGFIXPROCESSOR: "HYPERDRIVELOGFIXPROCESSOR";
|
|
328
|
-
AMBIENTPROCESSOR: "AMBIENTPROCESSOR";
|
|
329
|
-
M0: "M0";
|
|
330
|
-
MORPHOSUPPLY: "MORPHOSUPPLY";
|
|
331
|
-
SYNCSWAP_VAULT: "SYNCSWAP_VAULT";
|
|
332
|
-
}>;
|
|
304
|
+
type: import("@sinclair/typebox").TString;
|
|
333
305
|
identifier: import("@sinclair/typebox").TString;
|
|
334
306
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
335
307
|
status: import("@sinclair/typebox").TEnum<{
|
|
@@ -4,7 +4,7 @@ import { ProtocolResourceDto } from "../protocol/protocol.model";
|
|
|
4
4
|
import { DailyRewardsRecordResourceDto } from "../reward/reward.model";
|
|
5
5
|
import { TokenDto, TokenResourceDto } from "../token/token.model";
|
|
6
6
|
import { TvlRecordResourceDto } from "../tvl/tvl.model";
|
|
7
|
-
import {
|
|
7
|
+
import { OpportunityAction, Status } from "../../../../database/api/.generated";
|
|
8
8
|
import { t } from "elysia";
|
|
9
9
|
import { ChainResourceDto } from "../chain/chain.model";
|
|
10
10
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
|
@@ -83,7 +83,7 @@ export const GetOpportunityQueryDto = t.Object({
|
|
|
83
83
|
});
|
|
84
84
|
export const CreateOpportunityDto = t.Object({
|
|
85
85
|
chainId: t.Number(),
|
|
86
|
-
type: t.
|
|
86
|
+
type: t.String(),
|
|
87
87
|
identifier: t.String(),
|
|
88
88
|
name: t.Optional(t.String()),
|
|
89
89
|
status: t.Enum(Status),
|