@merkl/api 0.20.32 → 0.20.34
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/eden/index.d.ts +73 -13
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.d.ts +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/spliceTVL.d.ts +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/helpers/spliceTVL.js +2 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.js +7 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.js +7 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.js +5 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.d.ts +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.js +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.d.ts +16 -16
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.js +27 -23
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.js +5 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.js +11 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.js +11 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.js +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +6 -7
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.d.ts +2 -2
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.js +14 -37
- package/dist/src/engine/opportunityMetadata/implementations/Euler.d.ts +1 -1
- package/dist/src/engine/opportunityMetadata/implementations/Euler.js +3 -2
- package/dist/src/engine/opportunityMetadata/implementations/UniswapV4.d.ts +1 -1
- package/dist/src/engine/opportunityMetadata/implementations/UniswapV4.js +2 -4
- package/dist/src/index.d.ts +13 -1
- package/dist/src/modules/v4/campaign/campaign.controller.js +1 -1
- package/dist/src/modules/v4/chain/chain.controller.d.ts +2 -0
- package/dist/src/modules/v4/chain/chain.model.d.ts +1 -0
- package/dist/src/modules/v4/chain/chain.model.js +1 -0
- package/dist/src/modules/v4/chain/chain.repository.d.ts +11 -0
- package/dist/src/modules/v4/chain/chain.repository.js +4 -1
- package/dist/src/modules/v4/chain/chain.service.js +1 -1
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +3 -3
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +11 -1
- package/dist/src/modules/v4/protocol/protocol.controller.js +2 -1
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -0
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
- package/dist/src/modules/v4/protocol/protocol.repository.js +33 -28
- package/dist/src/modules/v4/protocol/protocol.service.js +12 -8
- package/dist/src/modules/v4/router.d.ts +13 -1
- package/dist/src/utils/generateCardName.d.ts +1 -1
- package/dist/src/utils/generateCardName.js +3 -15
- package/dist/src/utils/sanitizeChain.d.ts +2 -0
- package/dist/src/utils/sanitizeChain.js +6 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
@@ -1892,6 +1892,7 @@ declare const app: Elysia<"", false, {
|
|
1892
1892
|
items?: number | undefined;
|
1893
1893
|
tags?: string[] | undefined;
|
1894
1894
|
page?: number | undefined;
|
1895
|
+
test?: boolean | undefined;
|
1895
1896
|
ids?: string[] | undefined;
|
1896
1897
|
opportunityTag?: string | undefined;
|
1897
1898
|
};
|
@@ -1919,7 +1920,16 @@ declare const app: Elysia<"", false, {
|
|
1919
1920
|
get: {
|
1920
1921
|
body: unknown;
|
1921
1922
|
params: {};
|
1922
|
-
query:
|
1923
|
+
query: {
|
1924
|
+
id?: string | undefined;
|
1925
|
+
name?: string | undefined;
|
1926
|
+
items?: number | undefined;
|
1927
|
+
tags?: string[] | undefined;
|
1928
|
+
page?: number | undefined;
|
1929
|
+
test?: boolean | undefined;
|
1930
|
+
ids?: string[] | undefined;
|
1931
|
+
opportunityTag?: string | undefined;
|
1932
|
+
};
|
1923
1933
|
headers: unknown;
|
1924
1934
|
response: {
|
1925
1935
|
200: number;
|
@@ -2847,6 +2857,7 @@ declare const app: Elysia<"", false, {
|
|
2847
2857
|
params: {};
|
2848
2858
|
query: {
|
2849
2859
|
name?: string | undefined;
|
2860
|
+
test?: boolean | undefined;
|
2850
2861
|
};
|
2851
2862
|
headers: unknown;
|
2852
2863
|
response: {
|
@@ -2873,6 +2884,7 @@ declare const app: Elysia<"", false, {
|
|
2873
2884
|
params: {};
|
2874
2885
|
query: {
|
2875
2886
|
name?: string | undefined;
|
2887
|
+
test?: boolean | undefined;
|
2876
2888
|
};
|
2877
2889
|
headers: unknown;
|
2878
2890
|
response: {
|
@@ -63,7 +63,7 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
|
|
63
63
|
throw new NotFoundError();
|
64
64
|
const campaign = await CampaignService.findUniqueOrThrow(id, true);
|
65
65
|
const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(Campaign[campaign.type], CampaignService.format(campaign), campaign.Opportunity.identifier);
|
66
|
-
return await DynamicDataService.
|
66
|
+
return await DynamicDataService.updateForCampaignType([campaignV3], campaignV3.campaignType, true);
|
67
67
|
}, { beforeHandle: BackOfficeGuard, headers: AuthorizationHeadersDto, detail: { hide: true } })
|
68
68
|
// ─── Test Dynamic data computation with a list of campaignId ───────────────────────
|
69
69
|
.post("/dynamic-data", async ({ body }) => {
|
@@ -45,6 +45,7 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
45
45
|
params: {};
|
46
46
|
query: {
|
47
47
|
name?: string | undefined;
|
48
|
+
test?: boolean | undefined;
|
48
49
|
};
|
49
50
|
headers: unknown;
|
50
51
|
response: {
|
@@ -71,6 +72,7 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
71
72
|
params: {};
|
72
73
|
query: {
|
73
74
|
name?: string | undefined;
|
75
|
+
test?: boolean | undefined;
|
74
76
|
};
|
75
77
|
headers: unknown;
|
76
78
|
response: {
|
@@ -12,6 +12,7 @@ export declare const ChainResourceDto: import("@sinclair/typebox").TObject<{
|
|
12
12
|
}>;
|
13
13
|
export declare const GetChainQueryDto: import("@sinclair/typebox").TObject<{
|
14
14
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
15
|
+
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
15
16
|
}>;
|
16
17
|
export declare const ChainUniqueDto: import("@sinclair/typebox").TObject<{
|
17
18
|
chainId: import("@sinclair/typebox").TNumber;
|
@@ -8,6 +8,7 @@ export const ChainResourceDto = t.Object({
|
|
8
8
|
});
|
9
9
|
export const GetChainQueryDto = t.Object({
|
10
10
|
name: t.Optional(t.String({ description: "Search by blockchain name" })),
|
11
|
+
test: t.Optional(t.Boolean({ description: "Includes chains that have only test opportunities.", default: false })),
|
11
12
|
});
|
12
13
|
export const ChainUniqueDto = t.Object({
|
13
14
|
chainId: t.Numeric(),
|
@@ -22,6 +22,17 @@ export declare class ChainRepository {
|
|
22
22
|
contains: string;
|
23
23
|
mode: "insensitive";
|
24
24
|
} | undefined;
|
25
|
+
Opportunity: {
|
26
|
+
some: {
|
27
|
+
Campaigns: {
|
28
|
+
some: {
|
29
|
+
RewardToken: {
|
30
|
+
isTest: false;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
};
|
34
|
+
};
|
35
|
+
} | undefined;
|
25
36
|
};
|
26
37
|
};
|
27
38
|
/** Returns many chains based on query
|
@@ -11,7 +11,10 @@ export class ChainRepository {
|
|
11
11
|
}
|
12
12
|
static transformQueryToPrismaFilters(query) {
|
13
13
|
return {
|
14
|
-
where: {
|
14
|
+
where: {
|
15
|
+
name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
|
16
|
+
Opportunity: query.test ? undefined : { some: { Campaigns: { some: { RewardToken: { isTest: false } } } } },
|
17
|
+
},
|
15
18
|
};
|
16
19
|
}
|
17
20
|
/** Returns many chains based on query
|
@@ -8,7 +8,7 @@ export class ChainService {
|
|
8
8
|
}
|
9
9
|
//TODO: determine find vs get nomenclature and cache handling
|
10
10
|
static async findMany(query) {
|
11
|
-
return await CacheService.wrap(TTLPresets.
|
11
|
+
return await CacheService.wrap(TTLPresets.MIN_10, ChainRepository.findMany, query);
|
12
12
|
}
|
13
13
|
static async countMany(query) {
|
14
14
|
return await ChainRepository.countMany(query);
|
@@ -722,7 +722,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
722
722
|
campaignType: Campaign.EVENT_BASED,
|
723
723
|
contract: "0xd0bc067cf877f7b76ceb331891331d9e6acda1a7",
|
724
724
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
725
|
-
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n **
|
725
|
+
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 20n).toString() }],
|
726
726
|
computeScoreParameters: {
|
727
727
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
728
728
|
computeSettings: {
|
@@ -752,7 +752,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
752
752
|
campaignType: Campaign.EVENT_BASED,
|
753
753
|
contract: "0x65ea4dd7f789c71c0f57ed84b3bdc3062898d3cb",
|
754
754
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
755
|
-
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n **
|
755
|
+
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 20n).toString() }],
|
756
756
|
computeScoreParameters: {
|
757
757
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
758
758
|
computeSettings: {
|
@@ -782,7 +782,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
782
782
|
campaignType: Campaign.EVENT_BASED,
|
783
783
|
contract: "0xbb6b01d94e3f6ebae8647cb56d544f57928ab758",
|
784
784
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
785
|
-
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n **
|
785
|
+
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 20n).toString() }],
|
786
786
|
computeScoreParameters: {
|
787
787
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
788
788
|
computeSettings: {
|
@@ -23,6 +23,7 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
|
|
23
23
|
items?: number | undefined;
|
24
24
|
tags?: string[] | undefined;
|
25
25
|
page?: number | undefined;
|
26
|
+
test?: boolean | undefined;
|
26
27
|
ids?: string[] | undefined;
|
27
28
|
opportunityTag?: string | undefined;
|
28
29
|
};
|
@@ -50,7 +51,16 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
|
|
50
51
|
get: {
|
51
52
|
body: unknown;
|
52
53
|
params: {};
|
53
|
-
query:
|
54
|
+
query: {
|
55
|
+
id?: string | undefined;
|
56
|
+
name?: string | undefined;
|
57
|
+
items?: number | undefined;
|
58
|
+
tags?: string[] | undefined;
|
59
|
+
page?: number | undefined;
|
60
|
+
test?: boolean | undefined;
|
61
|
+
ids?: string[] | undefined;
|
62
|
+
opportunityTag?: string | undefined;
|
63
|
+
};
|
54
64
|
headers: unknown;
|
55
65
|
response: {
|
56
66
|
200: number;
|
@@ -12,7 +12,8 @@ export const ProtocolController = new Elysia({ prefix: "/protocols", detail: { t
|
|
12
12
|
})
|
13
13
|
// ─── Count Protocols ─────────────────────────────────────────────────
|
14
14
|
.get("/count", async ({ query }) => await ProtocolService.countMany(query), {
|
15
|
-
|
15
|
+
query: GetProtocolsQueryDto,
|
16
|
+
detail: { description: "Get the number of protocols corresponding to the query." },
|
16
17
|
})
|
17
18
|
// ─── Get A Protocol By Its Id Or Name ────────────────────────────────
|
18
19
|
.get("/:id", async ({ params }) => {
|
@@ -21,6 +21,7 @@ export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
|
|
21
21
|
}>;
|
22
22
|
export declare const GetProtocolsQueryDto: import("@sinclair/typebox").TObject<{
|
23
23
|
id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
24
|
+
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
24
25
|
ids: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
25
26
|
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
26
27
|
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
@@ -128,6 +128,7 @@ export const ProtocolResourceDto = t.Object({
|
|
128
128
|
});
|
129
129
|
export const GetProtocolsQueryDto = t.Object({
|
130
130
|
id: t.Optional(t.String({ description: "Filter results by name. Useful for searching a protocol to verify its integration" })),
|
131
|
+
test: t.Optional(t.Boolean({ description: "Includes protocols that have only test opportunities", default: false })),
|
131
132
|
ids: t.Optional(t.Array(t.String())),
|
132
133
|
name: t.Optional(t.String({ description: "Search protocols by name" })),
|
133
134
|
tags: t.Optional(t.Array(t.String())),
|
@@ -2,6 +2,39 @@ import { log } from "@/utils/logger";
|
|
2
2
|
import { apiDbClient } from "@db";
|
3
3
|
// ─── Protocols Repository ────────────────────────────────────────────────────
|
4
4
|
export class ProtocolRepository {
|
5
|
+
static #transformQueryToPrismaFilters(query) {
|
6
|
+
return {
|
7
|
+
where: {
|
8
|
+
id: query.id
|
9
|
+
? { contains: query.id, mode: "insensitive" }
|
10
|
+
: query.ids
|
11
|
+
? { in: query.ids, mode: "insensitive" }
|
12
|
+
: undefined,
|
13
|
+
tags: query.tags ? { hasEvery: query.tags } : undefined,
|
14
|
+
name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
|
15
|
+
OR: query.opportunityTag // The opportunity tag specified can be either at the protocol level or the opportunity level
|
16
|
+
? [
|
17
|
+
{
|
18
|
+
MainOpportunities: {
|
19
|
+
some: {
|
20
|
+
tags: {
|
21
|
+
has: query.opportunityTag,
|
22
|
+
},
|
23
|
+
},
|
24
|
+
},
|
25
|
+
},
|
26
|
+
{ tags: { has: query.opportunityTag } },
|
27
|
+
]
|
28
|
+
: !query.test
|
29
|
+
? [
|
30
|
+
{ MainOpportunities: { some: { Campaigns: { some: { RewardToken: { isTest: false } } } } } },
|
31
|
+
{ Opportunities: { some: { Campaigns: { some: { RewardToken: { isTest: false } } } } } },
|
32
|
+
]
|
33
|
+
: undefined,
|
34
|
+
// id: typeof query.id === "string" ? query.id : !!query.id ? { in: query.id } : undefined,
|
35
|
+
},
|
36
|
+
};
|
37
|
+
}
|
5
38
|
static async create(data) {
|
6
39
|
return await apiDbClient.protocol.create({
|
7
40
|
data: {
|
@@ -91,34 +124,6 @@ export class ProtocolRepository {
|
|
91
124
|
static async findManyByName(name) {
|
92
125
|
return await apiDbClient.protocol.findMany({ where: { name: { equals: name } } });
|
93
126
|
}
|
94
|
-
static #transformQueryToPrismaFilters(query) {
|
95
|
-
return {
|
96
|
-
where: {
|
97
|
-
id: query.id
|
98
|
-
? { contains: query.id, mode: "insensitive" }
|
99
|
-
: query.ids
|
100
|
-
? { in: query.ids, mode: "insensitive" }
|
101
|
-
: undefined,
|
102
|
-
tags: query.tags ? { hasEvery: query.tags } : undefined,
|
103
|
-
name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
|
104
|
-
OR: query.opportunityTag // The opportunity tag specified can be either at the protocol level or the opportunity level
|
105
|
-
? [
|
106
|
-
{
|
107
|
-
MainOpportunities: {
|
108
|
-
some: {
|
109
|
-
tags: {
|
110
|
-
has: query.opportunityTag,
|
111
|
-
},
|
112
|
-
},
|
113
|
-
},
|
114
|
-
},
|
115
|
-
{ tags: { has: query.opportunityTag } },
|
116
|
-
]
|
117
|
-
: undefined,
|
118
|
-
// id: typeof query.id === "string" ? query.id : !!query.id ? { in: query.id } : undefined,
|
119
|
-
},
|
120
|
-
};
|
121
|
-
}
|
122
127
|
static async findMany(query) {
|
123
128
|
const { page: _page, items: _items } = query;
|
124
129
|
const page = _page ? _page : 0;
|
@@ -1,18 +1,22 @@
|
|
1
1
|
import { ChainService } from "@/modules/v4/chain/chain.service";
|
2
2
|
import { TokenService } from "@/modules/v4/token/token.service";
|
3
3
|
import { log } from "@/utils/logger";
|
4
|
+
import { CacheService } from "../cache";
|
5
|
+
import { TTLPresets } from "../cache/cache.model";
|
4
6
|
import { ProtocolRepository } from "./protocol.repository";
|
5
7
|
// ─── Protocols Services ──────────────────────────────────────────────────────
|
6
8
|
export class ProtocolService {
|
7
9
|
static async findMany(query) {
|
8
|
-
|
9
|
-
|
10
|
-
...protocol
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
return await CacheService.wrap(TTLPresets.MIN_10, async (query) => {
|
11
|
+
const protocols = await ProtocolRepository.findMany(query);
|
12
|
+
const enrichedProtocols = protocols.map(({ MainOpportunities, ...protocol }) => ({
|
13
|
+
...protocol,
|
14
|
+
dailyRewards: MainOpportunities.reduce((sum, opportunity) => sum + opportunity.dailyRewards, 0),
|
15
|
+
numberOfLiveCampaigns: MainOpportunities.reduce((sum, opportunity) => sum + opportunity.Campaigns.length, 0),
|
16
|
+
opportunityLiveTags: [...new Set(MainOpportunities.flatMap(opportunity => opportunity.action))], // ensure uniqness of tags
|
17
|
+
}));
|
18
|
+
return enrichedProtocols;
|
19
|
+
}, query);
|
16
20
|
}
|
17
21
|
static async countMany(query) {
|
18
22
|
return ProtocolRepository.countMany(query);
|
@@ -1762,6 +1762,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1762
1762
|
items?: number | undefined;
|
1763
1763
|
tags?: string[] | undefined;
|
1764
1764
|
page?: number | undefined;
|
1765
|
+
test?: boolean | undefined;
|
1765
1766
|
ids?: string[] | undefined;
|
1766
1767
|
opportunityTag?: string | undefined;
|
1767
1768
|
};
|
@@ -1789,7 +1790,16 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1789
1790
|
get: {
|
1790
1791
|
body: unknown;
|
1791
1792
|
params: {};
|
1792
|
-
query:
|
1793
|
+
query: {
|
1794
|
+
id?: string | undefined;
|
1795
|
+
name?: string | undefined;
|
1796
|
+
items?: number | undefined;
|
1797
|
+
tags?: string[] | undefined;
|
1798
|
+
page?: number | undefined;
|
1799
|
+
test?: boolean | undefined;
|
1800
|
+
ids?: string[] | undefined;
|
1801
|
+
opportunityTag?: string | undefined;
|
1802
|
+
};
|
1793
1803
|
headers: unknown;
|
1794
1804
|
response: {
|
1795
1805
|
200: number;
|
@@ -2717,6 +2727,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2717
2727
|
params: {};
|
2718
2728
|
query: {
|
2719
2729
|
name?: string | undefined;
|
2730
|
+
test?: boolean | undefined;
|
2720
2731
|
};
|
2721
2732
|
headers: unknown;
|
2722
2733
|
response: {
|
@@ -2743,6 +2754,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2743
2754
|
params: {};
|
2744
2755
|
query: {
|
2745
2756
|
name?: string | undefined;
|
2757
|
+
test?: boolean | undefined;
|
2746
2758
|
};
|
2747
2759
|
headers: unknown;
|
2748
2760
|
response: {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
|
-
import {
|
2
|
+
import type { Campaign, CampaignParameters } from "@sdk";
|
3
3
|
export declare const stakingContractToStakingSymbol: {
|
4
4
|
[key: string]: string;
|
5
5
|
};
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
|
-
import { ChainId } from "@sdk";
|
3
2
|
import { capitalize } from "lodash";
|
4
3
|
export const stakingContractToStakingSymbol = {
|
5
4
|
"0x18eeD20f71BEf84B605253C89A7576E3634134C0": "CyberStaking",
|
@@ -51,19 +50,9 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
51
50
|
case tokenType.beratrax_vault:
|
52
51
|
return `Deposit ${symbols.join("-")} on ${capitalize(typeInfo.protocol)}`;
|
53
52
|
case tokenType.balancerPool: {
|
54
|
-
|
55
|
-
typeInfo.protocol = "Beets";
|
56
|
-
}
|
57
|
-
let cardName = `Provide liquidity to ${capitalize(typeInfo.protocol)} ${symbols.join("-")}`;
|
58
|
-
if (typeInfo.vault === "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875") {
|
59
|
-
cardName = `Provide liquidity to Jellyverse Pool ${symbols.join("-")}`;
|
60
|
-
}
|
61
|
-
return cardName;
|
53
|
+
return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${symbols.join("-")}`;
|
62
54
|
}
|
63
55
|
case tokenType.balancerV3: {
|
64
|
-
if (campaign.computeChainId === ChainId.SONIC) {
|
65
|
-
typeInfo.protocol = "Beets";
|
66
|
-
}
|
67
56
|
return `Provide liquidity to ${capitalize(typeInfo.protocol)} Boosted ${symbols.join("-")}`;
|
68
57
|
}
|
69
58
|
case tokenType.aura:
|
@@ -110,7 +99,8 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
110
99
|
case tokenType.venus:
|
111
100
|
case tokenType.reactor_fusion:
|
112
101
|
case tokenType.euler_lend:
|
113
|
-
|
102
|
+
case tokenType.fluid:
|
103
|
+
return `Lend ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
114
104
|
case tokenType.metamorpho:
|
115
105
|
return `Supply to ${typeInfo.name} on ${capitalize(typeInfo.protocol)}`;
|
116
106
|
case tokenType.sturdy_aggregator:
|
@@ -120,8 +110,6 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
120
110
|
case tokenType.curve:
|
121
111
|
case tokenType.curve_2:
|
122
112
|
return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${Object.values(typeInfo.poolTokens).join("-")}`;
|
123
|
-
case tokenType.fluid:
|
124
|
-
return `Lend ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
125
113
|
case tokenType.enzyme:
|
126
114
|
return `Supply to the ${typeInfo.name} on ${capitalize(typeInfo.protocol)}`;
|
127
115
|
case tokenType.filament:
|