@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
@@ -1,4 +1,5 @@
|
|
1
1
|
import { ProtocolService } from "@/modules/v4/protocol/protocol.service";
|
2
|
+
import { log } from "@/utils/logger";
|
2
3
|
import { apiDbClient } from "@db";
|
3
4
|
import { Status } from "@db/api";
|
4
5
|
import moment from "moment";
|
@@ -151,6 +152,11 @@ export class OpportunityRepository {
|
|
151
152
|
if (mainProtocol.tags.includes("LENDING") && !!newOpp.name && newOpp.name.includes("Supply"))
|
152
153
|
newOpp.action = "LEND";
|
153
154
|
}
|
155
|
+
// Safety check on urls:
|
156
|
+
if (!!newOpp.depositUrl && !newOpp.depositUrl.includes("http")) {
|
157
|
+
newOpp.depositUrl = undefined;
|
158
|
+
log.warn(`deposit URL for opportunity ${newOpp.id} is not a valid URL`);
|
159
|
+
}
|
154
160
|
const toDisconnect = {
|
155
161
|
mainProtocol: "",
|
156
162
|
protocols: [],
|
@@ -182,6 +188,7 @@ export class OpportunityRepository {
|
|
182
188
|
status: newOpp.status,
|
183
189
|
type: newOpp.type,
|
184
190
|
depositUrl: newOpp.depositUrl,
|
191
|
+
explorerAddress: newOpp.explorerAddress,
|
185
192
|
Chain: { connect: { id: newOpp.chainId } },
|
186
193
|
MainProtocol: !!newOpp.mainProtocol ? { connect: { id: newOpp.mainProtocol } } : undefined,
|
187
194
|
Protocols: {
|
@@ -208,6 +215,7 @@ export class OpportunityRepository {
|
|
208
215
|
status: newOpp.status,
|
209
216
|
type: newOpp.type,
|
210
217
|
depositUrl: newOpp.depositUrl,
|
218
|
+
explorerAddress: newOpp.explorerAddress,
|
211
219
|
Chain: { connect: { id: newOpp.chainId } },
|
212
220
|
MainProtocol: !!newOpp.mainProtocol
|
213
221
|
? { connect: { id: newOpp.mainProtocol } }
|
@@ -21,6 +21,7 @@ export declare abstract class OpportunityService {
|
|
21
21
|
action: import("@db/api").$Enums.OpportunityAction;
|
22
22
|
chainId: number;
|
23
23
|
depositUrl: string | null;
|
24
|
+
explorerAddress: string | null;
|
24
25
|
mainProtocolId: string | null;
|
25
26
|
tvl: number;
|
26
27
|
apr: number;
|
@@ -56,6 +57,7 @@ export declare abstract class OpportunityService {
|
|
56
57
|
})[];
|
57
58
|
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;
|
58
59
|
depositUrl: any;
|
60
|
+
explorerAddress: string | undefined;
|
59
61
|
tags: string[];
|
60
62
|
}>;
|
61
63
|
static updateStatus(opportunityId: string, status: Status): Promise<{
|
@@ -68,6 +70,7 @@ export declare abstract class OpportunityService {
|
|
68
70
|
action: import("@db/api").$Enums.OpportunityAction;
|
69
71
|
chainId: number;
|
70
72
|
depositUrl: string | null;
|
73
|
+
explorerAddress: string | null;
|
71
74
|
mainProtocolId: string | null;
|
72
75
|
tvl: number;
|
73
76
|
apr: number;
|
@@ -101,6 +104,7 @@ export declare abstract class OpportunityService {
|
|
101
104
|
})[];
|
102
105
|
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;
|
103
106
|
depositUrl: any;
|
107
|
+
explorerAddress: string | undefined;
|
104
108
|
tags: string[];
|
105
109
|
}>;
|
106
110
|
static updateMetadata(chain: ChainId): Promise<void>;
|
@@ -497,6 +501,7 @@ export declare abstract class OpportunityService {
|
|
497
501
|
action: import("@db/api").$Enums.OpportunityAction;
|
498
502
|
chainId: number;
|
499
503
|
depositUrl: string | null;
|
504
|
+
explorerAddress: string | null;
|
500
505
|
mainProtocolId: string | null;
|
501
506
|
tvl: number;
|
502
507
|
apr: number;
|
@@ -549,6 +554,7 @@ export declare abstract class OpportunityService {
|
|
549
554
|
identifier: string;
|
550
555
|
action: import("@db/api").$Enums.OpportunityAction;
|
551
556
|
chainId: number;
|
557
|
+
explorerAddress: string | null;
|
552
558
|
tvl: number;
|
553
559
|
dailyRewards: number;
|
554
560
|
}[]>;
|
@@ -668,6 +674,7 @@ export declare abstract class OpportunityService {
|
|
668
674
|
action: import("@db/api").$Enums.OpportunityAction;
|
669
675
|
chainId: number;
|
670
676
|
depositUrl: string | null;
|
677
|
+
explorerAddress: string | null;
|
671
678
|
mainProtocolId: string | null;
|
672
679
|
tvl: number;
|
673
680
|
apr: number;
|
@@ -720,6 +727,7 @@ export declare abstract class OpportunityService {
|
|
720
727
|
identifier: string;
|
721
728
|
action: import("@db/api").$Enums.OpportunityAction;
|
722
729
|
chainId: number;
|
730
|
+
explorerAddress: string | null;
|
723
731
|
tvl: number;
|
724
732
|
dailyRewards: number;
|
725
733
|
}[]>;
|
@@ -835,6 +843,7 @@ export declare abstract class OpportunityService {
|
|
835
843
|
action: import("@db/api").$Enums.OpportunityAction;
|
836
844
|
chainId: number;
|
837
845
|
depositUrl: string | null;
|
846
|
+
explorerAddress: string | null;
|
838
847
|
mainProtocolId: string | null;
|
839
848
|
tvl: number;
|
840
849
|
apr: number;
|
@@ -887,6 +896,7 @@ export declare abstract class OpportunityService {
|
|
887
896
|
identifier: string;
|
888
897
|
action: import("@db/api").$Enums.OpportunityAction;
|
889
898
|
chainId: number;
|
899
|
+
explorerAddress: string | null;
|
890
900
|
tvl: number;
|
891
901
|
dailyRewards: number;
|
892
902
|
};
|
@@ -928,6 +938,7 @@ export declare abstract class OpportunityService {
|
|
928
938
|
identifier: string;
|
929
939
|
action: import("@db/api").$Enums.OpportunityAction;
|
930
940
|
chainId: number;
|
941
|
+
explorerAddress: string | null;
|
931
942
|
tvl: number;
|
932
943
|
apr: number;
|
933
944
|
dailyRewards: number;
|
@@ -951,6 +962,7 @@ export declare abstract class OpportunityService {
|
|
951
962
|
action: import("@db/api").$Enums.OpportunityAction;
|
952
963
|
chainId: number;
|
953
964
|
depositUrl: string | null;
|
965
|
+
explorerAddress: string | null;
|
954
966
|
mainProtocolId: string | null;
|
955
967
|
tvl: number;
|
956
968
|
apr: number;
|
@@ -17,7 +17,7 @@ export type Reward = Resource<"Reward", "rewardTokenId" | "id", {
|
|
17
17
|
* @description Describes one reward amount for one token and campaign
|
18
18
|
* @see {@link Resource}
|
19
19
|
*/
|
20
|
-
export type RewardBreakdown = Resource<"RewardBreakdown", "id" | "rewardId" | "protocolId" | "
|
20
|
+
export type RewardBreakdown = Resource<"RewardBreakdown", "id" | "rewardId" | "protocolId" | "uuid">;
|
21
21
|
/**
|
22
22
|
* Daily Rewards
|
23
23
|
* @description Describes rewards breakdown from the opportunity view
|
@@ -69,6 +69,7 @@ export declare abstract class RewardRepository {
|
|
69
69
|
action: import("@db/api").$Enums.OpportunityAction;
|
70
70
|
chainId: number;
|
71
71
|
depositUrl: string | null;
|
72
|
+
explorerAddress: string | null;
|
72
73
|
mainProtocolId: string | null;
|
73
74
|
tvl: number;
|
74
75
|
apr: number;
|
@@ -79,10 +80,9 @@ export declare abstract class RewardRepository {
|
|
79
80
|
pending: string;
|
80
81
|
id: number;
|
81
82
|
reason: string;
|
82
|
-
uuid: string
|
83
|
+
uuid: string;
|
83
84
|
campaignId: string;
|
84
85
|
amount: string;
|
85
|
-
stringId: string;
|
86
86
|
claimed: string;
|
87
87
|
protocolId: string | null;
|
88
88
|
rewardId: string;
|
@@ -106,10 +106,9 @@ export declare abstract class RewardRepository {
|
|
106
106
|
pending: string;
|
107
107
|
id: number;
|
108
108
|
reason: string;
|
109
|
-
uuid: string
|
109
|
+
uuid: string;
|
110
110
|
campaignId: string;
|
111
111
|
amount: string;
|
112
|
-
stringId: string;
|
113
112
|
claimed: string;
|
114
113
|
protocolId: string | null;
|
115
114
|
rewardId: string;
|
@@ -42,7 +42,6 @@ export class RewardRepository {
|
|
42
42
|
dataPerCampaign.breakdowns.map(breakdown => {
|
43
43
|
const rewardId = RewardService.hashId(dataPerCampaign.root, breakdown.recipient, TokenService.hashId({ address: dataPerCampaign.rewardToken, chainId: dataPerCampaign.distributionChainId }));
|
44
44
|
breakdownsToCreate.push({
|
45
|
-
stringId: RewardService.hashBreakdownId(rewardId, campaignId, breakdown.reason),
|
46
45
|
rewardId,
|
47
46
|
protocolId: breakdown.protocolId ? breakdown.protocolId : undefined,
|
48
47
|
campaignId,
|
@@ -118,6 +118,7 @@ export declare abstract class RewardService {
|
|
118
118
|
action: import("@db/api").$Enums.OpportunityAction;
|
119
119
|
chainId: number;
|
120
120
|
depositUrl: string | null;
|
121
|
+
explorerAddress: string | null;
|
121
122
|
mainProtocolId: string | null;
|
122
123
|
tvl: number;
|
123
124
|
apr: number;
|
@@ -170,6 +171,7 @@ export declare abstract class RewardService {
|
|
170
171
|
identifier: string;
|
171
172
|
action: import("@db/api").$Enums.OpportunityAction;
|
172
173
|
chainId: number;
|
174
|
+
explorerAddress: string | null;
|
173
175
|
tvl: number;
|
174
176
|
dailyRewards: number;
|
175
177
|
}, number>>;
|
@@ -231,6 +233,7 @@ export declare abstract class RewardService {
|
|
231
233
|
action: import("@db/api").$Enums.OpportunityAction;
|
232
234
|
chainId: number;
|
233
235
|
depositUrl: string | null;
|
236
|
+
explorerAddress: string | null;
|
234
237
|
mainProtocolId: string | null;
|
235
238
|
tvl: number;
|
236
239
|
apr: number;
|
@@ -311,6 +314,7 @@ export declare abstract class RewardService {
|
|
311
314
|
action: import("@db/api").$Enums.OpportunityAction;
|
312
315
|
chainId: number;
|
313
316
|
depositUrl: string | null;
|
317
|
+
explorerAddress: string | null;
|
314
318
|
mainProtocolId: string | null;
|
315
319
|
tvl: number;
|
316
320
|
apr: number;
|
@@ -395,6 +399,7 @@ export declare abstract class RewardService {
|
|
395
399
|
action: import("@db/api").$Enums.OpportunityAction;
|
396
400
|
chainId: number;
|
397
401
|
depositUrl: string | null;
|
402
|
+
explorerAddress: string | null;
|
398
403
|
mainProtocolId: string | null;
|
399
404
|
tvl: number;
|
400
405
|
apr: number;
|
@@ -405,10 +410,9 @@ export declare abstract class RewardService {
|
|
405
410
|
pending: string;
|
406
411
|
id: number;
|
407
412
|
reason: string;
|
408
|
-
uuid: string
|
413
|
+
uuid: string;
|
409
414
|
campaignId: string;
|
410
415
|
amount: string;
|
411
|
-
stringId: string;
|
412
416
|
claimed: string;
|
413
417
|
protocolId: string | null;
|
414
418
|
rewardId: string;
|
@@ -510,6 +514,7 @@ export declare abstract class RewardService {
|
|
510
514
|
action: import("@db/api").$Enums.OpportunityAction;
|
511
515
|
chainId: number;
|
512
516
|
depositUrl: string | null;
|
517
|
+
explorerAddress: string | null;
|
513
518
|
mainProtocolId: string | null;
|
514
519
|
tvl: number;
|
515
520
|
apr: number;
|
@@ -605,6 +610,7 @@ export declare abstract class RewardService {
|
|
605
610
|
action: import("@db/api").$Enums.OpportunityAction;
|
606
611
|
chainId: number;
|
607
612
|
depositUrl: string | null;
|
613
|
+
explorerAddress: string | null;
|
608
614
|
mainProtocolId: string | null;
|
609
615
|
tvl: number;
|
610
616
|
apr: number;
|
@@ -698,6 +704,7 @@ export declare abstract class RewardService {
|
|
698
704
|
action: import("@db/api").$Enums.OpportunityAction;
|
699
705
|
chainId: number;
|
700
706
|
depositUrl: string | null;
|
707
|
+
explorerAddress: string | null;
|
701
708
|
mainProtocolId: string | null;
|
702
709
|
tvl: number;
|
703
710
|
apr: number;
|
@@ -708,10 +715,9 @@ export declare abstract class RewardService {
|
|
708
715
|
pending: string;
|
709
716
|
id: number;
|
710
717
|
reason: string;
|
711
|
-
uuid: string
|
718
|
+
uuid: string;
|
712
719
|
campaignId: string;
|
713
720
|
amount: string;
|
714
|
-
stringId: string;
|
715
721
|
claimed: string;
|
716
722
|
protocolId: string | null;
|
717
723
|
rewardId: string;
|
@@ -79,7 +79,7 @@ export class RewardService {
|
|
79
79
|
* @returns a RewardBreakdown model
|
80
80
|
*/
|
81
81
|
static formatBreakdown(breakdown) {
|
82
|
-
const { Campaign, id,
|
82
|
+
const { Campaign, id, uuid, rewardId, protocolId, ...rest } = breakdown;
|
83
83
|
return {
|
84
84
|
...rest,
|
85
85
|
campaignId: Campaign.campaignId,
|
@@ -237,7 +237,7 @@ export class RewardService {
|
|
237
237
|
if (isBlacklisted)
|
238
238
|
return res;
|
239
239
|
/** Fetch current Merkle Roots */
|
240
|
-
const merkleRootsPromises = await Promise.allSettled(chainIds.map(chainId => MerklRootService.
|
240
|
+
const merkleRootsPromises = await Promise.allSettled(chainIds.map(chainId => MerklRootService.fetchFromCache(chainId)));
|
241
241
|
/** Filter out unsuccessful chainIds */
|
242
242
|
chainIds = chainIds.filter((_, index) => merkleRootsPromises[index].status === "fulfilled");
|
243
243
|
const merkleRoots = merkleRootsPromises
|
@@ -288,7 +288,7 @@ export class RewardService {
|
|
288
288
|
}
|
289
289
|
}
|
290
290
|
static async countOnChain(chainId) {
|
291
|
-
const roots = await MerklRootService.
|
291
|
+
const roots = await MerklRootService.fetchFromCache(chainId);
|
292
292
|
const promises = [
|
293
293
|
RewardRepository.countRewardAndBreakdownOnChain(chainId, roots.tree),
|
294
294
|
RewardRepository.countRewardAndBreakdownOnChain(chainId, roots.lastTree),
|
@@ -300,42 +300,42 @@ export class RewardService {
|
|
300
300
|
};
|
301
301
|
}
|
302
302
|
static async breakdownForCampaign(query) {
|
303
|
-
const root = await MerklRootService.
|
303
|
+
const root = await MerklRootService.fetchFromCache(query.chainId);
|
304
304
|
const id = CampaignService.hashId({ distributionChain: query.chainId, campaignId: query.campaignId });
|
305
305
|
return RewardRepository.breakdownForCampaign(root.live, id, query);
|
306
306
|
}
|
307
307
|
static async countForCampaign(query) {
|
308
|
-
const root = await MerklRootService.
|
308
|
+
const root = await MerklRootService.fetchFromCache(query.chainId);
|
309
309
|
const id = CampaignService.hashId({ distributionChain: query.chainId, campaignId: query.campaignId });
|
310
310
|
return RewardRepository.countForCampaign(id, root.live);
|
311
311
|
}
|
312
312
|
static async totalForCampaign(query) {
|
313
|
-
const root = await MerklRootService.
|
313
|
+
const root = await MerklRootService.fetchFromCache(query.chainId);
|
314
314
|
return RewardRepository.totalForCampaign(CampaignService.hashId({ distributionChain: query.chainId, campaignId: query.campaignId }), root.live);
|
315
315
|
}
|
316
316
|
static async breakdownForToken(query) {
|
317
317
|
return CacheService.wrap(TTLPresets.MIN_10, async (query) => {
|
318
|
-
const root = await MerklRootService.
|
318
|
+
const root = await MerklRootService.fetchFromCache(query.chainId);
|
319
319
|
const id = TokenService.hashId({ chainId: query.chainId, address: query.address });
|
320
320
|
return RewardRepository.breakdownForToken(root.live, id, query);
|
321
321
|
}, query);
|
322
322
|
}
|
323
323
|
static async countForToken(query) {
|
324
324
|
return CacheService.wrap(TTLPresets.MIN_10, async (query) => {
|
325
|
-
const root = await MerklRootService.
|
325
|
+
const root = await MerklRootService.fetchFromCache(query.chainId);
|
326
326
|
const id = TokenService.hashId({ chainId: query.chainId, address: query.address });
|
327
327
|
return RewardRepository.countForToken(id, root.live);
|
328
328
|
}, query);
|
329
329
|
}
|
330
330
|
static async totalForToken(query) {
|
331
331
|
return CacheService.wrap(TTLPresets.MIN_10, async (query) => {
|
332
|
-
const root = await MerklRootService.
|
332
|
+
const root = await MerklRootService.fetchFromCache(query.chainId);
|
333
333
|
const id = TokenService.hashId({ chainId: query.chainId, address: query.address });
|
334
334
|
return RewardRepository.totalForToken(id, root.live);
|
335
335
|
}, query);
|
336
336
|
}
|
337
337
|
static async getAmountAndClaimedForCampaigns(x) {
|
338
|
-
const currentRoot = await MerklRootService.
|
338
|
+
const currentRoot = await MerklRootService.fetchFromCache(x.chainId);
|
339
339
|
return await RewardRepository.getAmountAndClaimedForCampaigns(currentRoot.live, x);
|
340
340
|
}
|
341
341
|
static async getUnclaimed(x) {
|
@@ -34,6 +34,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
34
34
|
name?: string | undefined;
|
35
35
|
tags?: string[] | undefined;
|
36
36
|
depositUrl?: string | undefined;
|
37
|
+
explorerAddress?: string | undefined;
|
37
38
|
protocols?: string[] | undefined;
|
38
39
|
mainProtocol?: string | undefined;
|
39
40
|
type: string;
|
@@ -62,6 +63,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
62
63
|
action: import("@db/api").$Enums.OpportunityAction;
|
63
64
|
chainId: number;
|
64
65
|
depositUrl: string | null;
|
66
|
+
explorerAddress: string | null;
|
65
67
|
mainProtocolId: string | null;
|
66
68
|
tvl: number;
|
67
69
|
apr: number;
|
@@ -110,6 +112,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
110
112
|
})[];
|
111
113
|
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;
|
112
114
|
depositUrl: any;
|
115
|
+
explorerAddress: string | undefined;
|
113
116
|
tags: string[];
|
114
117
|
};
|
115
118
|
};
|
@@ -255,6 +258,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
255
258
|
action: import("@db/api").$Enums.OpportunityAction;
|
256
259
|
chainId: number;
|
257
260
|
depositUrl: string | null;
|
261
|
+
explorerAddress: string | null;
|
258
262
|
mainProtocolId: string | null;
|
259
263
|
tvl: number;
|
260
264
|
apr: number;
|
@@ -307,6 +311,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
307
311
|
identifier: string;
|
308
312
|
action: import("@db/api").$Enums.OpportunityAction;
|
309
313
|
chainId: number;
|
314
|
+
explorerAddress: string | null;
|
310
315
|
tvl: number;
|
311
316
|
dailyRewards: number;
|
312
317
|
}[];
|
@@ -961,6 +966,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
961
966
|
action: import("@db/api").$Enums.OpportunityAction;
|
962
967
|
chainId: number;
|
963
968
|
depositUrl: string | null;
|
969
|
+
explorerAddress: string | null;
|
964
970
|
mainProtocolId: string | null;
|
965
971
|
tvl: number;
|
966
972
|
apr: number;
|
@@ -1183,6 +1189,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1183
1189
|
})[];
|
1184
1190
|
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;
|
1185
1191
|
depositUrl: any;
|
1192
|
+
explorerAddress: string | undefined;
|
1186
1193
|
tags: string[];
|
1187
1194
|
};
|
1188
1195
|
};
|
@@ -1274,6 +1281,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1274
1281
|
action: import("@db/api").$Enums.OpportunityAction;
|
1275
1282
|
chainId: number;
|
1276
1283
|
depositUrl: string | null;
|
1284
|
+
explorerAddress: string | null;
|
1277
1285
|
mainProtocolId: string | null;
|
1278
1286
|
tvl: number;
|
1279
1287
|
apr: number;
|
@@ -1356,6 +1364,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1356
1364
|
action: import("@db/api").$Enums.OpportunityAction;
|
1357
1365
|
chainId: number;
|
1358
1366
|
depositUrl: string | null;
|
1367
|
+
explorerAddress: string | null;
|
1359
1368
|
mainProtocolId: string | null;
|
1360
1369
|
tvl: number;
|
1361
1370
|
apr: number;
|
@@ -1539,6 +1548,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1539
1548
|
action: import("@db/api").$Enums.OpportunityAction;
|
1540
1549
|
chainId: number;
|
1541
1550
|
depositUrl: string | null;
|
1551
|
+
explorerAddress: string | null;
|
1542
1552
|
mainProtocolId: string | null;
|
1543
1553
|
tvl: number;
|
1544
1554
|
apr: number;
|
@@ -2166,11 +2176,15 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2166
2176
|
data: {
|
2167
2177
|
properties: {
|
2168
2178
|
"Icon (Required)": {
|
2169
|
-
files: {
|
2179
|
+
files: ({
|
2170
2180
|
file: {
|
2171
2181
|
url: string;
|
2172
2182
|
};
|
2173
|
-
}
|
2183
|
+
} | {
|
2184
|
+
external: {
|
2185
|
+
url: string;
|
2186
|
+
};
|
2187
|
+
})[];
|
2174
2188
|
};
|
2175
2189
|
"Address (in checksum format) (Required)": {
|
2176
2190
|
rich_text: {
|
@@ -3218,6 +3232,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3218
3232
|
action: import("@db/api").$Enums.OpportunityAction;
|
3219
3233
|
chainId: number;
|
3220
3234
|
depositUrl: string | null;
|
3235
|
+
explorerAddress: string | null;
|
3221
3236
|
mainProtocolId: string | null;
|
3222
3237
|
tvl: number;
|
3223
3238
|
apr: number;
|
@@ -3335,6 +3350,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3335
3350
|
action: import("@db/api").$Enums.OpportunityAction;
|
3336
3351
|
chainId: number;
|
3337
3352
|
depositUrl: string | null;
|
3353
|
+
explorerAddress: string | null;
|
3338
3354
|
mainProtocolId: string | null;
|
3339
3355
|
tvl: number;
|
3340
3356
|
apr: number;
|
@@ -293,11 +293,15 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
293
293
|
data: {
|
294
294
|
properties: {
|
295
295
|
"Icon (Required)": {
|
296
|
-
files: {
|
296
|
+
files: ({
|
297
297
|
file: {
|
298
298
|
url: string;
|
299
299
|
};
|
300
|
-
}
|
300
|
+
} | {
|
301
|
+
external: {
|
302
|
+
url: string;
|
303
|
+
};
|
304
|
+
})[];
|
301
305
|
};
|
302
306
|
"Address (in checksum format) (Required)": {
|
303
307
|
rich_text: {
|
@@ -76,11 +76,15 @@ export declare const NotionWebhookDto: import("@sinclair/typebox").TObject<{
|
|
76
76
|
data: import("@sinclair/typebox").TObject<{
|
77
77
|
properties: import("@sinclair/typebox").TObject<{
|
78
78
|
"Icon (Required)": import("@sinclair/typebox").TObject<{
|
79
|
-
files: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
79
|
+
files: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
80
80
|
file: import("@sinclair/typebox").TObject<{
|
81
81
|
url: import("@sinclair/typebox").TString;
|
82
82
|
}>;
|
83
|
-
}
|
83
|
+
}>, import("@sinclair/typebox").TObject<{
|
84
|
+
external: import("@sinclair/typebox").TObject<{
|
85
|
+
url: import("@sinclair/typebox").TString;
|
86
|
+
}>;
|
87
|
+
}>]>>;
|
84
88
|
}>;
|
85
89
|
"Address (in checksum format) (Required)": import("@sinclair/typebox").TObject<{
|
86
90
|
rich_text: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
@@ -63,7 +63,12 @@ export const CreateTokenDto = t.Object({
|
|
63
63
|
export const NotionWebhookDto = t.Object({
|
64
64
|
data: t.Object({
|
65
65
|
properties: t.Object({
|
66
|
-
"Icon (Required)": t.Object({
|
66
|
+
"Icon (Required)": t.Object({
|
67
|
+
files: t.Array(t.Union([
|
68
|
+
t.Object({ file: t.Object({ url: t.String() }) }),
|
69
|
+
t.Object({ external: t.Object({ url: t.String() }) }),
|
70
|
+
])),
|
71
|
+
}),
|
67
72
|
"Address (in checksum format) (Required)": t.Object({
|
68
73
|
rich_text: t.Array(t.Object({ plain_text: t.String() })),
|
69
74
|
}),
|
@@ -290,7 +290,8 @@ export class TokenService {
|
|
290
290
|
const env = process.env.ENV === "prod" ? "production" : process.env.ENV;
|
291
291
|
const bucket = new BucketService(`merkl-${env}-tokens`, `angle-${env}-1`);
|
292
292
|
const properties = body.data.properties;
|
293
|
-
const
|
293
|
+
const file = properties["Icon (Required)"].files[0];
|
294
|
+
const icon = "external" in file ? file.external.url : file.file.url;
|
294
295
|
const iconFile = await fetch(icon);
|
295
296
|
const mimeType = iconFile.headers.get("content-type");
|
296
297
|
const extension = mimeType.split("/")[1].split("+")[0];
|
@@ -184,6 +184,7 @@ export declare const UserController: Elysia<"/users", false, {
|
|
184
184
|
action: import("@db/api").$Enums.OpportunityAction;
|
185
185
|
chainId: number;
|
186
186
|
depositUrl: string | null;
|
187
|
+
explorerAddress: string | null;
|
187
188
|
mainProtocolId: string | null;
|
188
189
|
tvl: number;
|
189
190
|
apr: number;
|
@@ -301,6 +302,7 @@ export declare const UserController: Elysia<"/users", false, {
|
|
301
302
|
action: import("@db/api").$Enums.OpportunityAction;
|
302
303
|
chainId: number;
|
303
304
|
depositUrl: string | null;
|
305
|
+
explorerAddress: string | null;
|
304
306
|
mainProtocolId: string | null;
|
305
307
|
tvl: number;
|
306
308
|
apr: number;
|