@merkl/api 0.19.49 → 0.20.1
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/drizzle/schema.d.ts +28 -28
- package/dist/database/api/.generated/drizzle/schema.js +11 -11
- package/dist/database/api/.generated/drizzle/schema.ts +11 -11
- package/dist/database/api/.generated/edge.js +5 -5
- package/dist/database/api/.generated/index-browser.js +2 -2
- package/dist/database/api/.generated/index.d.ts +151 -154
- package/dist/database/api/.generated/index.js +5 -5
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +11 -11
- package/dist/database/api/.generated/wasm.js +2 -2
- package/dist/src/eden/index.d.ts +86 -10
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Dolomite.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Dolomite.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Euler.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Euler.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Hyperdrive.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Hyperdrive.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Morpho.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Morpho.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Radiant.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Radiant.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Silo.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Silo.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/UniswapV4.d.ts +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/UniswapV4.js +2 -0
- package/dist/src/index.d.ts +18 -2
- package/dist/src/jobs/reward-breakdowns.js +1 -3
- package/dist/src/jobs/update-rpc-calls-cache.d.ts +1 -0
- package/dist/src/jobs/update-rpc-calls-cache.js +20 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +5 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +9 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.service.d.ts +7 -0
- package/dist/src/modules/v4/merklRoot/merklRoot.service.js +15 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +6 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.js +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +11 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +8 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +12 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -0
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +1 -0
- package/dist/src/modules/v4/reward/reward.model.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.repository.d.ts +3 -4
- package/dist/src/modules/v4/reward/reward.repository.js +0 -1
- package/dist/src/modules/v4/reward/reward.service.d.ts +10 -4
- package/dist/src/modules/v4/reward/reward.service.js +10 -10
- package/dist/src/modules/v4/router.d.ts +18 -2
- package/dist/src/modules/v4/token/token.controller.d.ts +6 -2
- package/dist/src/modules/v4/token/token.model.d.ts +6 -2
- package/dist/src/modules/v4/token/token.model.js +6 -1
- package/dist/src/modules/v4/token/token.service.js +2 -1
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +3 -1
@@ -2,6 +2,7 @@ import { dynamicDataBuilderFactory } from "@/engine/dynamicData/factory";
|
|
2
2
|
import { log } from "@/utils/logger";
|
3
3
|
import { OpportunityAction } from "@db/api";
|
4
4
|
import { Campaign as CampaignEnum } from "@sdk";
|
5
|
+
import { getAddress } from "viem";
|
5
6
|
export class EulerMetadata {
|
6
7
|
async build(computeChainId, params, subType, rewardTokenAddress, distributionChainId, campaignId) {
|
7
8
|
let name = `Hold ${params.symbolTargetToken}`;
|
@@ -30,6 +31,7 @@ export class EulerMetadata {
|
|
30
31
|
action: [OpportunityAction.LEND, OpportunityAction.BORROW, OpportunityAction.BORROW][subType],
|
31
32
|
mainProtocol: "euler",
|
32
33
|
depositUrl: EulerMetadata.generateUrl(computeChainId, params),
|
34
|
+
explorerAddress: getAddress(params.targetToken),
|
33
35
|
};
|
34
36
|
}
|
35
37
|
static generateUrl(_computeChainId, params) {
|
@@ -12,6 +12,7 @@ export declare class HyperdriveMetadata implements MetadataBuilder<campaignType>
|
|
12
12
|
}[];
|
13
13
|
mainProtocol: ProtocolId;
|
14
14
|
depositUrl: string;
|
15
|
+
explorerAddress: `0x${string}`;
|
15
16
|
}>;
|
16
17
|
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], subType: CampaignParameters<campaignType>["campaignSubType"]): string;
|
17
18
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { OpportunityAction } from "@db/api";
|
2
2
|
import { HyperDriveSubCampaignType } from "@sdk";
|
3
|
+
import { getAddress } from "viem";
|
3
4
|
export class HyperdriveMetadata {
|
4
5
|
async build(computeChainId, params, subType) {
|
5
6
|
const subtypes = [
|
@@ -17,6 +18,7 @@ export class HyperdriveMetadata {
|
|
17
18
|
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
18
19
|
mainProtocol: "hyperdrive",
|
19
20
|
depositUrl: HyperdriveMetadata.generateUrl(computeChainId, params, subType),
|
21
|
+
explorerAddress: getAddress(params.targetToken),
|
20
22
|
};
|
21
23
|
}
|
22
24
|
static generateUrl(computeChainId, params, subType) {
|
@@ -13,6 +13,7 @@ export declare class MorphoMetadata implements MetadataBuilder<campaignType> {
|
|
13
13
|
name: string;
|
14
14
|
mainProtocol: ProtocolId;
|
15
15
|
depositUrl: string | undefined;
|
16
|
+
explorerAddress: `0x${string}`;
|
16
17
|
}>;
|
17
18
|
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], morphoParams: {
|
18
19
|
nameTargetToken: string;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { OpportunityAction } from "@db/api";
|
2
2
|
import { BN2Number, MorphoSubCampaignType, NETWORK_LABELS, } from "@sdk";
|
3
|
+
import { getAddress } from "viem";
|
3
4
|
export class MorphoMetadata {
|
4
5
|
async build(computeChainId, params, subType) {
|
5
6
|
const morphoParams = params;
|
@@ -17,6 +18,7 @@ export class MorphoMetadata {
|
|
17
18
|
name: subtype.name,
|
18
19
|
mainProtocol: "morpho",
|
19
20
|
depositUrl: MorphoMetadata.generateUrl(computeChainId, params, morphoParams, subType),
|
21
|
+
explorerAddress: getAddress(params.targetToken),
|
20
22
|
};
|
21
23
|
}
|
22
24
|
static generateUrl(computeChainId, params, morphoParams, subType) {
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { OpportunityAction } from "@db/api";
|
2
|
+
import { getAddress } from "viem";
|
2
3
|
export class RadiantMetadata {
|
3
4
|
async build(computeChainId, params, subType) {
|
4
5
|
return {
|
@@ -6,6 +7,7 @@ export class RadiantMetadata {
|
|
6
7
|
name: [subType <= 1 ? "Lend" : "Borrow", params.symbolTargetToken].join(" "),
|
7
8
|
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
8
9
|
mainProtocol: "radiant",
|
10
|
+
explorerAddress: getAddress(params.targetToken),
|
9
11
|
};
|
10
12
|
}
|
11
13
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { OpportunityAction } from "@db/api";
|
2
|
+
import { getAddress } from "viem";
|
2
3
|
export class SiloMetadata {
|
3
4
|
async build(computeChainId, params, subType) {
|
4
5
|
let suffix = ["Deposit", "Protected Deposit", "Debt"][subType];
|
@@ -10,6 +11,7 @@ export class SiloMetadata {
|
|
10
11
|
name: [subType <= 1 ? "Lend" : "Borrow", params.symbolTargetToken, suffix].join(" "),
|
11
12
|
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
12
13
|
mainProtocol: "silo",
|
14
|
+
explorerAddress: getAddress(params.targetToken),
|
13
15
|
};
|
14
16
|
}
|
15
17
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { OpportunityAction } from "@db/api";
|
2
|
+
import { getAddress } from "viem";
|
2
3
|
export class UniswapV4Metadata {
|
3
4
|
async build(computeChainId, params, _subType) {
|
4
5
|
const whitelistNameString = "";
|
@@ -23,6 +24,7 @@ export class UniswapV4Metadata {
|
|
23
24
|
{ chainId: computeChainId, address: params.currency1 },
|
24
25
|
],
|
25
26
|
mainProtocol: "uniswap",
|
27
|
+
explorerAddress: getAddress(params.poolManager),
|
26
28
|
};
|
27
29
|
}
|
28
30
|
}
|
package/dist/src/index.d.ts
CHANGED
@@ -164,6 +164,7 @@ declare const app: Elysia<"", false, {
|
|
164
164
|
name?: string | undefined;
|
165
165
|
tags?: string[] | undefined;
|
166
166
|
depositUrl?: string | undefined;
|
167
|
+
explorerAddress?: string | undefined;
|
167
168
|
protocols?: string[] | undefined;
|
168
169
|
mainProtocol?: string | undefined;
|
169
170
|
type: string;
|
@@ -192,6 +193,7 @@ declare const app: Elysia<"", false, {
|
|
192
193
|
action: import("@db/api").$Enums.OpportunityAction;
|
193
194
|
chainId: number;
|
194
195
|
depositUrl: string | null;
|
196
|
+
explorerAddress: string | null;
|
195
197
|
mainProtocolId: string | null;
|
196
198
|
tvl: number;
|
197
199
|
apr: number;
|
@@ -240,6 +242,7 @@ declare const app: Elysia<"", false, {
|
|
240
242
|
})[];
|
241
243
|
mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
|
242
244
|
depositUrl: any;
|
245
|
+
explorerAddress: string | undefined;
|
243
246
|
tags: string[];
|
244
247
|
};
|
245
248
|
};
|
@@ -385,6 +388,7 @@ declare const app: Elysia<"", false, {
|
|
385
388
|
action: import("@db/api").$Enums.OpportunityAction;
|
386
389
|
chainId: number;
|
387
390
|
depositUrl: string | null;
|
391
|
+
explorerAddress: string | null;
|
388
392
|
mainProtocolId: string | null;
|
389
393
|
tvl: number;
|
390
394
|
apr: number;
|
@@ -437,6 +441,7 @@ declare const app: Elysia<"", false, {
|
|
437
441
|
identifier: string;
|
438
442
|
action: import("@db/api").$Enums.OpportunityAction;
|
439
443
|
chainId: number;
|
444
|
+
explorerAddress: string | null;
|
440
445
|
tvl: number;
|
441
446
|
dailyRewards: number;
|
442
447
|
}[];
|
@@ -1091,6 +1096,7 @@ declare const app: Elysia<"", false, {
|
|
1091
1096
|
action: import("@db/api").$Enums.OpportunityAction;
|
1092
1097
|
chainId: number;
|
1093
1098
|
depositUrl: string | null;
|
1099
|
+
explorerAddress: string | null;
|
1094
1100
|
mainProtocolId: string | null;
|
1095
1101
|
tvl: number;
|
1096
1102
|
apr: number;
|
@@ -1313,6 +1319,7 @@ declare const app: Elysia<"", false, {
|
|
1313
1319
|
})[];
|
1314
1320
|
mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
|
1315
1321
|
depositUrl: any;
|
1322
|
+
explorerAddress: string | undefined;
|
1316
1323
|
tags: string[];
|
1317
1324
|
};
|
1318
1325
|
};
|
@@ -1404,6 +1411,7 @@ declare const app: Elysia<"", false, {
|
|
1404
1411
|
action: import("@db/api").$Enums.OpportunityAction;
|
1405
1412
|
chainId: number;
|
1406
1413
|
depositUrl: string | null;
|
1414
|
+
explorerAddress: string | null;
|
1407
1415
|
mainProtocolId: string | null;
|
1408
1416
|
tvl: number;
|
1409
1417
|
apr: number;
|
@@ -1486,6 +1494,7 @@ declare const app: Elysia<"", false, {
|
|
1486
1494
|
action: import("@db/api").$Enums.OpportunityAction;
|
1487
1495
|
chainId: number;
|
1488
1496
|
depositUrl: string | null;
|
1497
|
+
explorerAddress: string | null;
|
1489
1498
|
mainProtocolId: string | null;
|
1490
1499
|
tvl: number;
|
1491
1500
|
apr: number;
|
@@ -1669,6 +1678,7 @@ declare const app: Elysia<"", false, {
|
|
1669
1678
|
action: import("@db/api").$Enums.OpportunityAction;
|
1670
1679
|
chainId: number;
|
1671
1680
|
depositUrl: string | null;
|
1681
|
+
explorerAddress: string | null;
|
1672
1682
|
mainProtocolId: string | null;
|
1673
1683
|
tvl: number;
|
1674
1684
|
apr: number;
|
@@ -2296,11 +2306,15 @@ declare const app: Elysia<"", false, {
|
|
2296
2306
|
data: {
|
2297
2307
|
properties: {
|
2298
2308
|
"Icon (Required)": {
|
2299
|
-
files: {
|
2309
|
+
files: ({
|
2300
2310
|
file: {
|
2301
2311
|
url: string;
|
2302
2312
|
};
|
2303
|
-
}
|
2313
|
+
} | {
|
2314
|
+
external: {
|
2315
|
+
url: string;
|
2316
|
+
};
|
2317
|
+
})[];
|
2304
2318
|
};
|
2305
2319
|
"Address (in checksum format) (Required)": {
|
2306
2320
|
rich_text: {
|
@@ -3348,6 +3362,7 @@ declare const app: Elysia<"", false, {
|
|
3348
3362
|
action: import("@db/api").$Enums.OpportunityAction;
|
3349
3363
|
chainId: number;
|
3350
3364
|
depositUrl: string | null;
|
3365
|
+
explorerAddress: string | null;
|
3351
3366
|
mainProtocolId: string | null;
|
3352
3367
|
tvl: number;
|
3353
3368
|
apr: number;
|
@@ -3465,6 +3480,7 @@ declare const app: Elysia<"", false, {
|
|
3465
3480
|
action: import("@db/api").$Enums.OpportunityAction;
|
3466
3481
|
chainId: number;
|
3467
3482
|
depositUrl: string | null;
|
3483
|
+
explorerAddress: string | null;
|
3468
3484
|
mainProtocolId: string | null;
|
3469
3485
|
tvl: number;
|
3470
3486
|
apr: number;
|
@@ -64,9 +64,7 @@ const transform = (rewardBreakdowns) => {
|
|
64
64
|
const rewardTokenId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdowns[i].token}`).toString();
|
65
65
|
const rewardId = Bun.hash(`${process.env.ROOT}${rewardBreakdowns[i].recipient}${rewardTokenId}`).toString();
|
66
66
|
const campaignId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdowns[i].campaignId}`).toString();
|
67
|
-
const rewardBreakdownId = Bun.hash(`${rewardId}${campaignId}${rewardBreakdowns[i].reason}`).toString();
|
68
67
|
transformedBreakdowns[i] = {
|
69
|
-
stringId: rewardBreakdownId,
|
70
68
|
rewardId,
|
71
69
|
protocolId: rewardBreakdowns[i].protocolId ? rewardBreakdowns[i].protocolId : undefined,
|
72
70
|
campaignId,
|
@@ -152,4 +150,4 @@ export const main = async () => {
|
|
152
150
|
// if (failedBatches.length === 0) await file.delete();
|
153
151
|
process.exit(0);
|
154
152
|
};
|
155
|
-
main();
|
153
|
+
await main();
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { CacheService } from "@/modules/v4/cache";
|
2
|
+
import { TTLPresets } from "@/modules/v4/cache/cache.model";
|
3
|
+
import { ChainService } from "@/modules/v4/chain/chain.service";
|
4
|
+
import { MerklRootRepository } from "@/modules/v4/merklRoot/merklRoot.repository";
|
5
|
+
import { NETWORK_LABELS, log } from "@sdk";
|
6
|
+
const main = async () => {
|
7
|
+
try {
|
8
|
+
const chains = await ChainService.getSupportedIds();
|
9
|
+
const promises = [];
|
10
|
+
for (const chain of chains)
|
11
|
+
promises.push(CacheService.set(TTLPresets.MIN_10, MerklRootRepository.fetch, chain).catch(_err => log.warn(`RPC calls cache update failed for ${NETWORK_LABELS[chain]}.`)));
|
12
|
+
await Promise.allSettled(promises);
|
13
|
+
process.exit(0);
|
14
|
+
}
|
15
|
+
catch (err) {
|
16
|
+
console.error(err);
|
17
|
+
process.exit(1);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
await main();
|
@@ -222,6 +222,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
222
222
|
})[];
|
223
223
|
mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
|
224
224
|
depositUrl: any;
|
225
|
+
explorerAddress: string | undefined;
|
225
226
|
tags: string[];
|
226
227
|
};
|
227
228
|
};
|
@@ -313,6 +314,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
313
314
|
action: import("@db/api").$Enums.OpportunityAction;
|
314
315
|
chainId: number;
|
315
316
|
depositUrl: string | null;
|
317
|
+
explorerAddress: string | null;
|
316
318
|
mainProtocolId: string | null;
|
317
319
|
tvl: number;
|
318
320
|
apr: number;
|
@@ -395,6 +397,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
395
397
|
action: import("@db/api").$Enums.OpportunityAction;
|
396
398
|
chainId: number;
|
397
399
|
depositUrl: string | null;
|
400
|
+
explorerAddress: string | null;
|
398
401
|
mainProtocolId: string | null;
|
399
402
|
tvl: number;
|
400
403
|
apr: number;
|
@@ -578,6 +581,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
578
581
|
action: import("@db/api").$Enums.OpportunityAction;
|
579
582
|
chainId: number;
|
580
583
|
depositUrl: string | null;
|
584
|
+
explorerAddress: string | null;
|
581
585
|
mainProtocolId: string | null;
|
582
586
|
tvl: number;
|
583
587
|
apr: number;
|
@@ -312,6 +312,7 @@ export declare abstract class CampaignRepository {
|
|
312
312
|
action: import("@db/api").$Enums.OpportunityAction;
|
313
313
|
chainId: number;
|
314
314
|
depositUrl: string | null;
|
315
|
+
explorerAddress: string | null;
|
315
316
|
mainProtocolId: string | null;
|
316
317
|
tvl: number;
|
317
318
|
apr: number;
|
@@ -356,6 +357,7 @@ export declare abstract class CampaignRepository {
|
|
356
357
|
action: import("@db/api").$Enums.OpportunityAction;
|
357
358
|
chainId: number;
|
358
359
|
depositUrl: string | null;
|
360
|
+
explorerAddress: string | null;
|
359
361
|
mainProtocolId: string | null;
|
360
362
|
tvl: number;
|
361
363
|
apr: number;
|
@@ -416,6 +418,7 @@ export declare abstract class CampaignRepository {
|
|
416
418
|
action: import("@db/api").$Enums.OpportunityAction;
|
417
419
|
chainId: number;
|
418
420
|
depositUrl: string | null;
|
421
|
+
explorerAddress: string | null;
|
419
422
|
mainProtocolId: string | null;
|
420
423
|
tvl: number;
|
421
424
|
apr: number;
|
@@ -594,6 +597,7 @@ export declare abstract class CampaignRepository {
|
|
594
597
|
action: import("@db/api").$Enums.OpportunityAction;
|
595
598
|
chainId: number;
|
596
599
|
depositUrl: string | null;
|
600
|
+
explorerAddress: string | null;
|
597
601
|
mainProtocolId: string | null;
|
598
602
|
tvl: number;
|
599
603
|
apr: number;
|
@@ -674,6 +678,7 @@ export declare abstract class CampaignRepository {
|
|
674
678
|
action: import("@db/api").$Enums.OpportunityAction;
|
675
679
|
chainId: number;
|
676
680
|
depositUrl: string | null;
|
681
|
+
explorerAddress: string | null;
|
677
682
|
mainProtocolId: string | null;
|
678
683
|
tvl: number;
|
679
684
|
apr: number;
|
@@ -19,6 +19,7 @@ export declare abstract class CampaignService {
|
|
19
19
|
action: import("@db/api").$Enums.OpportunityAction;
|
20
20
|
chainId: number;
|
21
21
|
depositUrl: string | null;
|
22
|
+
explorerAddress: string | null;
|
22
23
|
mainProtocolId: string | null;
|
23
24
|
tvl: number;
|
24
25
|
apr: number;
|
@@ -55,6 +56,7 @@ export declare abstract class CampaignService {
|
|
55
56
|
action: import("@db/api").$Enums.OpportunityAction;
|
56
57
|
chainId: number;
|
57
58
|
depositUrl: string | null;
|
59
|
+
explorerAddress: string | null;
|
58
60
|
mainProtocolId: string | null;
|
59
61
|
tvl: number;
|
60
62
|
apr: number;
|
@@ -107,6 +109,7 @@ export declare abstract class CampaignService {
|
|
107
109
|
action: import("@db/api").$Enums.OpportunityAction;
|
108
110
|
chainId: number;
|
109
111
|
depositUrl: string | null;
|
112
|
+
explorerAddress: string | null;
|
110
113
|
mainProtocolId: string | null;
|
111
114
|
tvl: number;
|
112
115
|
apr: number;
|
@@ -239,6 +242,7 @@ export declare abstract class CampaignService {
|
|
239
242
|
action: import("@db/api").$Enums.OpportunityAction;
|
240
243
|
chainId: number;
|
241
244
|
depositUrl: string | null;
|
245
|
+
explorerAddress: string | null;
|
242
246
|
mainProtocolId: string | null;
|
243
247
|
tvl: number;
|
244
248
|
apr: number;
|
@@ -308,6 +312,7 @@ export declare abstract class CampaignService {
|
|
308
312
|
action: import("@db/api").$Enums.OpportunityAction;
|
309
313
|
chainId: number;
|
310
314
|
depositUrl: string | null;
|
315
|
+
explorerAddress: string | null;
|
311
316
|
mainProtocolId: string | null;
|
312
317
|
tvl: number;
|
313
318
|
apr: number;
|
@@ -378,6 +383,7 @@ export declare abstract class CampaignService {
|
|
378
383
|
action: import("@db/api").$Enums.OpportunityAction;
|
379
384
|
chainId: number;
|
380
385
|
depositUrl: string | null;
|
386
|
+
explorerAddress: string | null;
|
381
387
|
mainProtocolId: string | null;
|
382
388
|
tvl: number;
|
383
389
|
apr: number;
|
@@ -448,6 +454,7 @@ export declare abstract class CampaignService {
|
|
448
454
|
action: import("@db/api").$Enums.OpportunityAction;
|
449
455
|
chainId: number;
|
450
456
|
depositUrl: string | null;
|
457
|
+
explorerAddress: string | null;
|
451
458
|
mainProtocolId: string | null;
|
452
459
|
tvl: number;
|
453
460
|
apr: number;
|
@@ -565,6 +572,7 @@ export declare abstract class CampaignService {
|
|
565
572
|
action: import("@db/api").$Enums.OpportunityAction;
|
566
573
|
chainId: number;
|
567
574
|
depositUrl: string | null;
|
575
|
+
explorerAddress: string | null;
|
568
576
|
mainProtocolId: string | null;
|
569
577
|
tvl: number;
|
570
578
|
apr: number;
|
@@ -715,6 +723,7 @@ export declare abstract class CampaignService {
|
|
715
723
|
action: import("@db/api").$Enums.OpportunityAction;
|
716
724
|
chainId: number;
|
717
725
|
depositUrl: string | null;
|
726
|
+
explorerAddress: string | null;
|
718
727
|
mainProtocolId: string | null;
|
719
728
|
tvl: number;
|
720
729
|
apr: number;
|
@@ -19,6 +19,13 @@ export declare class MerklRootService {
|
|
19
19
|
* @returns object with live and last tree roots
|
20
20
|
*/
|
21
21
|
static fetch(chainId: ChainId): Promise<any>;
|
22
|
+
static fetchFromCache(chainId: ChainId): Promise<{
|
23
|
+
live: any;
|
24
|
+
tree: any;
|
25
|
+
lastTree: any;
|
26
|
+
endOfDisputePeriod: any;
|
27
|
+
disputer: any;
|
28
|
+
}>;
|
22
29
|
/**
|
23
30
|
* Fetch all roots for the provided chains
|
24
31
|
* @param chainIds to fetch roots for
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { HttpError } from "@/errors";
|
1
2
|
import { log } from "@/utils/logger";
|
2
3
|
import { NETWORK_LABELS, withTimeout } from "@sdk";
|
3
4
|
import { CacheService } from "../cache";
|
@@ -29,6 +30,19 @@ export class MerklRootService {
|
|
29
30
|
throw e;
|
30
31
|
}
|
31
32
|
}
|
33
|
+
static async fetchFromCache(chainId) {
|
34
|
+
try {
|
35
|
+
const data = await CacheService.get(MerklRootRepository.fetch, [chainId]);
|
36
|
+
if (data === null)
|
37
|
+
throw new Error("DATA_NOT_FOUND");
|
38
|
+
return data;
|
39
|
+
}
|
40
|
+
catch (err) {
|
41
|
+
if (err && err instanceof Error && err.message === "DATA_NOT_FOUND")
|
42
|
+
throw new HttpError(`Failed to fetch data for chain ${NETWORK_LABELS[chainId]}.`, 500);
|
43
|
+
return await MerklRootRepository.fetch(chainId);
|
44
|
+
}
|
45
|
+
}
|
32
46
|
/**
|
33
47
|
* Fetch all roots for the provided chains
|
34
48
|
* @param chainIds to fetch roots for
|
@@ -38,7 +52,7 @@ export class MerklRootService {
|
|
38
52
|
return await CacheService.wrap(TTLPresets.MIN_1, async () => {
|
39
53
|
let ids = chainIds ?? (await ChainService.getIds());
|
40
54
|
/** Fetch current Merkle Roots */
|
41
|
-
const merkleRootsPromises = await Promise.allSettled(ids.map(chainId => MerklRootService.
|
55
|
+
const merkleRootsPromises = await Promise.allSettled(ids.map(chainId => MerklRootService.fetchFromCache(chainId)));
|
42
56
|
/** Filter out unsuccessful chainIds */
|
43
57
|
ids = ids.filter((_, index) => merkleRootsPromises[index].status === "fulfilled");
|
44
58
|
const roots = merkleRootsPromises
|
@@ -19,6 +19,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
19
19
|
name?: string | undefined;
|
20
20
|
tags?: string[] | undefined;
|
21
21
|
depositUrl?: string | undefined;
|
22
|
+
explorerAddress?: string | undefined;
|
22
23
|
protocols?: string[] | undefined;
|
23
24
|
mainProtocol?: string | undefined;
|
24
25
|
type: string;
|
@@ -47,6 +48,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
47
48
|
action: import("@db/api").$Enums.OpportunityAction;
|
48
49
|
chainId: number;
|
49
50
|
depositUrl: string | null;
|
51
|
+
explorerAddress: string | null;
|
50
52
|
mainProtocolId: string | null;
|
51
53
|
tvl: number;
|
52
54
|
apr: number;
|
@@ -95,6 +97,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
95
97
|
})[];
|
96
98
|
mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
|
97
99
|
depositUrl: any;
|
100
|
+
explorerAddress: string | undefined;
|
98
101
|
tags: string[];
|
99
102
|
};
|
100
103
|
};
|
@@ -240,6 +243,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
240
243
|
action: import("@db/api").$Enums.OpportunityAction;
|
241
244
|
chainId: number;
|
242
245
|
depositUrl: string | null;
|
246
|
+
explorerAddress: string | null;
|
243
247
|
mainProtocolId: string | null;
|
244
248
|
tvl: number;
|
245
249
|
apr: number;
|
@@ -292,6 +296,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
292
296
|
identifier: string;
|
293
297
|
action: import("@db/api").$Enums.OpportunityAction;
|
294
298
|
chainId: number;
|
299
|
+
explorerAddress: string | null;
|
295
300
|
tvl: number;
|
296
301
|
dailyRewards: number;
|
297
302
|
}[];
|
@@ -946,6 +951,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
946
951
|
action: import("@db/api").$Enums.OpportunityAction;
|
947
952
|
chainId: number;
|
948
953
|
depositUrl: string | null;
|
954
|
+
explorerAddress: string | null;
|
949
955
|
mainProtocolId: string | null;
|
950
956
|
tvl: number;
|
951
957
|
apr: number;
|
@@ -329,6 +329,7 @@ export declare const CreateOpportunityDto: import("@sinclair/typebox").TObject<{
|
|
329
329
|
protocols: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
330
330
|
mainProtocol: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
331
331
|
depositUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
332
|
+
explorerAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
332
333
|
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
333
334
|
}>;
|
334
335
|
export declare const OpportunityAggregateFieldDto: import("@sinclair/typebox").TObject<{
|
@@ -100,6 +100,7 @@ export const CreateOpportunityDto = t.Object({
|
|
100
100
|
protocols: t.Optional(t.Array(t.String())),
|
101
101
|
mainProtocol: t.Optional(t.String()),
|
102
102
|
depositUrl: t.Optional(t.String()),
|
103
|
+
explorerAddress: t.Optional(t.String()),
|
103
104
|
tags: t.Optional(t.Array(t.String())),
|
104
105
|
});
|
105
106
|
export const OpportunityAggregateFieldDto = t.Object({
|
@@ -17,6 +17,7 @@ export declare abstract class OpportunityRepository {
|
|
17
17
|
action: import("@db/api").$Enums.OpportunityAction;
|
18
18
|
chainId: number;
|
19
19
|
depositUrl: string | null;
|
20
|
+
explorerAddress: string | null;
|
20
21
|
mainProtocolId: string | null;
|
21
22
|
tvl: number;
|
22
23
|
apr: number;
|
@@ -175,6 +176,7 @@ export declare abstract class OpportunityRepository {
|
|
175
176
|
action: import("@db/api").$Enums.OpportunityAction;
|
176
177
|
chainId: number;
|
177
178
|
depositUrl: string | null;
|
179
|
+
explorerAddress: string | null;
|
178
180
|
mainProtocolId: string | null;
|
179
181
|
tvl: number;
|
180
182
|
apr: number;
|
@@ -317,6 +319,7 @@ export declare abstract class OpportunityRepository {
|
|
317
319
|
action: import("@db/api").$Enums.OpportunityAction;
|
318
320
|
chainId: number;
|
319
321
|
depositUrl: string | null;
|
322
|
+
explorerAddress: string | null;
|
320
323
|
mainProtocolId: string | null;
|
321
324
|
tvl: number;
|
322
325
|
apr: number;
|
@@ -517,6 +520,7 @@ export declare abstract class OpportunityRepository {
|
|
517
520
|
action: import("@db/api").$Enums.OpportunityAction;
|
518
521
|
chainId: number;
|
519
522
|
depositUrl: string | null;
|
523
|
+
explorerAddress: string | null;
|
520
524
|
mainProtocolId: string | null;
|
521
525
|
tvl: number;
|
522
526
|
apr: number;
|
@@ -666,6 +670,7 @@ export declare abstract class OpportunityRepository {
|
|
666
670
|
action: import("@db/api").$Enums.OpportunityAction;
|
667
671
|
chainId: number;
|
668
672
|
depositUrl: string | null;
|
673
|
+
explorerAddress: string | null;
|
669
674
|
mainProtocolId: string | null;
|
670
675
|
tvl: number;
|
671
676
|
apr: number;
|
@@ -866,6 +871,7 @@ export declare abstract class OpportunityRepository {
|
|
866
871
|
action: import("@db/api").$Enums.OpportunityAction;
|
867
872
|
chainId: number;
|
868
873
|
depositUrl: string | null;
|
874
|
+
explorerAddress: string | null;
|
869
875
|
mainProtocolId: string | null;
|
870
876
|
tvl: number;
|
871
877
|
apr: number;
|
@@ -928,6 +934,7 @@ export declare abstract class OpportunityRepository {
|
|
928
934
|
action: import("@db/api").$Enums.OpportunityAction;
|
929
935
|
chainId: number;
|
930
936
|
depositUrl: string | null;
|
937
|
+
explorerAddress: string | null;
|
931
938
|
mainProtocolId: string | null;
|
932
939
|
tvl: number;
|
933
940
|
apr: number;
|
@@ -944,6 +951,7 @@ export declare abstract class OpportunityRepository {
|
|
944
951
|
action: import("@db/api").$Enums.OpportunityAction;
|
945
952
|
chainId: number;
|
946
953
|
depositUrl: string | null;
|
954
|
+
explorerAddress: string | null;
|
947
955
|
mainProtocolId: string | null;
|
948
956
|
tvl: number;
|
949
957
|
apr: number;
|
@@ -959,6 +967,7 @@ export declare abstract class OpportunityRepository {
|
|
959
967
|
action: import("@db/api").$Enums.OpportunityAction;
|
960
968
|
chainId: number;
|
961
969
|
depositUrl: string | null;
|
970
|
+
explorerAddress: string | null;
|
962
971
|
mainProtocolId: string | null;
|
963
972
|
tvl: number;
|
964
973
|
apr: number;
|
@@ -974,6 +983,7 @@ export declare abstract class OpportunityRepository {
|
|
974
983
|
action: import("@db/api").$Enums.OpportunityAction;
|
975
984
|
chainId: number;
|
976
985
|
depositUrl: string | null;
|
986
|
+
explorerAddress: string | null;
|
977
987
|
mainProtocolId: string | null;
|
978
988
|
tvl: number;
|
979
989
|
apr: number;
|
@@ -998,6 +1008,7 @@ export declare abstract class OpportunityRepository {
|
|
998
1008
|
action: import("@db/api").$Enums.OpportunityAction;
|
999
1009
|
chainId: number;
|
1000
1010
|
depositUrl: string | null;
|
1011
|
+
explorerAddress: string | null;
|
1001
1012
|
mainProtocolId: string | null;
|
1002
1013
|
tvl: number;
|
1003
1014
|
apr: number;
|