@merkl/api 0.20.5 → 0.20.7
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/backgroundJobs/jobs/campaignsCacheUpdater.d.ts +3 -0
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.d.ts +3 -0
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.js +3 -0
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +8 -4
- package/dist/src/jobs/update-dynamic-data.js +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +2 -5
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -1
- package/dist/src/utils/generateCardName.js +33 -32
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1,5 +1,8 @@
|
|
1
1
|
import { Campaign, type CampaignDynamicData, ChainId } from "@sdk";
|
2
2
|
import { Elysia } from "elysia";
|
3
|
+
/**
|
4
|
+
* @deprecated Used only for the v3/campaigns route
|
5
|
+
*/
|
3
6
|
export type CampaignsCacheUpdaterReturnType = {
|
4
7
|
[type_mainParameter: string]: {
|
5
8
|
[campaignId: string]: CampaignDynamicData<Campaign>;
|
@@ -1,6 +1,9 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
import { OpportunityConvertorService } from "@/modules/v4/opportunity/opportunity.converter";
|
3
3
|
import { log } from "../../utils/logger";
|
4
|
+
/**
|
5
|
+
* @deprecated Used only for the v3/opportunity route
|
6
|
+
*/
|
4
7
|
export const opportunityUpdater = (app) => {
|
5
8
|
return app.get("/v3/updateOpportunities", async () => {
|
6
9
|
log.info("✅ opportunity cache updated successfully");
|
@@ -75,7 +75,11 @@ export class ClammMetadata {
|
|
75
75
|
if (mainProtocolId?.includes("stryke"))
|
76
76
|
mainProtocolId = "stryke";
|
77
77
|
else if (mainProtocolId?.includes("quickswap"))
|
78
|
-
mainProtocolId = "
|
78
|
+
mainProtocolId = "quick-swap";
|
79
|
+
else if (mainProtocolId?.includes("quick-swap"))
|
80
|
+
mainProtocolId = "quick-swap";
|
81
|
+
else if (mainProtocolId?.includes("sushi-swap"))
|
82
|
+
mainProtocolId = "sushiswap";
|
79
83
|
if (!!mainProtocolId) {
|
80
84
|
// Make sure the protocol exist in the correct type
|
81
85
|
const protocol = (await ProtocolService.findMany({ id: mainProtocolId }))?.[0];
|
@@ -136,13 +140,13 @@ export class ClammMetadata {
|
|
136
140
|
return "https:/app.horiza.io/liquidity";
|
137
141
|
}
|
138
142
|
case AMM.QuickswapAlgebra: {
|
139
|
-
return `https://quickswap.exchange
|
143
|
+
return `https://quickswap.exchange/#/pools?currency0=${params.token0}¤cy1=${params.token1}`;
|
140
144
|
}
|
141
145
|
case AMM.QuickswapUni: {
|
142
|
-
return `https://quickswap.exchange
|
146
|
+
return `https://quickswap.exchange/#/pools?currency0=${params.token0}¤cy1=${params.token1}`;
|
143
147
|
}
|
144
148
|
case AMM.QuickswapAlgebraV1_2: {
|
145
|
-
return `https://quickswap.exchange
|
149
|
+
return `https://quickswap.exchange/#/pools?currency0=${params.token0}¤cy1=${params.token1}`;
|
146
150
|
}
|
147
151
|
case AMM.Swapr: {
|
148
152
|
return "https://v3.swapr.eth.limo/#/swap";
|
@@ -46,6 +46,8 @@ const main = async () => {
|
|
46
46
|
else if (status !== "LIVE" && campaign.startTimestamp > now)
|
47
47
|
status = "SOON";
|
48
48
|
}
|
49
|
+
if (status === "PAST" && opportunity.apr !== 0)
|
50
|
+
await OpportunityService.update(opportunity.id, { status, apr: 0 });
|
49
51
|
if (opportunity.status !== status)
|
50
52
|
await OpportunityService.updateStatus(opportunity.id, status);
|
51
53
|
}
|
@@ -102,11 +102,8 @@ export class DynamicDataService {
|
|
102
102
|
const campaignTypeToCampaigns = new Map();
|
103
103
|
for (const campaign of campaigns) {
|
104
104
|
const type = campaign.campaignType;
|
105
|
-
|
106
|
-
|
107
|
-
campaigns = [campaign];
|
108
|
-
else
|
109
|
-
campaigns.push(campaign);
|
105
|
+
const campaigns = campaignTypeToCampaigns.get(campaign.campaignType) ?? [];
|
106
|
+
campaigns.push(campaign);
|
110
107
|
campaignTypeToCampaigns.set(type, campaigns);
|
111
108
|
}
|
112
109
|
const dynamicDataArray = [];
|
@@ -4,7 +4,7 @@ import { type AprRecord } from "../apr";
|
|
4
4
|
import type { Campaign } from "../campaign";
|
5
5
|
import { type DailyRewardsRecord } from "../reward";
|
6
6
|
import { type TvlRecord } from "../tvl";
|
7
|
-
import type { CreateOpportunityModel, GetOpportunitiesQueryModel, UpdateOpportunityModel } from "./opportunity.model";
|
7
|
+
import type { CreateOpportunityModel, GetOpportunitiesQueryModel, Opportunity, UpdateOpportunityModel } from "./opportunity.model";
|
8
8
|
export declare abstract class OpportunityRepository {
|
9
9
|
#private;
|
10
10
|
static create(newOpp: CreateOpportunityModel, upsert?: boolean): Promise<{
|
@@ -981,7 +981,7 @@ export declare abstract class OpportunityRepository {
|
|
981
981
|
static aggregateMax(field: keyof Prisma.OpportunityMaxAggregateInputType, query: GetOpportunitiesQueryModel): Promise<{
|
982
982
|
max: string;
|
983
983
|
}>;
|
984
|
-
static update(id: string, data:
|
984
|
+
static update(id: string, data: Partial<Opportunity["raw"]>): Promise<{
|
985
985
|
id: string;
|
986
986
|
name: string;
|
987
987
|
type: string;
|
@@ -287,7 +287,7 @@ export class OpportunityRepository {
|
|
287
287
|
MainProtocol: true,
|
288
288
|
Protocols: true,
|
289
289
|
Tokens: {
|
290
|
-
where: !withTest ? { isTest: false
|
290
|
+
where: !withTest ? { isTest: false } : undefined,
|
291
291
|
},
|
292
292
|
},
|
293
293
|
where: { id },
|
@@ -342,7 +342,7 @@ export class OpportunityRepository {
|
|
342
342
|
},
|
343
343
|
Protocols: true,
|
344
344
|
Tokens: {
|
345
|
-
where: !withTest ? { isTest: false
|
345
|
+
where: !withTest ? { isTest: false } : undefined,
|
346
346
|
},
|
347
347
|
},
|
348
348
|
...args,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type CreateCampaignModel, type GetCampaignQueryModel } from "@/modules/v4/campaign";
|
2
2
|
import { Prisma, Status } from "@db/api";
|
3
3
|
import { type ChainId, type MerklChainId } from "@sdk";
|
4
|
-
import type { CreateOpportunityModel, GetOpportunitiesQueryModel, LightOpportunityFromDB, OpportunityResourceModel, OpportunityUnique, UpdateOpportunityModel } from "./opportunity.model";
|
4
|
+
import type { CreateOpportunityModel, GetOpportunitiesQueryModel, LightOpportunityFromDB, Opportunity, OpportunityResourceModel, OpportunityUnique, UpdateOpportunityModel } from "./opportunity.model";
|
5
5
|
import { OpportunityRepository } from "./opportunity.repository";
|
6
6
|
export declare abstract class OpportunityService {
|
7
7
|
#private;
|
@@ -945,7 +945,7 @@ export declare abstract class OpportunityService {
|
|
945
945
|
static aggregateMax(query: GetOpportunitiesQueryModel, field: keyof Prisma.OpportunityMaxAggregateInputType): Promise<{
|
946
946
|
max: string;
|
947
947
|
}>;
|
948
|
-
static update(id: string, data:
|
948
|
+
static update(id: string, data: Partial<Opportunity["raw"]>): Promise<{
|
949
949
|
id: string;
|
950
950
|
name: string;
|
951
951
|
type: string;
|
@@ -206,7 +206,7 @@ export class OpportunityService {
|
|
206
206
|
};
|
207
207
|
const formated = {
|
208
208
|
...OpportunityService.formatResponseBase(opp),
|
209
|
-
apr: opp.
|
209
|
+
apr: opp.apr,
|
210
210
|
aprRecord,
|
211
211
|
tvlRecord: TvlRecords?.map(({ id, total, timestamp, TvlBreakdown: breakdowns }) => ({
|
212
212
|
id,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
2
|
import { ChainId } from "@sdk";
|
3
|
+
import { capitalize } from "lodash";
|
3
4
|
export const stakingContractToStakingSymbol = {
|
4
5
|
"0x18eeD20f71BEf84B605253C89A7576E3634134C0": "CyberStaking",
|
5
6
|
"0x68754d29f2e97B837Cb622ccfF325adAC27E9977": "Karak",
|
@@ -39,21 +40,21 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
39
40
|
case tokenType.pancakeswap:
|
40
41
|
case tokenType.traderJoe:
|
41
42
|
case tokenType.katana:
|
42
|
-
return `Provide liquidity to ${typeInfo.protocol} ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}`;
|
43
|
+
return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}`;
|
43
44
|
case tokenType.pendleYT:
|
44
|
-
return `Hold ${typeInfo.protocol} ${typeInfo.name}`;
|
45
|
+
return `Hold ${capitalize(typeInfo.protocol)} ${typeInfo.name}`;
|
45
46
|
case tokenType.pendle:
|
46
|
-
return `Provide ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
47
|
+
return `Provide ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
47
48
|
case tokenType.balancerGauge:
|
48
|
-
return `${typeInfo.protocol} ${symbols.join("-")}`;
|
49
|
+
return `${capitalize(typeInfo.protocol)} ${symbols.join("-")}`;
|
49
50
|
case tokenType.beraborrow_gauge:
|
50
51
|
case tokenType.beratrax_vault:
|
51
|
-
return `Deposit ${symbols.join("-")} on ${typeInfo.protocol}`;
|
52
|
+
return `Deposit ${symbols.join("-")} on ${capitalize(typeInfo.protocol)}`;
|
52
53
|
case tokenType.balancerPool: {
|
53
54
|
if (campaign.computeChainId === ChainId.SONIC) {
|
54
55
|
typeInfo.protocol = "Beets";
|
55
56
|
}
|
56
|
-
let cardName = `Provide liquidity to ${typeInfo.protocol} ${symbols.join("-")}`;
|
57
|
+
let cardName = `Provide liquidity to ${capitalize(typeInfo.protocol)} ${symbols.join("-")}`;
|
57
58
|
if (typeInfo.vault === "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875") {
|
58
59
|
cardName = `Provide liquidity to Jellyverse Pool ${symbols.join("-")}`;
|
59
60
|
}
|
@@ -63,23 +64,23 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
63
64
|
if (campaign.computeChainId === ChainId.SONIC) {
|
64
65
|
typeInfo.protocol = "Beets";
|
65
66
|
}
|
66
|
-
return `Provide liquidity to ${typeInfo.protocol} Boosted ${symbols.join("-")}`;
|
67
|
+
return `Provide liquidity to ${capitalize(typeInfo.protocol)} Boosted ${symbols.join("-")}`;
|
67
68
|
}
|
68
69
|
case tokenType.aura:
|
69
|
-
return `Provide liquidity to ${typeInfo.protocol} ${symbols.join("-")}`;
|
70
|
+
return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${symbols.join("-")}`;
|
70
71
|
case tokenType.gearbox:
|
71
|
-
return `${typeInfo.protocol} ${typeInfo.symbolUnderlyingToken} Deposit`;
|
72
|
+
return `${capitalize(typeInfo.protocol)} ${typeInfo.symbolUnderlyingToken} Deposit`;
|
72
73
|
case tokenType.compound:
|
73
|
-
return `Lend ${typeInfo.symbolBaseToken} on ${typeInfo.protocol}`;
|
74
|
+
return `Lend ${typeInfo.symbolBaseToken} on ${capitalize(typeInfo.protocol)}`;
|
74
75
|
case tokenType.radiant_lend: {
|
75
76
|
let cardToken = typeInfo.symbolUnderlyingToken;
|
76
77
|
if (campaign.campaignParameters.symbolTargetToken.startsWith("r")) {
|
77
78
|
cardToken = campaign.campaignParameters.symbolTargetToken.substring(1);
|
78
79
|
}
|
79
|
-
return `Lend ${cardToken} on ${typeInfo.protocol}`;
|
80
|
+
return `Lend ${cardToken} on ${capitalize(typeInfo.protocol)}`;
|
80
81
|
}
|
81
82
|
case tokenType.rfx:
|
82
|
-
return `Supply ${typeInfo.symbolShortToken}-${typeInfo.symbolLongToken} on ${typeInfo.protocol}`;
|
83
|
+
return `Supply ${typeInfo.symbolShortToken}-${typeInfo.symbolLongToken} on ${capitalize(typeInfo.protocol)}`;
|
83
84
|
case tokenType.radiant_borrow:
|
84
85
|
case tokenType.aave_borrowing:
|
85
86
|
case tokenType.vicuna_borrowing:
|
@@ -91,7 +92,7 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
91
92
|
case tokenType.takotako_borrowing:
|
92
93
|
case tokenType.lendle_borrowing:
|
93
94
|
case tokenType.euler_borrow:
|
94
|
-
return `Borrow ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
95
|
+
return `Borrow ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
95
96
|
case tokenType.ionic:
|
96
97
|
case tokenType.layerbank:
|
97
98
|
case tokenType.moonwell:
|
@@ -109,45 +110,45 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
109
110
|
case tokenType.venus:
|
110
111
|
case tokenType.reactor_fusion:
|
111
112
|
case tokenType.euler_lend:
|
112
|
-
return `Supply ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
113
|
+
return `Supply ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
113
114
|
case tokenType.metamorpho:
|
114
|
-
return `Supply to ${typeInfo.name} on ${typeInfo.protocol}`;
|
115
|
+
return `Supply to ${typeInfo.name} on ${capitalize(typeInfo.protocol)}`;
|
115
116
|
case tokenType.sturdy_aggregator:
|
116
|
-
return `Supply ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol} ${typeInfo.name}`;
|
117
|
+
return `Supply ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)} ${typeInfo.name}`;
|
117
118
|
case tokenType.sturdy_silo:
|
118
|
-
return `Supply ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol} ${typeInfo.symbolCollateral} Silo`;
|
119
|
+
return `Supply ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)} ${typeInfo.symbolCollateral} Silo`;
|
119
120
|
case tokenType.curve:
|
120
121
|
case tokenType.curve_2:
|
121
|
-
return `Provide liquidity to ${typeInfo.protocol} ${Object.values(typeInfo.poolTokens).join("-")}`;
|
122
|
+
return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${Object.values(typeInfo.poolTokens).join("-")}`;
|
122
123
|
case tokenType.fluid:
|
123
|
-
return `Lend ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
124
|
+
return `Lend ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
124
125
|
case tokenType.enzyme:
|
125
|
-
return `Supply to the ${typeInfo.name} on ${typeInfo.protocol}`;
|
126
|
+
return `Supply to the ${typeInfo.name} on ${capitalize(typeInfo.protocol)}`;
|
126
127
|
case tokenType.filament:
|
127
|
-
return `Earn Yield on ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
128
|
+
return `Earn Yield on ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
128
129
|
case tokenType.silostaking:
|
129
|
-
return `Stake ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
130
|
+
return `Stake ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
130
131
|
case tokenType.beefy:
|
131
|
-
return `Provide liquidity to ${typeInfo.protocol} ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}`;
|
132
|
+
return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}`;
|
132
133
|
case tokenType.toros:
|
133
|
-
return `${typeInfo.name} (${campaign.campaignParameters.symbolTargetToken}) on ${typeInfo.protocol}`;
|
134
|
+
return `${typeInfo.name} (${campaign.campaignParameters.symbolTargetToken}) on ${capitalize(typeInfo.protocol)}`;
|
134
135
|
case tokenType.ironcladStaking:
|
135
|
-
return `Stake ${campaign.campaignParameters.symbolTargetToken} on ${typeInfo.protocol}`;
|
136
|
+
return `Stake ${campaign.campaignParameters.symbolTargetToken} on ${capitalize(typeInfo.protocol)}`;
|
136
137
|
case tokenType.woofi:
|
137
|
-
return `Supercharge ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
138
|
+
return `Supercharge ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
138
139
|
case tokenType.maverickBoostedPosition:
|
139
140
|
return `Maverick Boosted Position ${campaign.campaignParameters.symbolTargetToken}`;
|
140
141
|
case tokenType.zkSwapThreePool:
|
141
|
-
return `Provide liquidity to ${typeInfo.protocol} ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}-${typeInfo.symbolToken2}`;
|
142
|
+
return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}-${typeInfo.symbolToken2}`;
|
142
143
|
case tokenType.maha:
|
143
|
-
return `Stake ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} LP on ${typeInfo.protocol}`;
|
144
|
+
return `Stake ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} LP on ${capitalize(typeInfo.protocol)}`;
|
144
145
|
case tokenType.tempest:
|
145
146
|
case tokenType.tempestStaking:
|
146
|
-
return `Deposit into ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} vault on ${typeInfo.protocol}`;
|
147
|
+
return `Deposit into ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} vault on ${capitalize(typeInfo.protocol)}`;
|
147
148
|
case tokenType.holdstation:
|
148
|
-
return `Hold vault token ${campaign.campaignParameters.symbolTargetToken} on ${typeInfo.protocol}`;
|
149
|
+
return `Hold vault token ${campaign.campaignParameters.symbolTargetToken} on ${capitalize(typeInfo.protocol)}`;
|
149
150
|
case tokenType.cpmmGamma:
|
150
|
-
return `Provide ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} on ${typeInfo.protocol}`;
|
151
|
+
return `Provide ${typeInfo.symbolToken0}-${typeInfo.symbolToken1} on ${capitalize(typeInfo.protocol)}`;
|
151
152
|
case tokenType.crosscurve:
|
152
153
|
if (typeInfo.name.toLowerCase() === "eywa/usdt") {
|
153
154
|
return `Curve ${typeInfo.name}`;
|
@@ -162,7 +163,7 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
162
163
|
return `Deposit liquidity on ${parsedNameForCard.replace("BALANCER", "Beets")} vault on Vicuna`;
|
163
164
|
}
|
164
165
|
case tokenType.satlayer:
|
165
|
-
return `Restake ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
166
|
+
return `Restake ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
|
166
167
|
case tokenType.veda:
|
167
168
|
return `Deposit into ${typeInfo.name.replace("Ether.Fi", "Veda")}`;
|
168
169
|
case tokenType.concrete:
|