@merkl/api 0.10.132 → 0.10.134
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.js +1 -0
- package/dist/src/eden/index.d.ts +98 -25
- package/dist/src/index.d.ts +36 -7
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +4 -8
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +11 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.d.ts +50 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js +75 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +2 -0
- package/dist/src/modules/v4/enso/enso.service.d.ts +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +32 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +7 -2
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +4 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.js +3 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +10 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +4 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.js +3 -0
- package/dist/src/modules/v4/participate/participate.controller.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +3 -7
- package/dist/src/modules/v4/protocol/protocol.controller.js +4 -9
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +2 -2
- package/dist/src/modules/v4/protocol/protocol.model.js +4 -1
- package/dist/src/modules/v4/protocol/protocol.service.js +4 -3
- package/dist/src/modules/v4/router.d.ts +36 -7
- package/dist/src/routes/v3/ERC20Campaigns.d.ts +36 -7
- package/dist/src/routes/v3/blacklist.d.ts +36 -7
- package/dist/src/routes/v3/campaigns.d.ts +36 -7
- package/dist/src/routes/v3/campaignsInfo.d.ts +36 -7
- package/dist/src/routes/v3/multiChainPositions.d.ts +36 -7
- package/dist/src/routes/v3/opportunity.d.ts +36 -7
- package/dist/src/routes/v3/positions.d.ts +36 -7
- package/dist/src/routes/v3/rewards.d.ts +36 -7
- package/dist/src/routes/v3/updates.d.ts +36 -7
- package/dist/src/routes/v3/userRewards.d.ts +36 -7
- package/dist/src/utils/decodeCalls.js +3 -1
- package/dist/src/utils/encodeCalls.js +7 -1
- package/dist/src/utils/generateCardName.js +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +2 -1
package/dist/src/constants.d.ts
CHANGED
package/dist/src/constants.js
CHANGED
package/dist/src/eden/index.d.ts
CHANGED
@@ -378,6 +378,31 @@ declare const eden: {
|
|
378
378
|
200: number;
|
379
379
|
}>>;
|
380
380
|
};
|
381
|
+
aggregate: ((params: {
|
382
|
+
field: string | number;
|
383
|
+
}) => {
|
384
|
+
get: (options: {
|
385
|
+
headers?: Record<string, unknown> | undefined;
|
386
|
+
query: {
|
387
|
+
sort?: undefined;
|
388
|
+
name?: string | undefined;
|
389
|
+
tokens?: string | undefined;
|
390
|
+
status?: string | undefined;
|
391
|
+
items?: number | undefined;
|
392
|
+
tags?: string | undefined;
|
393
|
+
chainId?: string | undefined;
|
394
|
+
page?: number | undefined;
|
395
|
+
action?: string | undefined;
|
396
|
+
mainProtocolId?: string | undefined;
|
397
|
+
order?: undefined;
|
398
|
+
};
|
399
|
+
fetch?: RequestInit | undefined;
|
400
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
401
|
+
200: {
|
402
|
+
sum: File;
|
403
|
+
};
|
404
|
+
}>>;
|
405
|
+
}) & {};
|
381
406
|
};
|
382
407
|
campaigns: {
|
383
408
|
index: {
|
@@ -550,6 +575,7 @@ declare const eden: {
|
|
550
575
|
name: string;
|
551
576
|
url: string;
|
552
577
|
description: string;
|
578
|
+
id: string;
|
553
579
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
554
580
|
icon: string;
|
555
581
|
} | null;
|
@@ -571,23 +597,18 @@ declare const eden: {
|
|
571
597
|
name: string;
|
572
598
|
url: string;
|
573
599
|
description: string;
|
600
|
+
id: string;
|
574
601
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
575
602
|
icon: string;
|
576
603
|
} & {})[] | null;
|
577
604
|
}>>;
|
578
605
|
};
|
579
606
|
count: {
|
580
|
-
get: (options
|
607
|
+
get: (options?: {
|
581
608
|
headers?: Record<string, unknown> | undefined;
|
582
|
-
query
|
583
|
-
name?: string | undefined;
|
584
|
-
id?: string[] | undefined;
|
585
|
-
items?: number | undefined;
|
586
|
-
tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
|
587
|
-
page?: number | undefined;
|
588
|
-
};
|
609
|
+
query?: Record<string, unknown> | undefined;
|
589
610
|
fetch?: RequestInit | undefined;
|
590
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
611
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
591
612
|
200: number;
|
592
613
|
}>>;
|
593
614
|
};
|
@@ -1430,6 +1451,7 @@ declare const eden: {
|
|
1430
1451
|
name: string;
|
1431
1452
|
url: string;
|
1432
1453
|
description: string;
|
1454
|
+
id: string;
|
1433
1455
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
1434
1456
|
icon: string;
|
1435
1457
|
} & {})[] | null;
|
@@ -2218,6 +2240,38 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2218
2240
|
};
|
2219
2241
|
};
|
2220
2242
|
};
|
2243
|
+
} & {
|
2244
|
+
opportunities: {
|
2245
|
+
aggregate: {
|
2246
|
+
":field": {
|
2247
|
+
get: {
|
2248
|
+
body: unknown;
|
2249
|
+
params: {
|
2250
|
+
field: never;
|
2251
|
+
};
|
2252
|
+
query: {
|
2253
|
+
sort?: undefined;
|
2254
|
+
name?: string | undefined;
|
2255
|
+
tokens?: string | undefined;
|
2256
|
+
status?: string | undefined;
|
2257
|
+
items?: number | undefined;
|
2258
|
+
tags?: string | undefined;
|
2259
|
+
chainId?: string | undefined;
|
2260
|
+
page?: number | undefined;
|
2261
|
+
action?: string | undefined;
|
2262
|
+
mainProtocolId?: string | undefined;
|
2263
|
+
order?: undefined;
|
2264
|
+
};
|
2265
|
+
headers: unknown;
|
2266
|
+
response: {
|
2267
|
+
200: {
|
2268
|
+
sum: File;
|
2269
|
+
};
|
2270
|
+
};
|
2271
|
+
};
|
2272
|
+
};
|
2273
|
+
};
|
2274
|
+
};
|
2221
2275
|
};
|
2222
2276
|
} & {
|
2223
2277
|
v4: {
|
@@ -2422,6 +2476,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2422
2476
|
name: string;
|
2423
2477
|
url: string;
|
2424
2478
|
description: string;
|
2479
|
+
id: string;
|
2425
2480
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
2426
2481
|
icon: string;
|
2427
2482
|
} | null;
|
@@ -2448,6 +2503,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2448
2503
|
name: string;
|
2449
2504
|
url: string;
|
2450
2505
|
description: string;
|
2506
|
+
id: string;
|
2451
2507
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
2452
2508
|
icon: string;
|
2453
2509
|
} & {})[] | null;
|
@@ -2461,13 +2517,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2461
2517
|
get: {
|
2462
2518
|
body: unknown;
|
2463
2519
|
params: {};
|
2464
|
-
query:
|
2465
|
-
name?: string | undefined;
|
2466
|
-
id?: string[] | undefined;
|
2467
|
-
items?: number | undefined;
|
2468
|
-
tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
|
2469
|
-
page?: number | undefined;
|
2470
|
-
};
|
2520
|
+
query: unknown;
|
2471
2521
|
headers: unknown;
|
2472
2522
|
response: {
|
2473
2523
|
200: number;
|
@@ -3547,6 +3597,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
3547
3597
|
name: string;
|
3548
3598
|
url: string;
|
3549
3599
|
description: string;
|
3600
|
+
id: string;
|
3550
3601
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
3551
3602
|
icon: string;
|
3552
3603
|
} & {})[] | null;
|
@@ -4385,6 +4436,31 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4385
4436
|
200: number;
|
4386
4437
|
}>>;
|
4387
4438
|
};
|
4439
|
+
aggregate: ((params: {
|
4440
|
+
field: string | number;
|
4441
|
+
}) => {
|
4442
|
+
get: (options: {
|
4443
|
+
headers?: Record<string, unknown> | undefined;
|
4444
|
+
query: {
|
4445
|
+
sort?: undefined;
|
4446
|
+
name?: string | undefined;
|
4447
|
+
tokens?: string | undefined;
|
4448
|
+
status?: string | undefined;
|
4449
|
+
items?: number | undefined;
|
4450
|
+
tags?: string | undefined;
|
4451
|
+
chainId?: string | undefined;
|
4452
|
+
page?: number | undefined;
|
4453
|
+
action?: string | undefined;
|
4454
|
+
mainProtocolId?: string | undefined;
|
4455
|
+
order?: undefined;
|
4456
|
+
};
|
4457
|
+
fetch?: RequestInit | undefined;
|
4458
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
4459
|
+
200: {
|
4460
|
+
sum: File;
|
4461
|
+
};
|
4462
|
+
}>>;
|
4463
|
+
}) & {};
|
4388
4464
|
};
|
4389
4465
|
campaigns: {
|
4390
4466
|
index: {
|
@@ -4557,6 +4633,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4557
4633
|
name: string;
|
4558
4634
|
url: string;
|
4559
4635
|
description: string;
|
4636
|
+
id: string;
|
4560
4637
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
4561
4638
|
icon: string;
|
4562
4639
|
} | null;
|
@@ -4578,23 +4655,18 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4578
4655
|
name: string;
|
4579
4656
|
url: string;
|
4580
4657
|
description: string;
|
4658
|
+
id: string;
|
4581
4659
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
4582
4660
|
icon: string;
|
4583
4661
|
} & {})[] | null;
|
4584
4662
|
}>>;
|
4585
4663
|
};
|
4586
4664
|
count: {
|
4587
|
-
get: (options
|
4665
|
+
get: (options?: {
|
4588
4666
|
headers?: Record<string, unknown> | undefined;
|
4589
|
-
query
|
4590
|
-
name?: string | undefined;
|
4591
|
-
id?: string[] | undefined;
|
4592
|
-
items?: number | undefined;
|
4593
|
-
tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
|
4594
|
-
page?: number | undefined;
|
4595
|
-
};
|
4667
|
+
query?: Record<string, unknown> | undefined;
|
4596
4668
|
fetch?: RequestInit | undefined;
|
4597
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
4669
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
4598
4670
|
200: number;
|
4599
4671
|
}>>;
|
4600
4672
|
};
|
@@ -5437,6 +5509,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
5437
5509
|
name: string;
|
5438
5510
|
url: string;
|
5439
5511
|
description: string;
|
5512
|
+
id: string;
|
5440
5513
|
tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
|
5441
5514
|
icon: string;
|
5442
5515
|
} & {})[] | null;
|
package/dist/src/index.d.ts
CHANGED
@@ -435,6 +435,38 @@ declare const app: Elysia<"", false, {
|
|
435
435
|
};
|
436
436
|
};
|
437
437
|
};
|
438
|
+
} & {
|
439
|
+
opportunities: {
|
440
|
+
aggregate: {
|
441
|
+
":field": {
|
442
|
+
get: {
|
443
|
+
body: unknown;
|
444
|
+
params: {
|
445
|
+
field: never;
|
446
|
+
};
|
447
|
+
query: {
|
448
|
+
sort?: undefined;
|
449
|
+
name?: string | undefined;
|
450
|
+
tokens?: string | undefined;
|
451
|
+
status?: string | undefined;
|
452
|
+
items?: number | undefined;
|
453
|
+
tags?: string | undefined;
|
454
|
+
chainId?: string | undefined;
|
455
|
+
page?: number | undefined;
|
456
|
+
action?: string | undefined;
|
457
|
+
mainProtocolId?: string | undefined;
|
458
|
+
order?: undefined;
|
459
|
+
};
|
460
|
+
headers: unknown;
|
461
|
+
response: {
|
462
|
+
200: {
|
463
|
+
sum: File;
|
464
|
+
};
|
465
|
+
};
|
466
|
+
};
|
467
|
+
};
|
468
|
+
};
|
469
|
+
};
|
438
470
|
};
|
439
471
|
} & {
|
440
472
|
v4: {
|
@@ -639,6 +671,7 @@ declare const app: Elysia<"", false, {
|
|
639
671
|
name: string;
|
640
672
|
url: string;
|
641
673
|
description: string;
|
674
|
+
id: string;
|
642
675
|
tags: import("../database/api/.generated").$Enums.ProtocolTag[];
|
643
676
|
icon: string;
|
644
677
|
} | null;
|
@@ -665,6 +698,7 @@ declare const app: Elysia<"", false, {
|
|
665
698
|
name: string;
|
666
699
|
url: string;
|
667
700
|
description: string;
|
701
|
+
id: string;
|
668
702
|
tags: import("../database/api/.generated").$Enums.ProtocolTag[];
|
669
703
|
icon: string;
|
670
704
|
} & {})[] | null;
|
@@ -678,13 +712,7 @@ declare const app: Elysia<"", false, {
|
|
678
712
|
get: {
|
679
713
|
body: unknown;
|
680
714
|
params: {};
|
681
|
-
query:
|
682
|
-
name?: string | undefined;
|
683
|
-
id?: string[] | undefined;
|
684
|
-
items?: number | undefined;
|
685
|
-
tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
|
686
|
-
page?: number | undefined;
|
687
|
-
};
|
715
|
+
query: unknown;
|
688
716
|
headers: unknown;
|
689
717
|
response: {
|
690
718
|
200: number;
|
@@ -1764,6 +1792,7 @@ declare const app: Elysia<"", false, {
|
|
1764
1792
|
name: string;
|
1765
1793
|
url: string;
|
1766
1794
|
description: string;
|
1795
|
+
id: string;
|
1767
1796
|
tags: import("../database/api/.generated").$Enums.ProtocolTag[];
|
1768
1797
|
icon: string;
|
1769
1798
|
} & {})[] | null;
|
@@ -33,23 +33,19 @@ export async function ERC20DynamicDataRefacto(chainId, campaigns) {
|
|
33
33
|
allowFailure: true,
|
34
34
|
callData: FactoryInterface.encodeFunctionData("factory"),
|
35
35
|
target: campaign.campaignParameters.targetToken,
|
36
|
-
}
|
37
|
-
callsRounds1.push({
|
36
|
+
}, {
|
38
37
|
allowFailure: true,
|
39
38
|
callData: MetamorphoInterface.encodeFunctionData("MORPHO"),
|
40
39
|
target: campaign.campaignParameters.targetToken,
|
41
|
-
}
|
42
|
-
callsRounds1.push({
|
40
|
+
}, {
|
43
41
|
allowFailure: true,
|
44
42
|
callData: ERC20Interface.encodeFunctionData("name"),
|
45
43
|
target: campaign.campaignParameters.targetToken,
|
46
|
-
}
|
47
|
-
callsRounds1.push({
|
44
|
+
}, {
|
48
45
|
allowFailure: true,
|
49
46
|
callData: BalancerPoolInterface.encodeFunctionData("getPoolId"),
|
50
47
|
target: campaign.campaignParameters.targetToken,
|
51
|
-
}
|
52
|
-
callsRounds1.push({
|
48
|
+
}, {
|
53
49
|
allowFailure: true,
|
54
50
|
callData: EnzymeInterface.encodeFunctionData("getCreator"),
|
55
51
|
target: campaign.campaignParameters.targetToken,
|
@@ -46,10 +46,11 @@ export declare enum tokenType {
|
|
46
46
|
koi = "koi",
|
47
47
|
baseswap = "baseswap",
|
48
48
|
zkswap = "zkswap",
|
49
|
-
pendle = "pendle",
|
50
49
|
ironcladStaking = "ironcladStaking",
|
51
50
|
rfx = "rfx",
|
52
|
-
woofi = "woofi"
|
51
|
+
woofi = "woofi",
|
52
|
+
pendle = "pendle",
|
53
|
+
maverickBoostedPosition = "maverickBoostedPosition"
|
53
54
|
}
|
54
55
|
export declare const tokenTypeToProtocol: {
|
55
56
|
[key in tokenType]: {
|
@@ -47,10 +47,11 @@ export var tokenType;
|
|
47
47
|
tokenType["koi"] = "koi";
|
48
48
|
tokenType["baseswap"] = "baseswap";
|
49
49
|
tokenType["zkswap"] = "zkswap";
|
50
|
-
tokenType["pendle"] = "pendle";
|
51
50
|
tokenType["ironcladStaking"] = "ironcladStaking";
|
52
51
|
tokenType["rfx"] = "rfx";
|
53
52
|
tokenType["woofi"] = "woofi";
|
53
|
+
tokenType["pendle"] = "pendle";
|
54
|
+
tokenType["maverickBoostedPosition"] = "maverickBoostedPosition";
|
54
55
|
})(tokenType || (tokenType = {}));
|
55
56
|
export const tokenTypeToProtocol = {
|
56
57
|
[tokenType.aave_borrowing]: { protocol: "Aave" },
|
@@ -100,7 +101,14 @@ export const tokenTypeToProtocol = {
|
|
100
101
|
[tokenType.zerolend_borrowing]: { protocol: "ZeroLend" },
|
101
102
|
[tokenType.zerolend_lending]: { protocol: "ZeroLend" },
|
102
103
|
[tokenType.zkswap]: { protocol: "ZKSwap" },
|
103
|
-
[tokenType.ironcladStaking]: { protocol: "Ironclad" },
|
104
104
|
[tokenType.rfx]: { protocol: "RFX" },
|
105
|
-
[tokenType.woofi]: {
|
105
|
+
[tokenType.woofi]: {
|
106
|
+
protocol: "Woofi",
|
107
|
+
},
|
108
|
+
[tokenType.ironcladStaking]: {
|
109
|
+
protocol: "Ironclad",
|
110
|
+
},
|
111
|
+
[tokenType.maverickBoostedPosition]: {
|
112
|
+
protocol: "Maverick",
|
113
|
+
},
|
106
114
|
};
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.d.ts
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
import type { Pricer } from "../../../../../utils/pricer";
|
2
|
+
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
|
+
import type { tokenType } from "../helpers/tokenType";
|
4
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
5
|
+
type callType = {
|
6
|
+
key: keyof dataRawMaverickBP;
|
7
|
+
call: string;
|
8
|
+
target: keyof callKeysMaverickBP;
|
9
|
+
metaData?: keyof callKeysMaverickBP;
|
10
|
+
};
|
11
|
+
type callKeysMaverickBP = mandatoryCallKeys & {
|
12
|
+
boostedPositionInformation: string;
|
13
|
+
tokenA: string;
|
14
|
+
tokenB: string;
|
15
|
+
lensAddress: string;
|
16
|
+
};
|
17
|
+
type dataRawMaverickBP = callKeysMaverickBP & {
|
18
|
+
amountA: string;
|
19
|
+
amountB: string;
|
20
|
+
decimalsTokenA: string;
|
21
|
+
decimalsTokenB: string;
|
22
|
+
bpInfoReturnData: {
|
23
|
+
[key: string]: string | number;
|
24
|
+
};
|
25
|
+
symbolTokenA: string;
|
26
|
+
symbolTokenB: string;
|
27
|
+
};
|
28
|
+
type dataTypeMaverickBP = dataType & {
|
29
|
+
amountA: number;
|
30
|
+
amountB: number;
|
31
|
+
decimalsTokenA: number;
|
32
|
+
decimalsTokenB: number;
|
33
|
+
lensAddress: string;
|
34
|
+
symbolTokenA: string;
|
35
|
+
symbolTokenB: string;
|
36
|
+
tokenA: string;
|
37
|
+
tokenB: string;
|
38
|
+
};
|
39
|
+
export declare class MaverickBPProcessor extends GenericProcessor<callKeysMaverickBP, dataRawMaverickBP, dataTypeMaverickBP> {
|
40
|
+
rounds: {
|
41
|
+
round1: callType[];
|
42
|
+
round2: callType[];
|
43
|
+
round3: callType[];
|
44
|
+
round4: callType[];
|
45
|
+
};
|
46
|
+
processingRound1(typeInfo: dataRawMaverickBP): void;
|
47
|
+
processingRound2(typeInfo: dataRawMaverickBP): void;
|
48
|
+
processingRound5(_index: number, type: tokenType, typeInfo: dataRawMaverickBP, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeMaverickBP>;
|
49
|
+
}
|
50
|
+
export {};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import { MAVERICK_ZKSYNC_BP_LENS_ADDRESS } from "../../../../../constants";
|
2
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
3
|
+
import { BN2Number } from "@sdk";
|
4
|
+
import { GenericProcessor } from "./GenericProcessor";
|
5
|
+
export class MaverickBPProcessor extends GenericProcessor {
|
6
|
+
rounds = {
|
7
|
+
round1: [
|
8
|
+
{
|
9
|
+
key: "bpInfoReturnData",
|
10
|
+
call: "boostedPositionInformation",
|
11
|
+
target: "lensAddress",
|
12
|
+
metaData: "tokenAddress",
|
13
|
+
},
|
14
|
+
],
|
15
|
+
round2: [
|
16
|
+
{
|
17
|
+
key: "symbolTokenA",
|
18
|
+
call: "symbol",
|
19
|
+
target: "tokenA",
|
20
|
+
},
|
21
|
+
{
|
22
|
+
key: "symbolTokenB",
|
23
|
+
call: "symbol",
|
24
|
+
target: "tokenB",
|
25
|
+
},
|
26
|
+
{
|
27
|
+
key: "decimalsTokenA",
|
28
|
+
call: "decimals",
|
29
|
+
target: "tokenA",
|
30
|
+
},
|
31
|
+
{
|
32
|
+
key: "decimalsTokenB",
|
33
|
+
call: "decimals",
|
34
|
+
target: "tokenB",
|
35
|
+
},
|
36
|
+
],
|
37
|
+
round3: [],
|
38
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
39
|
+
};
|
40
|
+
processingRound1(typeInfo) {
|
41
|
+
typeInfo.lensAddress = MAVERICK_ZKSYNC_BP_LENS_ADDRESS;
|
42
|
+
}
|
43
|
+
processingRound2(typeInfo) {
|
44
|
+
typeInfo.tokenA = typeInfo.bpInfoReturnData.tokenA;
|
45
|
+
typeInfo.tokenB = typeInfo.bpInfoReturnData.tokenB;
|
46
|
+
typeInfo.amountA = typeInfo.bpInfoReturnData.amountA.toString();
|
47
|
+
typeInfo.amountB = typeInfo.bpInfoReturnData.amountB.toString();
|
48
|
+
}
|
49
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
50
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
51
|
+
const decimalsTokenA = Number(typeInfo.decimalsTokenA);
|
52
|
+
const decimalsTokenB = Number(typeInfo.decimalsTokenB);
|
53
|
+
const amountA = BN2Number(typeInfo.amountA, decimalsTokenA);
|
54
|
+
const amountB = BN2Number(typeInfo.amountB, decimalsTokenB);
|
55
|
+
const tokenAPRice = (await pricer.get({ symbol: typeInfo.symbolTokenA })) ?? 0;
|
56
|
+
const tokenBPrice = (await pricer.get({ symbol: typeInfo.symbolTokenB })) ?? 0;
|
57
|
+
// Not rebased (ie divided by 10edecimals)
|
58
|
+
const tvl = tokenAPRice * amountA + tokenBPrice * amountB;
|
59
|
+
const priceTargetToken = tvl / totalSupply;
|
60
|
+
const { bpInfoReturnData, ...rest } = typeInfo;
|
61
|
+
return {
|
62
|
+
...rest,
|
63
|
+
blacklistedSupply,
|
64
|
+
amountA,
|
65
|
+
amountB,
|
66
|
+
decimalsTokenA,
|
67
|
+
decimalsTokenB,
|
68
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
69
|
+
priceTargetToken: priceTargetToken,
|
70
|
+
totalSupply,
|
71
|
+
tvl,
|
72
|
+
whitelistedSupplyTargetToken,
|
73
|
+
};
|
74
|
+
}
|
75
|
+
}
|
@@ -13,6 +13,7 @@ import { FluidProcessor } from "./FluidProcessor";
|
|
13
13
|
import { FraxProcessor } from "./FraxProcessor";
|
14
14
|
import { GearboxProcessor } from "./GearboxProcessor";
|
15
15
|
import { GenericProcessor } from "./GenericProcessor";
|
16
|
+
import { MaverickBPProcessor } from "./MaverickBPProcessor";
|
16
17
|
import { MetamorphoProcessor } from "./MetamorphoProcessor";
|
17
18
|
import { PendleProcessor } from "./PendleProcessor";
|
18
19
|
import { RadiantProcessor } from "./RadiantProcessor";
|
@@ -74,4 +75,5 @@ export const processorMapping = {
|
|
74
75
|
[tokenType.ironcladStaking]: GenericProcessor,
|
75
76
|
[tokenType.rfx]: RfxProcessor,
|
76
77
|
[tokenType.woofi]: WoofiProcessor,
|
78
|
+
[tokenType.maverickBoostedPosition]: MaverickBPProcessor,
|
77
79
|
};
|
@@ -81,6 +81,8 @@ function satisfiesNameConditions(name, type) {
|
|
81
81
|
return lowerCaseName === "ironclad token";
|
82
82
|
case tokenType.woofi:
|
83
83
|
return lowerCaseName.includes("woofi");
|
84
|
+
case tokenType.maverickBoostedPosition:
|
85
|
+
return lowerCaseName.includes("maverick");
|
84
86
|
default:
|
85
87
|
return false;
|
86
88
|
}
|
@@ -408,6 +408,38 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
408
408
|
};
|
409
409
|
};
|
410
410
|
};
|
411
|
+
} & {
|
412
|
+
opportunities: {
|
413
|
+
aggregate: {
|
414
|
+
":field": {
|
415
|
+
get: {
|
416
|
+
body: unknown;
|
417
|
+
params: {
|
418
|
+
field: never;
|
419
|
+
};
|
420
|
+
query: {
|
421
|
+
sort?: undefined;
|
422
|
+
name?: string | undefined;
|
423
|
+
tokens?: string | undefined;
|
424
|
+
status?: string | undefined;
|
425
|
+
items?: number | undefined;
|
426
|
+
tags?: string | undefined;
|
427
|
+
chainId?: string | undefined;
|
428
|
+
page?: number | undefined;
|
429
|
+
action?: string | undefined;
|
430
|
+
mainProtocolId?: string | undefined;
|
431
|
+
order?: undefined;
|
432
|
+
};
|
433
|
+
headers: unknown;
|
434
|
+
response: {
|
435
|
+
200: {
|
436
|
+
sum: File;
|
437
|
+
};
|
438
|
+
};
|
439
|
+
};
|
440
|
+
};
|
441
|
+
};
|
442
|
+
};
|
411
443
|
}, {
|
412
444
|
derive: {};
|
413
445
|
resolve: {};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { NotFoundError } from "../../../errors";
|
2
2
|
import { AuthorizationHeadersDto, TokenAuthGuard } from "../../../guards/TokenAuth.guard";
|
3
3
|
import Elysia from "elysia";
|
4
|
-
import { CreateOpportunityDto, GetOpportunitiesQueryDto, OpportunityUniqueDto } from "./opportunity.model";
|
4
|
+
import { CreateOpportunityDto, GetOpportunitiesQueryDto, OpportunityAggregateFieldDto, OpportunityUniqueDto, } from "./opportunity.model";
|
5
5
|
import { OpportunityService } from "./opportunity.service";
|
6
6
|
import { transformId } from "./transform-id.pipe";
|
7
7
|
import { validateId } from "./validate-id.pipe";
|
@@ -60,4 +60,9 @@ export const OpportunityController = new Elysia({ prefix: "/opportunities", deta
|
|
60
60
|
query: GetOpportunitiesQueryDto,
|
61
61
|
})
|
62
62
|
// ─── Get Opportunities Count ─────────────────────────────────────────
|
63
|
-
.get("/count", async ({ query }) => await OpportunityService.countMany(query), { query: GetOpportunitiesQueryDto })
|
63
|
+
.get("/count", async ({ query }) => await OpportunityService.countMany(query), { query: GetOpportunitiesQueryDto })
|
64
|
+
// ─── Get Aggregate fields ─────────────────────────────────────────
|
65
|
+
.get("/aggregate/:field", async ({ query, params }) => await OpportunityService.aggregate(query, params.field), {
|
66
|
+
params: OpportunityAggregateFieldDto,
|
67
|
+
query: GetOpportunitiesQueryDto,
|
68
|
+
});
|
@@ -107,7 +107,11 @@ export declare const CreateOpportunityDto: import("@sinclair/typebox").TObject<{
|
|
107
107
|
protocols: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
108
108
|
mainProtocol: import("@sinclair/typebox").TString;
|
109
109
|
}>;
|
110
|
+
export declare const OpportunityAggregateFieldDto: import("@sinclair/typebox").TObject<{
|
111
|
+
field: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"dailyRewards">[]>;
|
112
|
+
}>;
|
110
113
|
export type GetOpportunitiesQueryEntity = typeof GetOpportunitiesQueryDto.static;
|
111
114
|
export type CreateOpportunityModel = typeof CreateOpportunityDto.static & {
|
112
115
|
id: string;
|
113
116
|
};
|
117
|
+
export type OpportunityAggregateField = typeof OpportunityAggregateFieldDto.static;
|
@@ -476,4 +476,7 @@ export declare abstract class OpportunityRepository {
|
|
476
476
|
apr: number;
|
477
477
|
dailyRewards: number;
|
478
478
|
}>;
|
479
|
+
static aggregateSum(field: keyof Prisma.OpportunitySumAggregateInputType, query: GetOpportunitiesQueryEntity): Promise<{
|
480
|
+
sum: never;
|
481
|
+
}>;
|
479
482
|
}
|
@@ -214,4 +214,14 @@ export class OpportunityRepository {
|
|
214
214
|
static async updateApr(id, apr) {
|
215
215
|
return await apiDbClient.opportunity.update({ where: { id }, data: { apr } });
|
216
216
|
}
|
217
|
+
static async aggregateSum(field, query) {
|
218
|
+
const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
|
219
|
+
const result = await apiDbClient.opportunity.aggregate({
|
220
|
+
_sum: {
|
221
|
+
[field]: true,
|
222
|
+
},
|
223
|
+
...args,
|
224
|
+
});
|
225
|
+
return { sum: result._sum[field] ?? null };
|
226
|
+
}
|
217
227
|
}
|