@merkl/api 0.10.256 → 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.
- package/dist/src/eden/index.d.ts +48 -6
- package/dist/src/index.d.ts +16 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveNPoolProcessor.js +10 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +2 -1
- package/dist/src/modules/v4/campaign/campaign.repository.js +2 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +16 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +16 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +40 -7
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +17 -3
- package/dist/src/modules/v4/opportunity/opportunity.service.js +8 -5
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +17 -16
- package/dist/src/modules/v4/router.d.ts +16 -2
- package/dist/src/utils/generateCardName.js +7 -7
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -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:
|
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:
|
604
|
+
sum: string;
|
591
605
|
};
|
592
606
|
}>>;
|
593
607
|
}) & {};
|
@@ -2952,7 +2966,21 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2952
2966
|
authorization: string;
|
2953
2967
|
};
|
2954
2968
|
response: {
|
2955
|
-
200:
|
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;
|
2956
2984
|
};
|
2957
2985
|
};
|
2958
2986
|
};
|
@@ -3437,7 +3465,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
3437
3465
|
headers: unknown;
|
3438
3466
|
response: {
|
3439
3467
|
200: {
|
3440
|
-
sum:
|
3468
|
+
sum: string;
|
3441
3469
|
};
|
3442
3470
|
};
|
3443
3471
|
};
|
@@ -6710,7 +6738,21 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6710
6738
|
query?: Record<string, unknown> | undefined;
|
6711
6739
|
fetch?: RequestInit | undefined;
|
6712
6740
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6713
|
-
200:
|
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;
|
6714
6756
|
}>>;
|
6715
6757
|
get: (options: {
|
6716
6758
|
headers?: Record<string, unknown> | undefined;
|
@@ -6870,7 +6912,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6870
6912
|
fetch?: RequestInit | undefined;
|
6871
6913
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6872
6914
|
200: {
|
6873
|
-
sum:
|
6915
|
+
sum: string;
|
6874
6916
|
};
|
6875
6917
|
}>>;
|
6876
6918
|
}) & {};
|
package/dist/src/index.d.ts
CHANGED
@@ -168,7 +168,21 @@ declare const app: Elysia<"", false, {
|
|
168
168
|
authorization: string;
|
169
169
|
};
|
170
170
|
response: {
|
171
|
-
200:
|
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:
|
670
|
+
sum: string;
|
657
671
|
};
|
658
672
|
};
|
659
673
|
};
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveNPoolProcessor.js
CHANGED
@@ -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
|
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 !==
|
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:
|
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:
|
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
|
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:
|
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
|
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
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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<
|
14
|
-
|
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:
|
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.
|
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.
|
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.
|
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: (
|
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 (
|
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(
|
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 (
|
24
|
-
mainProtocolId =
|
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 {
|
@@ -46,7 +46,21 @@ export declare const v4: Elysia<"/v4", false, {
|
|
46
46
|
authorization: string;
|
47
47
|
};
|
48
48
|
response: {
|
49
|
-
200:
|
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:
|
548
|
+
sum: string;
|
535
549
|
};
|
536
550
|
};
|
537
551
|
};
|
@@ -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
|
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 =
|
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
|
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
|
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
|
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
|
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:
|