@merkl/api 0.10.255 → 0.10.257

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.
@@ -427,7 +427,21 @@ declare const eden: {
427
427
  query?: Record<string, unknown> | undefined;
428
428
  fetch?: RequestInit | undefined;
429
429
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
430
- 200: void;
430
+ 200: {
431
+ name: string;
432
+ type: import("../../database/api/.generated").$Enums.CampaignType;
433
+ id: string;
434
+ status: import("../../database/api/.generated").$Enums.Status;
435
+ tags: string[];
436
+ identifier: string;
437
+ chainId: number;
438
+ action: import("../../database/api/.generated").$Enums.OpportunityAction;
439
+ depositUrl: string | null;
440
+ mainProtocolId: string | null;
441
+ tvl: number;
442
+ apr: number;
443
+ dailyRewards: number;
444
+ } | null;
431
445
  }>>;
432
446
  get: (options: {
433
447
  headers?: Record<string, unknown> | undefined;
@@ -587,7 +601,7 @@ declare const eden: {
587
601
  fetch?: RequestInit | undefined;
588
602
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
589
603
  200: {
590
- sum: File;
604
+ sum: string;
591
605
  };
592
606
  }>>;
593
607
  }) & {};
@@ -812,6 +826,7 @@ declare const eden: {
812
826
  get: (options: {
813
827
  headers?: Record<string, unknown> | undefined;
814
828
  query: {
829
+ name?: string | undefined;
815
830
  id?: string | undefined;
816
831
  items?: number | undefined;
817
832
  tags?: string[] | undefined;
@@ -2951,7 +2966,21 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
2951
2966
  authorization: string;
2952
2967
  };
2953
2968
  response: {
2954
- 200: void;
2969
+ 200: {
2970
+ name: string;
2971
+ type: import("../../database/api/.generated").$Enums.CampaignType;
2972
+ id: string;
2973
+ status: import("../../database/api/.generated").$Enums.Status;
2974
+ tags: string[];
2975
+ identifier: string;
2976
+ chainId: number;
2977
+ action: import("../../database/api/.generated").$Enums.OpportunityAction;
2978
+ depositUrl: string | null;
2979
+ mainProtocolId: string | null;
2980
+ tvl: number;
2981
+ apr: number;
2982
+ dailyRewards: number;
2983
+ } | null;
2955
2984
  };
2956
2985
  };
2957
2986
  };
@@ -3436,7 +3465,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3436
3465
  headers: unknown;
3437
3466
  response: {
3438
3467
  200: {
3439
- sum: File;
3468
+ sum: string;
3440
3469
  };
3441
3470
  };
3442
3471
  };
@@ -3689,6 +3718,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3689
3718
  body: unknown;
3690
3719
  params: {};
3691
3720
  query: {
3721
+ name?: string | undefined;
3692
3722
  id?: string | undefined;
3693
3723
  items?: number | undefined;
3694
3724
  tags?: string[] | undefined;
@@ -6708,7 +6738,21 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
6708
6738
  query?: Record<string, unknown> | undefined;
6709
6739
  fetch?: RequestInit | undefined;
6710
6740
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
6711
- 200: void;
6741
+ 200: {
6742
+ name: string;
6743
+ type: import("../../database/api/.generated").$Enums.CampaignType;
6744
+ id: string;
6745
+ status: import("../../database/api/.generated").$Enums.Status;
6746
+ tags: string[];
6747
+ identifier: string;
6748
+ chainId: number;
6749
+ action: import("../../database/api/.generated").$Enums.OpportunityAction;
6750
+ depositUrl: string | null;
6751
+ mainProtocolId: string | null;
6752
+ tvl: number;
6753
+ apr: number;
6754
+ dailyRewards: number;
6755
+ } | null;
6712
6756
  }>>;
6713
6757
  get: (options: {
6714
6758
  headers?: Record<string, unknown> | undefined;
@@ -6868,7 +6912,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
6868
6912
  fetch?: RequestInit | undefined;
6869
6913
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
6870
6914
  200: {
6871
- sum: File;
6915
+ sum: string;
6872
6916
  };
6873
6917
  }>>;
6874
6918
  }) & {};
@@ -7093,6 +7137,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
7093
7137
  get: (options: {
7094
7138
  headers?: Record<string, unknown> | undefined;
7095
7139
  query: {
7140
+ name?: string | undefined;
7096
7141
  id?: string | undefined;
7097
7142
  items?: number | undefined;
7098
7143
  tags?: string[] | undefined;
@@ -168,7 +168,21 @@ declare const app: Elysia<"", false, {
168
168
  authorization: string;
169
169
  };
170
170
  response: {
171
- 200: void;
171
+ 200: {
172
+ name: string;
173
+ type: import("../database/api/.generated").$Enums.CampaignType;
174
+ id: string;
175
+ status: import("../database/api/.generated").$Enums.Status;
176
+ tags: string[];
177
+ identifier: string;
178
+ chainId: number;
179
+ action: import("../database/api/.generated").$Enums.OpportunityAction;
180
+ depositUrl: string | null;
181
+ mainProtocolId: string | null;
182
+ tvl: number;
183
+ apr: number;
184
+ dailyRewards: number;
185
+ } | null;
172
186
  };
173
187
  };
174
188
  };
@@ -653,7 +667,7 @@ declare const app: Elysia<"", false, {
653
667
  headers: unknown;
654
668
  response: {
655
669
  200: {
656
- sum: File;
670
+ sum: string;
657
671
  };
658
672
  };
659
673
  };
@@ -906,6 +920,7 @@ declare const app: Elysia<"", false, {
906
920
  body: unknown;
907
921
  params: {};
908
922
  query: {
923
+ name?: string | undefined;
909
924
  id?: string | undefined;
910
925
  items?: number | undefined;
911
926
  tags?: string[] | undefined;
@@ -1,6 +1,10 @@
1
1
  import { generateCardName } from "../../../../../utils/generateCardName";
2
2
  import { BN2Number } from "@sdk";
3
3
  import { GenericProcessor } from "./GenericProcessor";
4
+ const matchSingleNumber = (input) => {
5
+ const regex = /^\d+$/;
6
+ return regex.test(input);
7
+ };
4
8
  export class CurveNPoolProcessor extends GenericProcessor {
5
9
  rounds = {
6
10
  round1: [{ key: "numberTokens", call: "N_COINS", target: "tokenAddress" }],
@@ -73,6 +77,12 @@ export class CurveNPoolProcessor extends GenericProcessor {
73
77
  tvl += amount * price;
74
78
  }
75
79
  const priceTargetToken = tvl / totalSupply;
80
+ // Remove all keys that start with a number or balanceToken
81
+ for (const key in typeInfo) {
82
+ if (key.startsWith("balanceToken") || key.startsWith("decimalsToken") || matchSingleNumber(key)) {
83
+ delete typeInfo[key];
84
+ }
85
+ }
76
86
  return {
77
87
  ...typeInfo,
78
88
  totalSupply,
@@ -1,4 +1,4 @@
1
- import type { Campaign, CampaignParameters } from "@sdk";
1
+ import { type Campaign, type CampaignParameters } from "@sdk";
2
2
  import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
3
3
  import { type tokenTypeStruct } from "./helpers/tokenType";
4
4
  export declare function getTokenTypeRound1(calls: Multicall3.ResultStructOutput[], targetToken: string, index: number, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
@@ -1,4 +1,5 @@
1
1
  import { decodeCall } from "../../../../utils/decodeCalls";
2
+ import { ChainId } from "@sdk";
2
3
  import { enzymeFundValueCalculatorRouterMapping, getTypeFromFactoryAddress } from "./helpers/factoryFinder";
3
4
  import { tokenType } from "./helpers/tokenType";
4
5
  import { processorMapping } from "./processor/processorMapping";
@@ -190,7 +191,7 @@ function parseForBalancer(calls, index, targetToken, name) {
190
191
  function parseForStaking(campaign, calls, index, targetToken) {
191
192
  try {
192
193
  const whitelist = campaign.campaignParameters.whitelist;
193
- if (whitelist.length === 1 && campaign.chainId !== 42161) {
194
+ if (whitelist.length === 1 && campaign.chainId !== ChainId.ARBITRUM) {
194
195
  const forwarders = campaign.campaignParameters.forwarders;
195
196
  if (forwarders.length === 1) {
196
197
  if (forwarders[0].sender === whitelist[0]) {
@@ -101,6 +101,8 @@ export class CampaignRepository {
101
101
  }
102
102
  }
103
103
  static async upsertMany(campaigns) {
104
+ if (!campaigns.length)
105
+ return { success: 0, fail: 0 };
104
106
  const campaignType = CampaignService.getTypeFromV3(campaigns[0].type);
105
107
  const data = [];
106
108
  for (const campaign of campaigns) {
@@ -37,7 +37,21 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
37
37
  authorization: string;
38
38
  };
39
39
  response: {
40
- 200: void;
40
+ 200: {
41
+ name: string;
42
+ type: import("../../../../database/api/.generated").$Enums.CampaignType;
43
+ id: string;
44
+ status: import("../../../../database/api/.generated").$Enums.Status;
45
+ tags: string[];
46
+ identifier: string;
47
+ chainId: number;
48
+ action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
49
+ depositUrl: string | null;
50
+ mainProtocolId: string | null;
51
+ tvl: number;
52
+ apr: number;
53
+ dailyRewards: number;
54
+ } | null;
41
55
  };
42
56
  };
43
57
  };
@@ -522,7 +536,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
522
536
  headers: unknown;
523
537
  response: {
524
538
  200: {
525
- sum: File;
539
+ sum: string;
526
540
  };
527
541
  };
528
542
  };
@@ -6,7 +6,21 @@ import { type TvlRecord } from "../tvl";
6
6
  import type { CreateOpportunityModel, GetOpportunitiesQueryModel, UpdateOpportunityModel } from "./opportunity.model";
7
7
  export declare abstract class OpportunityRepository {
8
8
  #private;
9
- static upsert(newOpp: CreateOpportunityModel): Promise<void>;
9
+ static create(newOpp: CreateOpportunityModel, upsert?: boolean): Promise<{
10
+ name: string;
11
+ type: import("../../../../database/api/.generated").$Enums.CampaignType;
12
+ id: string;
13
+ status: import("../../../../database/api/.generated").$Enums.Status;
14
+ tags: string[];
15
+ identifier: string;
16
+ chainId: number;
17
+ action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
18
+ depositUrl: string | null;
19
+ mainProtocolId: string | null;
20
+ tvl: number;
21
+ apr: number;
22
+ dailyRewards: number;
23
+ } | null>;
10
24
  static findUnique(id: string): Promise<({
11
25
  Chain: {
12
26
  name: string;
@@ -886,7 +900,7 @@ export declare abstract class OpportunityRepository {
886
900
  dailyRewards: number;
887
901
  }>;
888
902
  static aggregateSum(field: keyof Prisma.OpportunitySumAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
889
- sum: never;
903
+ sum: string;
890
904
  }>;
891
905
  static update(id: string, data: UpdateOpportunityModel): Promise<{
892
906
  name: string;
@@ -2,6 +2,7 @@ import { apiDbClient } from "../../../utils/prisma";
2
2
  import { Status } from "../../../../database/api/.generated";
3
3
  import moment from "moment";
4
4
  import { AprService } from "../apr";
5
+ import { ProtocolService } from "../protocol";
5
6
  import { RewardService } from "../reward";
6
7
  import { TvlService } from "../tvl";
7
8
  export class OpportunityRepository {
@@ -38,7 +39,29 @@ export class OpportunityRepository {
38
39
  },
39
40
  };
40
41
  }
41
- static async upsert(newOpp) {
42
+ static async create(newOpp, upsert = false) {
43
+ if (!!newOpp.mainProtocol) {
44
+ let mainProtocol = await apiDbClient.protocol.findUnique({ where: { id: newOpp.mainProtocol } });
45
+ if (!mainProtocol) {
46
+ mainProtocol = await ProtocolService.create({
47
+ id: newOpp.mainProtocol,
48
+ name: newOpp.mainProtocol,
49
+ tags: [newOpp.action],
50
+ url: "",
51
+ icon: "",
52
+ description: "",
53
+ });
54
+ }
55
+ // Override action with the protocol's action if it differs
56
+ if (mainProtocol.tags.includes("AMM"))
57
+ newOpp.action = "POOL";
58
+ if (mainProtocol.tags.includes("DEX"))
59
+ newOpp.action = "POOL";
60
+ if (mainProtocol.tags.includes("LENDING"))
61
+ newOpp.action = "BORROW";
62
+ if (mainProtocol.tags.includes("LENDING") && !!newOpp.name && newOpp.name.includes("Supply"))
63
+ newOpp.action = "LEND";
64
+ }
42
65
  const data = {
43
66
  id: newOpp.id,
44
67
  action: newOpp.action,
@@ -47,7 +70,7 @@ export class OpportunityRepository {
47
70
  status: newOpp.status,
48
71
  type: newOpp.type,
49
72
  Chain: { connect: { id: newOpp.chainId } },
50
- MainProtocol: { connect: { id: newOpp.mainProtocol } },
73
+ MainProtocol: !!newOpp.mainProtocol ? { connect: { id: newOpp.mainProtocol } } : undefined,
51
74
  Protocols: {
52
75
  connect: (newOpp.protocols ?? []).map((protocol) => {
53
76
  return { id: protocol };
@@ -64,11 +87,21 @@ export class OpportunityRepository {
64
87
  }),
65
88
  },
66
89
  };
67
- await apiDbClient.opportunity.upsert({
68
- where: { id: newOpp.id },
69
- create: data,
70
- update: data,
71
- });
90
+ if (upsert) {
91
+ await apiDbClient.opportunity.upsert({
92
+ where: { id: newOpp.id },
93
+ create: data,
94
+ update: data,
95
+ });
96
+ }
97
+ else {
98
+ const opportunity = await apiDbClient.opportunity.findUnique({ where: { id: newOpp.id } });
99
+ if (!!opportunity) {
100
+ return opportunity;
101
+ }
102
+ await apiDbClient.opportunity.create({ data });
103
+ }
104
+ return await apiDbClient.opportunity.findUnique({ where: { id: newOpp.id } });
72
105
  }
73
106
  static async findUnique(id) {
74
107
  return await apiDbClient.opportunity.findUnique({
@@ -10,8 +10,22 @@ export declare abstract class OpportunityService {
10
10
  * @param newOpp the new opportunity to create
11
11
  * @returns {Promise<Opportunity|undefined>}
12
12
  */
13
- static create(newOpp: Omit<CreateOpportunityModel, "id">): Promise<void>;
14
- static createFromCampaign(campaign: Omit<CreateCampaignModel, "id">): Promise<{
13
+ static create(newOpp: Omit<CreateOpportunityModel, "id">): Promise<{
14
+ name: string;
15
+ type: import("../../../../database/api/.generated").$Enums.CampaignType;
16
+ id: string;
17
+ status: import("../../../../database/api/.generated").$Enums.Status;
18
+ tags: string[];
19
+ identifier: string;
20
+ chainId: number;
21
+ action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
22
+ depositUrl: string | null;
23
+ mainProtocolId: string | null;
24
+ tvl: number;
25
+ apr: number;
26
+ dailyRewards: number;
27
+ } | null>;
28
+ static createFromCampaign(campaign: Omit<CreateCampaignModel, "id">, upsert?: boolean): Promise<{
15
29
  id: string;
16
30
  chainId: number;
17
31
  type: import("../../../../database/api/.generated").$Enums.CampaignType;
@@ -440,7 +454,7 @@ export declare abstract class OpportunityService {
440
454
  dailyRewards: number;
441
455
  };
442
456
  static aggregate(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunitySumAggregateInputType): Promise<{
443
- sum: never;
457
+ sum: string;
444
458
  }>;
445
459
  static update(id: string, data: UpdateOpportunityModel): Promise<{
446
460
  name: string;
@@ -32,9 +32,9 @@ export class OpportunityService {
32
32
  */
33
33
  static async create(newOpp) {
34
34
  const id = OpportunityService.hashId(newOpp);
35
- return await OpportunityRepository.upsert({ ...newOpp, id });
35
+ return await OpportunityRepository.create({ ...newOpp, id });
36
36
  }
37
- static async createFromCampaign(campaign) {
37
+ static async createFromCampaign(campaign, upsert = false) {
38
38
  const campaignType = CampaignService.getTypeFromV3(campaign.type);
39
39
  const metadata = await OpportunityService.getMetadata(campaign);
40
40
  metadata.tags = [...((await UserService.findUnique(campaign.creator))?.tags ?? []), ...(campaign?.tags ?? [])];
@@ -62,7 +62,7 @@ export class OpportunityService {
62
62
  depositUrl: !!params.url ? params.url : undefined,
63
63
  tags: metadata.tags,
64
64
  };
65
- await OpportunityRepository.upsert(opportunity);
65
+ await OpportunityRepository.create(opportunity, upsert);
66
66
  return opportunity;
67
67
  }
68
68
  /**
@@ -78,6 +78,7 @@ export class OpportunityService {
78
78
  ...firstCampaign,
79
79
  type: campaignTypeToEnumMap[firstCampaign.type],
80
80
  chainId: firstCampaign.distributionChainId,
81
+ computeChainId: firstCampaign.computeChainId,
81
82
  creator: firstCampaign.creatorAddress,
82
83
  rewardTokenAddress: firstCampaign.RewardToken.address,
83
84
  opportunityIdentifier: opportunity.identifier,
@@ -85,7 +86,8 @@ export class OpportunityService {
85
86
  params: JSON.stringify(firstCampaign.params),
86
87
  startTimestamp: firstCampaign.startTimestamp.toString(),
87
88
  endTimestamp: firstCampaign.endTimestamp.toString(),
88
- });
89
+ }, true // Upserting
90
+ );
89
91
  }
90
92
  /**
91
93
  * build/fetch metadata of a campaign's opportunity
@@ -100,7 +102,8 @@ export class OpportunityService {
100
102
  case "CLAMM":
101
103
  return getClammMetadata(chainId, campaignParams);
102
104
  case "ERC20":
103
- return getErc20Metadata(chainId, campaign.campaignId, campaign.rewardTokenAddress, campaign.amount, campaignParams);
105
+ return getErc20Metadata(chainId, campaign.chainId, // distributionChainId
106
+ campaign.campaignId, campaign.rewardTokenAddress, campaign.amount, campaignParams);
104
107
  case "ERC20_SNAPSHOT":
105
108
  return getErc20SnapshotMetadata(chainId, campaignParams);
106
109
  case "JSON_AIRDROP":
@@ -1,3 +1,3 @@
1
1
  import type { OpportunityMetadata } from "..";
2
2
  import type { ChainId, ERC20Campaign } from "@sdk";
3
- export declare const getErc20Metadata: (chainId: ChainId, campaignId: string, rewardToken: string, amount: string, params: ERC20Campaign["campaignParameters"]) => Promise<OpportunityMetadata>;
3
+ export declare const getErc20Metadata: (computeChainId: ChainId, distributionChainId: ChainId, campaignId: string, rewardToken: string, amount: string, params: ERC20Campaign["campaignParameters"]) => Promise<OpportunityMetadata>;
@@ -2,17 +2,19 @@ import { log } from "../../../../utils/logger";
2
2
  import { CampaignType } from "../../../../../database/api/.generated";
3
3
  import { CampaignService } from "../../campaign";
4
4
  import { ProtocolService } from "../../protocol";
5
- export const getErc20Metadata = async (chainId, campaignId, rewardToken, amount, params) => {
5
+ export const getErc20Metadata = async (computeChainId, distributionChainId, campaignId, rewardToken, amount, params) => {
6
6
  let action = "HOLD";
7
7
  let name = `Hold ${params.symbolTargetToken}`;
8
8
  let mainProtocolId = undefined;
9
- const tokens = [{ chainId, address: params.targetToken }];
9
+ const tokens = [{ chainId: computeChainId, address: params.targetToken }];
10
10
  try {
11
- const [dynamicData] = await CampaignService.fetchDynamicData(chainId, CampaignType.ERC20, [
11
+ const [dynamicData] = await CampaignService.fetchDynamicData(computeChainId, CampaignType.ERC20, [
12
12
  {
13
13
  campaignId,
14
14
  rewardToken,
15
15
  amount,
16
+ chainId: distributionChainId,
17
+ computeChainId,
16
18
  campaignParameters: params,
17
19
  },
18
20
  ]);
@@ -20,37 +22,36 @@ export const getErc20Metadata = async (chainId, campaignId, rewardToken, amount,
20
22
  name = dynamicData?.typeInfo?.cardName;
21
23
  mainProtocolId = dynamicData?.typeInfo?.protocol?.toLowerCase().replace(" ", "");
22
24
  const protocol = (await ProtocolService.findMany({ id: mainProtocolId }))?.[0];
23
- if (!protocol) {
24
- mainProtocolId = undefined;
25
+ if (!!protocol) {
26
+ mainProtocolId = protocol?.id;
25
27
  }
26
- mainProtocolId = protocol?.id;
27
28
  // Case of lending protocols and receipt tokens
28
29
  if (!!dynamicData && !!dynamicData.typeInfo?.underlying) {
29
- tokens.push({ chainId, address: dynamicData.typeInfo.underlying });
30
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.underlying });
30
31
  }
31
32
  // Case of perps protocols
32
33
  if (!!dynamicData && !!dynamicData.typeInfo?.shortToken && !!dynamicData.typeInfo?.longToken) {
33
- tokens.push({ chainId, address: dynamicData.typeInfo.shortToken });
34
- tokens.push({ chainId, address: dynamicData.typeInfo.longToken });
34
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.shortToken });
35
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.longToken });
35
36
  }
36
37
  // Case of weird AMMs
37
38
  if (!!dynamicData && !!dynamicData.typeInfo?.tokenA && !!dynamicData.typeInfo?.tokenB) {
38
- tokens.push({ chainId, address: dynamicData.typeInfo.tokenA });
39
- tokens.push({ chainId, address: dynamicData.typeInfo.tokenB });
39
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.tokenA });
40
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.tokenB });
40
41
  }
41
42
  // Case of AMMs
42
43
  if (!!dynamicData && !!dynamicData.typeInfo?.token0 && !!dynamicData.typeInfo?.token1) {
43
- tokens.push({ chainId, address: dynamicData.typeInfo.token0 });
44
- tokens.push({ chainId, address: dynamicData.typeInfo.token1 });
44
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token0 });
45
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token1 });
45
46
  }
46
47
  // Case of tripools
47
48
  if (!!dynamicData &&
48
49
  !!dynamicData.typeInfo?.token0Address &&
49
50
  !!dynamicData.typeInfo?.token1Address &&
50
51
  !!dynamicData.typeInfo?.token2Address) {
51
- tokens.push({ chainId, address: dynamicData.typeInfo.token0Address });
52
- tokens.push({ chainId, address: dynamicData.typeInfo.token1Address });
53
- tokens.push({ chainId, address: dynamicData.typeInfo.token2Address });
52
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token0Address });
53
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token1Address });
54
+ tokens.push({ chainId: computeChainId, address: dynamicData.typeInfo.token2Address });
54
55
  }
55
56
  }
56
57
  catch {
@@ -18,6 +18,7 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
18
18
  body: unknown;
19
19
  params: {};
20
20
  query: {
21
+ name?: string | undefined;
21
22
  id?: string | undefined;
22
23
  items?: number | undefined;
23
24
  tags?: string[] | undefined;
@@ -17,6 +17,7 @@ export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
17
17
  }>;
18
18
  export declare const GetProtocolsQueryDto: import("@sinclair/typebox").TObject<{
19
19
  id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
+ name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
21
  tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
21
22
  opportunityTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
22
23
  page: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
@@ -79,6 +79,7 @@ export const ProtocolResourceDto = t.Object({
79
79
  });
80
80
  export const GetProtocolsQueryDto = t.Object({
81
81
  id: t.Optional(t.String({ description: "Filter results by name. Useful for searching a protocol to verify its integration" })),
82
+ name: t.Optional(t.String({ description: "Search protocols by name" })),
82
83
  tags: t.Optional(t.Array(t.String())),
83
84
  opportunityTag: t.Optional(t.String({ description: "Filter by underlying opportunities' tag" })),
84
85
  page: t.Optional(t.Numeric({ description: "0-indexed page number", default: 0 })),
@@ -24,6 +24,7 @@ export class ProtocolRepository {
24
24
  where: {
25
25
  id: query.id ? { contains: query.id, mode: "insensitive" } : undefined,
26
26
  tags: query.tags ? { hasEvery: query.tags } : undefined,
27
+ name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
27
28
  OR: query.opportunityTag // The opportunity tag specified can be either at the protocol level or the opportunity level
28
29
  ? [
29
30
  {
@@ -46,7 +46,21 @@ export declare const v4: Elysia<"/v4", false, {
46
46
  authorization: string;
47
47
  };
48
48
  response: {
49
- 200: void;
49
+ 200: {
50
+ name: string;
51
+ type: import("../../../database/api/.generated").$Enums.CampaignType;
52
+ id: string;
53
+ status: import("../../../database/api/.generated").$Enums.Status;
54
+ tags: string[];
55
+ identifier: string;
56
+ chainId: number;
57
+ action: import("../../../database/api/.generated").$Enums.OpportunityAction;
58
+ depositUrl: string | null;
59
+ mainProtocolId: string | null;
60
+ tvl: number;
61
+ apr: number;
62
+ dailyRewards: number;
63
+ } | null;
50
64
  };
51
65
  };
52
66
  };
@@ -531,7 +545,7 @@ export declare const v4: Elysia<"/v4", false, {
531
545
  headers: unknown;
532
546
  response: {
533
547
  200: {
534
- sum: File;
548
+ sum: string;
535
549
  };
536
550
  };
537
551
  };
@@ -784,6 +798,7 @@ export declare const v4: Elysia<"/v4", false, {
784
798
  body: unknown;
785
799
  params: {};
786
800
  query: {
801
+ name?: string | undefined;
787
802
  id?: string | undefined;
788
803
  items?: number | undefined;
789
804
  tags?: string[] | undefined;
@@ -14,7 +14,7 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
14
14
  case tokenType.ra:
15
15
  case tokenType.syncswap:
16
16
  case tokenType.pancakeswap:
17
- return `${typeInfo.protocol} ${typeInfo.symbolToken0}/${typeInfo.symbolToken1}`;
17
+ return `Provide liquidity to ${typeInfo.protocol} ${typeInfo.symbolToken0}/${typeInfo.symbolToken1}`;
18
18
  case tokenType.pendleYT:
19
19
  return `Hold ${typeInfo.protocol} ${typeInfo.name}`;
20
20
  case tokenType.pendle:
@@ -22,14 +22,14 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
22
22
  case tokenType.balancerGauge:
23
23
  return `${typeInfo.protocol} ${symbols.join("/")}`;
24
24
  case tokenType.balancerPool: {
25
- let cardName = `${typeInfo.protocol} ${symbols.join("/")}`;
25
+ let cardName = `Provide liquidity to ${typeInfo.protocol} ${symbols.join("/")}`;
26
26
  if (typeInfo.vault === "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875") {
27
- cardName = `Jellyverse Pool ${symbols.join("/")}`;
27
+ cardName = `Provide liquidity to Jellyverse Pool ${symbols.join("/")}`;
28
28
  }
29
29
  return cardName;
30
30
  }
31
31
  case tokenType.aura:
32
- return `${typeInfo.protocol} ${symbols.join("/")}`;
32
+ return `Provide liquidity to ${typeInfo.protocol} ${symbols.join("/")}`;
33
33
  case tokenType.gearbox:
34
34
  return `${typeInfo.protocol} ${typeInfo.symbolUnderlyingToken} Deposit`;
35
35
  case tokenType.compound:
@@ -71,7 +71,7 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
71
71
  return `Supply ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol} ${typeInfo.symbolCollateral} Silo`;
72
72
  case tokenType.curve:
73
73
  case tokenType.curve_2:
74
- return `${typeInfo.protocol} ${Object.values(typeInfo.poolTokens).join("/")}`;
74
+ return `Provide liquidity to ${typeInfo.protocol} ${Object.values(typeInfo.poolTokens).join("/")}`;
75
75
  case tokenType.fluid:
76
76
  return `Lend ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
77
77
  case tokenType.enzyme:
@@ -81,7 +81,7 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
81
81
  case tokenType.silostaking:
82
82
  return `Stake ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
83
83
  case tokenType.beefy:
84
- return `${typeInfo.protocol} ${typeInfo.symbolToken0}/${typeInfo.symbolToken1}`;
84
+ return `Provide liquidity to ${typeInfo.protocol} ${typeInfo.symbolToken0}/${typeInfo.symbolToken1}`;
85
85
  case tokenType.toros:
86
86
  return `${typeInfo.name} (${campaign.campaignParameters.symbolTargetToken}) on ${typeInfo.protocol}`;
87
87
  case tokenType.ironcladStaking:
@@ -91,7 +91,7 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
91
91
  case tokenType.maverickBoostedPosition:
92
92
  return `Maverick Boosted Position ${campaign.campaignParameters.symbolTargetToken}`;
93
93
  case tokenType.zkSwapThreePool:
94
- return `${typeInfo.protocol} ${typeInfo.symbolToken0}/${typeInfo.symbolToken1}/${typeInfo.symbolToken2}`;
94
+ return `Provide liquidity to ${typeInfo.protocol} ${typeInfo.symbolToken0}/${typeInfo.symbolToken1}/${typeInfo.symbolToken2}`;
95
95
  case tokenType.maha:
96
96
  return `Stake ${typeInfo.symbolToken0}/${typeInfo.symbolToken1} LP on ${typeInfo.protocol}`;
97
97
  case tokenType.tempest: