@merkl/api 0.10.263 → 0.10.265
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/database/api/.generated/edge.js +6 -4
- package/dist/database/api/.generated/index-browser.js +3 -1
- package/dist/database/api/.generated/index.d.ts +3 -1
- package/dist/database/api/.generated/index.js +6 -4
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +2 -0
- package/dist/database/api/.generated/wasm.js +3 -1
- package/dist/database/api/seeder/resources/protocol.d.ts +7 -0
- package/dist/database/api/seeder/resources/protocol.js +1 -0
- package/dist/src/backgroundJobs/jobs/campaignsCacheUpdater.js +0 -4
- package/dist/src/eden/index.d.ts +15 -15
- package/dist/src/entities/opportunity.js +35 -0
- package/dist/src/index.d.ts +5 -5
- package/dist/src/libs/campaigns/campaignTypes/SILODynamicData.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/SILODynamicData.js +6 -4
- package/dist/src/libs/campaigns/campaignTypes/VestDynamicData.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/VestDynamicData.js +61 -0
- package/dist/src/libs/campaigns/campaignsDynamicData.js +4 -0
- package/dist/src/libs/positions/prepareFetch.js +26 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +2 -2
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +3 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -3
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +5 -5
- package/dist/src/modules/v4/opportunity/opportunity.service.js +16 -6
- package/dist/src/modules/v4/opportunity/subservices/getIonMetadata.service.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getIonMetadata.service.js +13 -0
- package/dist/src/modules/v4/opportunity/subservices/getVestMetaData.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/subservices/getVestMetaData.js +10 -0
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
- package/dist/src/modules/v4/router.d.ts +5 -5
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -21,6 +21,7 @@ import { getJsonAirdropMetadata } from "./subservices/getJsonAirDropMetadata.ser
|
|
21
21
|
import { getMorphoMetadata } from "./subservices/getMorphoMetadata.service";
|
22
22
|
import { getRadiantMetadata } from "./subservices/getRadiantMetadata.service";
|
23
23
|
import { getSiloMetadata } from "./subservices/getSiloMetadata.service";
|
24
|
+
import { getVestMetaData } from "./subservices/getVestMetaData";
|
24
25
|
export class OpportunityService {
|
25
26
|
static hashId(opportunity) {
|
26
27
|
return Bun.hash(`${opportunity.chainId}${opportunity.type}${opportunity.identifier}`).toString();
|
@@ -69,6 +70,8 @@ export class OpportunityService {
|
|
69
70
|
return getAjnaMetadata(chainId, campaign.subType, campaignParams);
|
70
71
|
case "EIGENLAYER":
|
71
72
|
return getEigenLayerMetadata(chainId, campaignParams);
|
73
|
+
case "VEST":
|
74
|
+
return getVestMetaData(chainId, campaignParams);
|
72
75
|
case "EULER":
|
73
76
|
return getEulerMetadata(chainId, campaign.campaignId, campaign.subType, campaign.rewardTokenAddress, campaign.amount, campaignParams);
|
74
77
|
case "INVALID":
|
@@ -145,7 +148,7 @@ export class OpportunityService {
|
|
145
148
|
for (const opp of opportunities) {
|
146
149
|
const { live: activeCampaigns, soon: futureCampaigns } = CampaignService.splitOnStatus(opp.Campaigns);
|
147
150
|
if (activeCampaigns.length === 0) {
|
148
|
-
await OpportunityRepository.updateStatus(opp.id, futureCampaigns.length === 0 ? "PAST" : "SOON").catch(err => log.error("Cannot update opportunity status
|
151
|
+
await OpportunityRepository.updateStatus(opp.id, futureCampaigns.length === 0 ? "PAST" : "SOON").catch(err => log.error("Cannot update opportunity status", err, "opportunities"));
|
149
152
|
}
|
150
153
|
if (opp.status !== "LIVE" && activeCampaigns.length !== 0)
|
151
154
|
await OpportunityRepository.updateStatus(opp.id, "LIVE").catch(err => log.error("Cannot update opportunity status to LIVE", err, "opportunities"));
|
@@ -206,11 +209,18 @@ export class OpportunityService {
|
|
206
209
|
const { DailyRewardsRecords, AprRecords, TvlRecords, ...opp } = opportunity;
|
207
210
|
return {
|
208
211
|
...OpportunityService.formatResponseBase(opp),
|
209
|
-
|
210
|
-
|
211
|
-
timestamp,
|
212
|
-
|
213
|
-
|
212
|
+
apr: opp.status === "LIVE" ? opp.apr : 0,
|
213
|
+
aprRecord: opp.status === "LIVE"
|
214
|
+
? (AprRecords?.map(({ cumulated, timestamp, AprBreakdown: breakdowns }) => ({
|
215
|
+
cumulated,
|
216
|
+
timestamp,
|
217
|
+
breakdowns,
|
218
|
+
}))?.[0] ?? undefined)
|
219
|
+
: {
|
220
|
+
cumulated: 0,
|
221
|
+
timestamp: AprRecords[0].timestamp,
|
222
|
+
breakdowns: [{ ...AprRecords[0].AprBreakdown[0], value: 0 }],
|
223
|
+
},
|
214
224
|
tvlRecord: TvlRecords?.map(({ id, total, timestamp, TvlBreakdown: breakdowns }) => ({
|
215
225
|
id,
|
216
226
|
total,
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { OpportunityAction } from "../../../../../database/api/.generated";
|
2
|
+
export const getIonMetadata = async (chainId, params) => {
|
3
|
+
// TODO this is not finalized at all
|
4
|
+
return {
|
5
|
+
action: OpportunityAction.LEND,
|
6
|
+
name: ["Ion", "strategy for", params.symbolBorrowToken].join(" "),
|
7
|
+
tokens: [
|
8
|
+
{ chainId, address: params.borrowToken },
|
9
|
+
{ chainId, address: params.collateralToken },
|
10
|
+
],
|
11
|
+
mainProtocol: "ion",
|
12
|
+
};
|
13
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { VEST_TOKEN } from "../../../../libs/campaigns/campaignTypes/VestDynamicData";
|
2
|
+
import { OpportunityAction } from "../../../../../database/api/.generated";
|
3
|
+
export const getVestMetaData = async (chainId, params) => {
|
4
|
+
return {
|
5
|
+
action: OpportunityAction.LEND,
|
6
|
+
name: ["Vest", "supply", "treasury"].join(" "),
|
7
|
+
tokens: [{ chainId, address: VEST_TOKEN }],
|
8
|
+
mainProtocol: "vest",
|
9
|
+
};
|
10
|
+
};
|
@@ -5,7 +5,7 @@ import type { Resource } from "../prisma";
|
|
5
5
|
* @see {@link Resource}
|
6
6
|
*/
|
7
7
|
export type Protocol = Resource<"Protocol">;
|
8
|
-
declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "syncswap-v3", "neptune", "zkSwapThreePool", "syncswap", "rfx", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "venus", "woofi", "reactor_fusion", "eigenlayer"];
|
8
|
+
declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "syncswap-v3", "neptune", "zkSwapThreePool", "syncswap", "rfx", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "venus", "woofi", "reactor_fusion", "eigenlayer", "vest"];
|
9
9
|
export type ProtocolId = (typeof protocolTypes)[number];
|
10
10
|
export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
|
11
11
|
id: import("@sinclair/typebox").TString;
|
@@ -30,7 +30,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
30
30
|
depositUrl?: string | undefined;
|
31
31
|
protocols?: string[] | undefined;
|
32
32
|
mainProtocol?: string | undefined;
|
33
|
-
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
33
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | "ERC20TRANSFERS" | "VEST";
|
34
34
|
tokens: {
|
35
35
|
chainId: number;
|
36
36
|
address: string;
|
@@ -99,7 +99,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
99
99
|
} & {
|
100
100
|
price?: number | null | undefined;
|
101
101
|
})[];
|
102
|
-
mainProtocol: "morpho" | "aura" | "poolside" | "gearbox" | "fluid" | "compound" | "ionic" | "layerbank" | "moonwell" | "fenix" | "syncswap" | "beefy" | "aerodrome" | "velodrome" | "curve" | "akron" | "dragonswap" | "koi" | "baseswap" | "zkswap" | "rfx" | "woofi" | "zkSwapThreePool" | "venus" | "reactor_fusion" | "balancer" | "aave" | "arthswap" | "camelot" | "crust" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "supswap-v3" | "thirdtrade" | "uniswap-v2" | "syncswap-v3" | "neptune" | "radiant" | "euler" | "sturdy" | "frax" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "ion" | "eigenlayer" | undefined;
|
102
|
+
mainProtocol: "morpho" | "aura" | "poolside" | "gearbox" | "fluid" | "compound" | "ionic" | "layerbank" | "moonwell" | "fenix" | "syncswap" | "beefy" | "aerodrome" | "velodrome" | "curve" | "akron" | "dragonswap" | "koi" | "baseswap" | "zkswap" | "rfx" | "woofi" | "zkSwapThreePool" | "venus" | "reactor_fusion" | "balancer" | "aave" | "arthswap" | "camelot" | "crust" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "supswap-v3" | "thirdtrade" | "uniswap-v2" | "syncswap-v3" | "neptune" | "radiant" | "euler" | "sturdy" | "frax" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "ion" | "eigenlayer" | "vest" | undefined;
|
103
103
|
depositUrl: any;
|
104
104
|
tags: string[];
|
105
105
|
};
|
@@ -132,6 +132,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
132
132
|
headers: unknown;
|
133
133
|
response: {
|
134
134
|
200: {
|
135
|
+
apr: number;
|
135
136
|
aprRecord: {
|
136
137
|
cumulated: number;
|
137
138
|
timestamp: bigint;
|
@@ -216,7 +217,6 @@ export declare const v4: Elysia<"/v4", false, {
|
|
216
217
|
chainId: number;
|
217
218
|
action: import("../../../database/api/.generated").$Enums.OpportunityAction;
|
218
219
|
tvl: number;
|
219
|
-
apr: number;
|
220
220
|
dailyRewards: number;
|
221
221
|
}[];
|
222
222
|
};
|
@@ -643,7 +643,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
643
643
|
body: unknown;
|
644
644
|
params: {};
|
645
645
|
query: {
|
646
|
-
type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | undefined;
|
646
|
+
type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | "ERC20TRANSFERS" | "VEST" | undefined;
|
647
647
|
items?: number | undefined;
|
648
648
|
subType?: number | undefined;
|
649
649
|
page?: number | undefined;
|
@@ -715,7 +715,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
715
715
|
body: unknown;
|
716
716
|
params: {};
|
717
717
|
query: {
|
718
|
-
type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | undefined;
|
718
|
+
type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | "ERC20TRANSFERS" | "VEST" | undefined;
|
719
719
|
items?: number | undefined;
|
720
720
|
subType?: number | undefined;
|
721
721
|
page?: number | undefined;
|