@merkl/api 0.10.421 → 0.11.0
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 +127 -0
- package/dist/database/api/.generated/drizzle/schema.js +13 -0
- package/dist/database/api/.generated/drizzle/schema.ts +15 -0
- package/dist/database/api/.generated/edge.js +28 -4
- package/dist/database/api/.generated/index-browser.js +25 -1
- package/dist/database/api/.generated/index.d.ts +1633 -205
- package/dist/database/api/.generated/index.js +28 -4
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +19 -0
- package/dist/database/api/.generated/wasm.js +25 -1
- package/dist/src/eden/index.d.ts +75 -115
- package/dist/src/index.d.ts +15 -23
- package/dist/src/index.js +1 -1
- package/dist/src/libs/campaigns/utils/getEulerV2Vaults.d.ts +5 -0
- package/dist/src/libs/campaigns/utils/getEulerV2Vaults.js +63 -4
- package/dist/src/libs/campaigns/utils/getUniswapV4Pools.js +72 -13
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -1
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +9 -9
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +1 -1
- package/dist/src/modules/v4/interaction/interaction.service.js +2 -3
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -3
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +5 -5
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +72 -72
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.controller.d.ts +4 -12
- package/dist/src/modules/v4/reward/reward.repository.d.ts +7 -11
- package/dist/src/modules/v4/reward/reward.service.d.ts +5 -10
- package/dist/src/modules/v4/router.d.ts +15 -23
- package/dist/src/modules/v4/status/status.controller.d.ts +6 -6
- package/dist/src/modules/v4/status/status.repository.d.ts +6 -6
- package/dist/src/modules/v4/status/status.service.d.ts +6 -6
- package/dist/src/modules/v4/token/token.repository.d.ts +2 -2
- package/dist/src/modules/v4/token/token.service.d.ts +3 -2
- package/dist/src/modules/v4/user/user.repository.d.ts +1 -1
- package/dist/src/modules/v4/user/user.service.d.ts +1 -1
- package/dist/src/utils/prisma.d.ts +3 -16
- package/dist/src/utils/prisma.js +1 -2
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
@@ -411,6 +411,7 @@ declare const app: Elysia<"", false, {
|
|
411
411
|
tags: string[];
|
412
412
|
icon: string;
|
413
413
|
} | null | undefined;
|
414
|
+
depositUrl?: string | undefined;
|
414
415
|
aprRecord?: {
|
415
416
|
timestamp: string | bigint;
|
416
417
|
cumulated: number;
|
@@ -422,7 +423,6 @@ declare const app: Elysia<"", false, {
|
|
422
423
|
aprRecordId: string;
|
423
424
|
}[];
|
424
425
|
} | undefined;
|
425
|
-
depositUrl?: string | undefined;
|
426
426
|
tvlRecord?: {
|
427
427
|
total: number;
|
428
428
|
timestamp: string | bigint;
|
@@ -535,6 +535,7 @@ declare const app: Elysia<"", false, {
|
|
535
535
|
tags: string[];
|
536
536
|
icon: string;
|
537
537
|
} | null | undefined;
|
538
|
+
depositUrl?: string | undefined;
|
538
539
|
aprRecord?: {
|
539
540
|
timestamp: string | bigint;
|
540
541
|
cumulated: number;
|
@@ -546,7 +547,6 @@ declare const app: Elysia<"", false, {
|
|
546
547
|
aprRecordId: string;
|
547
548
|
}[];
|
548
549
|
} | undefined;
|
549
|
-
depositUrl?: string | undefined;
|
550
550
|
tvlRecord?: {
|
551
551
|
total: number;
|
552
552
|
timestamp: string | bigint;
|
@@ -694,6 +694,7 @@ declare const app: Elysia<"", false, {
|
|
694
694
|
tags: string[];
|
695
695
|
icon: string;
|
696
696
|
} | null | undefined;
|
697
|
+
depositUrl?: string | undefined;
|
697
698
|
aprRecord?: {
|
698
699
|
timestamp: string | bigint;
|
699
700
|
cumulated: number;
|
@@ -705,7 +706,6 @@ declare const app: Elysia<"", false, {
|
|
705
706
|
aprRecordId: string;
|
706
707
|
}[];
|
707
708
|
} | undefined;
|
708
|
-
depositUrl?: string | undefined;
|
709
709
|
tvlRecord?: {
|
710
710
|
total: number;
|
711
711
|
timestamp: string | bigint;
|
@@ -1186,10 +1186,10 @@ declare const app: Elysia<"", false, {
|
|
1186
1186
|
response: {
|
1187
1187
|
200: {
|
1188
1188
|
endTimestamp: bigint;
|
1189
|
+
campaignId: string;
|
1189
1190
|
CampaignStatus: {
|
1190
1191
|
computedUntil: bigint;
|
1191
1192
|
}[];
|
1192
|
-
campaignId: string;
|
1193
1193
|
}[];
|
1194
1194
|
};
|
1195
1195
|
};
|
@@ -1706,12 +1706,8 @@ declare const app: Elysia<"", false, {
|
|
1706
1706
|
};
|
1707
1707
|
headers: unknown;
|
1708
1708
|
response: {
|
1709
|
-
|
1710
|
-
|
1711
|
-
claimed: string;
|
1712
|
-
pending: string;
|
1713
|
-
recipient: string;
|
1714
|
-
}[];
|
1709
|
+
[x: string]: any;
|
1710
|
+
200: any;
|
1715
1711
|
};
|
1716
1712
|
};
|
1717
1713
|
};
|
@@ -1775,12 +1771,8 @@ declare const app: Elysia<"", false, {
|
|
1775
1771
|
};
|
1776
1772
|
headers: unknown;
|
1777
1773
|
response: {
|
1778
|
-
|
1779
|
-
|
1780
|
-
claimed: string;
|
1781
|
-
pending: string;
|
1782
|
-
recipient: string;
|
1783
|
-
}[];
|
1774
|
+
[x: string]: any;
|
1775
|
+
200: any;
|
1784
1776
|
};
|
1785
1777
|
};
|
1786
1778
|
};
|
@@ -3097,13 +3089,13 @@ declare const app: Elysia<"", false, {
|
|
3097
3089
|
chainId?: number | undefined;
|
3098
3090
|
startTimestamp?: string | undefined;
|
3099
3091
|
endTimestamp?: string | undefined;
|
3100
|
-
campaignStatus?: {} | undefined;
|
3101
3092
|
distributionChainId?: number | undefined;
|
3102
3093
|
campaignId?: string | undefined;
|
3103
3094
|
rewardTokenId?: string | undefined;
|
3104
3095
|
amount?: string | undefined;
|
3105
3096
|
opportunityId?: string | undefined;
|
3106
3097
|
creatorAddress?: string | undefined;
|
3098
|
+
campaignStatus?: {} | undefined;
|
3107
3099
|
rewardToken?: {} | undefined;
|
3108
3100
|
rewardTokenAddress?: string | undefined;
|
3109
3101
|
distributionChain?: {} | undefined;
|
@@ -3277,6 +3269,12 @@ declare const app: Elysia<"", false, {
|
|
3277
3269
|
delayFormatted: string;
|
3278
3270
|
startTimestamp: bigint;
|
3279
3271
|
endTimestamp: bigint;
|
3272
|
+
computeChainId: number;
|
3273
|
+
distributionChainId: number;
|
3274
|
+
campaignId: string;
|
3275
|
+
Opportunity: {
|
3276
|
+
name: string;
|
3277
|
+
};
|
3280
3278
|
CampaignStatus: {
|
3281
3279
|
error: string;
|
3282
3280
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
@@ -3285,12 +3283,6 @@ declare const app: Elysia<"", false, {
|
|
3285
3283
|
computedUntil: bigint;
|
3286
3284
|
processingStarted: bigint;
|
3287
3285
|
}[];
|
3288
|
-
Opportunity: {
|
3289
|
-
name: string;
|
3290
|
-
};
|
3291
|
-
computeChainId: number;
|
3292
|
-
distributionChainId: number;
|
3293
|
-
campaignId: string;
|
3294
3286
|
}[];
|
3295
3287
|
};
|
3296
3288
|
};
|
package/dist/src/index.js
CHANGED
@@ -95,7 +95,7 @@ const app = new Elysia({
|
|
95
95
|
.use(v4)
|
96
96
|
.use(v3)
|
97
97
|
.use(errorHandler())
|
98
|
-
.listen(PORT, ({ hostname, port }) => {
|
98
|
+
.listen({ port: PORT, idleTimeout: 40 }, ({ hostname, port }) => {
|
99
99
|
log.info(`🌐 Api started (${hostname}:${port})`);
|
100
100
|
});
|
101
101
|
// ─── Signal Handling ─────────────────────────────────────────────────────────
|
@@ -1,10 +1,15 @@
|
|
1
1
|
import { type MerklChainId } from "@sdk";
|
2
|
+
export declare enum LoggedEntityType {
|
3
|
+
EULER = "EULER_VAULT",
|
4
|
+
UNISWAP_V4 = "UNISWAP_V4"
|
5
|
+
}
|
2
6
|
export type EulerVaultType = {
|
3
7
|
address: string;
|
4
8
|
asset: string;
|
5
9
|
chainId: MerklChainId;
|
6
10
|
debtTokenAddress: string;
|
7
11
|
name: string;
|
12
|
+
fetchedAtBlock: number;
|
8
13
|
collaterals: {
|
9
14
|
address: string;
|
10
15
|
borrowLTV: string;
|
@@ -1,17 +1,42 @@
|
|
1
1
|
import { Redis } from "../../../cache";
|
2
2
|
import { batchMulticallCallWithRetry } from "../../../utils/generic";
|
3
3
|
import { log } from "../../../utils/logger";
|
4
|
+
import { apiDbClient } from "../../../utils/prisma";
|
4
5
|
import { providers } from "../../../utils/providers";
|
5
|
-
import { ERC20Interface, EULER_ADDRESSES,
|
6
|
+
import { ChainInteractionService, ERC20Interface, EULER_ADDRESSES, EulerEVKInterface, EulerVaultLensInterface, EulerVault__factory, NETWORK_LABELS, eulerChainIds, getContractCreationBlock, } from "@sdk";
|
6
7
|
import { getAddress } from "ethers/lib/utils";
|
7
8
|
import { fetchEulerVaultName } from "../campaignTypes/ERC20SubTypes/helpers/eulerVaultNames";
|
8
9
|
import { safeFetchLogs } from "./fetchLogs";
|
10
|
+
export var LoggedEntityType;
|
11
|
+
(function (LoggedEntityType) {
|
12
|
+
LoggedEntityType["EULER"] = "EULER_VAULT";
|
13
|
+
LoggedEntityType["UNISWAP_V4"] = "UNISWAP_V4";
|
14
|
+
})(LoggedEntityType || (LoggedEntityType = {}));
|
9
15
|
async function getEulerV2Vaults() {
|
10
16
|
let vaults = [];
|
11
|
-
|
17
|
+
// 0_ Fetch all euler vaults from database
|
18
|
+
const storedVaults = await apiDbClient.logged.findMany({
|
19
|
+
where: { type: LoggedEntityType.EULER },
|
20
|
+
});
|
21
|
+
const res = await Promise.all(eulerChainIds.map(async (chainId) => {
|
22
|
+
let vaultsPerChain = [];
|
23
|
+
chainId = chainId;
|
12
24
|
try {
|
13
|
-
|
25
|
+
// 1_ Get latest euler vaults from chain
|
26
|
+
const storedVaultsPerChain = storedVaults.filter(vault => vault.chainId === chainId);
|
27
|
+
log.info(`found ${storedVaultsPerChain.length} already stored vaults on ${NETWORK_LABELS[chainId]}`);
|
28
|
+
let fromBlock;
|
29
|
+
if (storedVaultsPerChain.length > 0) {
|
30
|
+
fromBlock = Math.max(...storedVaultsPerChain.map(vault => vault.fetchAtBlock)) + 1;
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
fromBlock = await getContractCreationBlock(EULER_ADDRESSES[chainId].VAULT_FACTORY, ChainInteractionService(chainId).provider());
|
34
|
+
}
|
14
35
|
const toBlock = await providers[chainId].getBlockNumber();
|
36
|
+
// Check
|
37
|
+
if (fromBlock >= toBlock) {
|
38
|
+
throw new Error(`fromBlock ${fromBlock} is greater than toBlock ${toBlock}`);
|
39
|
+
}
|
15
40
|
const logs = await safeFetchLogs(chainId, [EulerEVKInterface.getEventTopic("EVaultCreated")], [], fromBlock, toBlock);
|
16
41
|
const decodedVaults = await Promise.all(logs.map(async (log) => {
|
17
42
|
const aux = EulerEVKInterface.decodeEventLog("EVaultCreated", log.data, log.topics);
|
@@ -21,6 +46,7 @@ async function getEulerV2Vaults() {
|
|
21
46
|
return {
|
22
47
|
address: log.address.toString(),
|
23
48
|
asset: aux[1].toString(),
|
49
|
+
fetchedAtBlock: Number(log.blockNumber),
|
24
50
|
chainId: chainId,
|
25
51
|
debtTokenAddress: aux[2].toString(),
|
26
52
|
name: vaultName,
|
@@ -67,7 +93,7 @@ async function getEulerV2Vaults() {
|
|
67
93
|
const resCollatUnderlyingSymbol = await batchMulticallCallWithRetry(chainId, {
|
68
94
|
calls: callsCollatUnderlyingSymbol,
|
69
95
|
});
|
70
|
-
|
96
|
+
vaultsPerChain = vaultsPerChain.concat((await Promise.all(decodedVaults.map(async (decodedVault, index) => {
|
71
97
|
const collatArray = EulerVaultLensInterface.decodeFunctionResult("getRecognizedCollateralsLTVInfo", resCollat[index].returnData)[0];
|
72
98
|
const collaterals = [];
|
73
99
|
for (const [_index, collat] of collatArray.entries()) {
|
@@ -82,11 +108,44 @@ async function getEulerV2Vaults() {
|
|
82
108
|
}
|
83
109
|
return { ...decodedVault, collaterals };
|
84
110
|
}))));
|
111
|
+
return vaultsPerChain;
|
85
112
|
}
|
86
113
|
catch (e) {
|
87
114
|
log.error(`issue when fetching vaults on ${NETWORK_LABELS[chainId]}`, e);
|
88
115
|
}
|
116
|
+
return vaultsPerChain;
|
117
|
+
}));
|
118
|
+
for (const resPerChain of res) {
|
119
|
+
if (!!resPerChain && resPerChain.length > 0) {
|
120
|
+
vaults = vaults.concat(resPerChain);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
// Update the API database
|
124
|
+
if (vaults.length > 0) {
|
125
|
+
try {
|
126
|
+
await apiDbClient.logged.createMany({
|
127
|
+
data: vaults.map(vault => ({
|
128
|
+
fetchAtBlock: vault.fetchedAtBlock,
|
129
|
+
caughtFromAddress: EULER_ADDRESSES[vault.chainId].VAULT_FACTORY,
|
130
|
+
chainId: vault.chainId,
|
131
|
+
address: vault.address,
|
132
|
+
entityData: vault,
|
133
|
+
id: Bun.hash(`${vault.address}-${vault.chainId}`).toString(),
|
134
|
+
type: LoggedEntityType.EULER,
|
135
|
+
})),
|
136
|
+
});
|
137
|
+
log.info(`✅ successfully saved ${vaults.length} new vault(s) to API database ('Logged' table)`);
|
138
|
+
}
|
139
|
+
catch {
|
140
|
+
throw new Error("Error while saving vaults to API database (`Logged` table)");
|
141
|
+
}
|
142
|
+
}
|
143
|
+
log.info("✅ successfully fetched vaults on Euler V2");
|
144
|
+
// FIXME _ Merge previoulsy stored vaults with newly fetched ones
|
145
|
+
if (storedVaults.length > 0) {
|
146
|
+
vaults = vaults.concat(storedVaults.map(v => v.entityData));
|
89
147
|
}
|
148
|
+
log.info("👋 exiting getEulerV2Vaults");
|
90
149
|
return vaults;
|
91
150
|
}
|
92
151
|
export const getEulerV2VaultsWithCache = async () => await Redis.getOrSet("EulerV2Vaults", getEulerV2Vaults);
|
@@ -1,18 +1,33 @@
|
|
1
1
|
import { Redis } from "../../../cache";
|
2
2
|
import { log } from "../../../utils/logger";
|
3
|
+
import { apiDbClient } from "../../../utils/prisma";
|
3
4
|
import { providers } from "../../../utils/providers";
|
4
5
|
import { ChainInteractionService, ERC20Interface, NETWORK_LABELS, NULL_ADDRESS, PoolManagerInterface, UniswapV4Addresses, getContractCreationBlock, } from "@sdk";
|
5
6
|
import { safeFetchLogs } from "./fetchLogs";
|
7
|
+
import { LoggedEntityType } from "./getEulerV2Vaults";
|
6
8
|
const UNIV4_CHAINIDS = Object.keys(UniswapV4Addresses).map((x) => Number(x));
|
7
9
|
async function getUniswapV4Pools() {
|
8
10
|
const pools = {};
|
11
|
+
// 0_ Fetch all euler vaults from database
|
12
|
+
const storedPools = await apiDbClient.logged.findMany({
|
13
|
+
where: { type: LoggedEntityType.UNISWAP_V4 },
|
14
|
+
});
|
9
15
|
const res = await Promise.all(UNIV4_CHAINIDS.map(async (chainId) => {
|
10
16
|
chainId = chainId;
|
11
17
|
const perChainIdRes = {};
|
12
18
|
const poolManagerAddress = UniswapV4Addresses[chainId]?.PoolManager ?? NULL_ADDRESS;
|
13
19
|
const jsonRPCprovider = providers[chainId];
|
14
20
|
try {
|
15
|
-
|
21
|
+
// 1_ Get latest euler vaults from chain
|
22
|
+
const storedPoolsPerChain = storedPools.filter(pool => pool.chainId === chainId);
|
23
|
+
log.info(`found ${storedPoolsPerChain.length} already stored vaults on ${NETWORK_LABELS[chainId]}`);
|
24
|
+
let fromBlock;
|
25
|
+
if (storedPoolsPerChain.length > 0) {
|
26
|
+
fromBlock = Math.max(...storedPools.map(x => x.fetchAtBlock)) + 1;
|
27
|
+
}
|
28
|
+
else {
|
29
|
+
fromBlock = await getContractCreationBlock(poolManagerAddress, jsonRPCprovider);
|
30
|
+
}
|
16
31
|
const toBlock = await jsonRPCprovider.getBlockNumber();
|
17
32
|
const logs = await safeFetchLogs(chainId, // TODO: rm type enforcing
|
18
33
|
[PoolManagerInterface.getEventTopic("Initialize")], [poolManagerAddress], fromBlock, toBlock);
|
@@ -27,7 +42,7 @@ async function getUniswapV4Pools() {
|
|
27
42
|
tickSpacing: tickSpacing,
|
28
43
|
lpFee: fee,
|
29
44
|
hooks: hooks,
|
30
|
-
|
45
|
+
fetchedAtBlock: Number(log.blockNumber),
|
31
46
|
};
|
32
47
|
}));
|
33
48
|
log.local(`fetched ${decodedPools.length} pool(s) on ${NETWORK_LABELS[chainId] ?? "Sepolia"} between blocks ${fromBlock} and ${toBlock}`);
|
@@ -58,22 +73,32 @@ async function getUniswapV4Pools() {
|
|
58
73
|
}));
|
59
74
|
let index = 0;
|
60
75
|
for (const pool of decodedPools) {
|
61
|
-
let symbolCurrency0;
|
62
|
-
let decimalsCurrency0;
|
76
|
+
let symbolCurrency0 = "UNKNOWN";
|
77
|
+
let decimalsCurrency0 = 18;
|
63
78
|
if (pool.currency0 !== NULL_ADDRESS) {
|
64
|
-
|
65
|
-
|
79
|
+
try {
|
80
|
+
symbolCurrency0 = ERC20Interface.decodeFunctionResult("symbol", resCurrencies[index].returnData)[0];
|
81
|
+
decimalsCurrency0 = ERC20Interface.decodeFunctionResult("decimals", resCurrencies[index + 1].returnData)[0];
|
82
|
+
}
|
83
|
+
catch {
|
84
|
+
log.error("getUniswapV4Pools", `issue when fetching symbol / decimals for currency0 ${pool.currency0} of pool ${pool.poolId} on ${NETWORK_LABELS[chainId]}`);
|
85
|
+
}
|
66
86
|
}
|
67
87
|
else {
|
68
88
|
symbolCurrency0 = "ETH";
|
69
89
|
decimalsCurrency0 = 18;
|
70
90
|
index -= 2;
|
71
91
|
}
|
72
|
-
let symbolCurrency1;
|
73
|
-
let decimalsCurrency1;
|
92
|
+
let symbolCurrency1 = "UNKNOWN";
|
93
|
+
let decimalsCurrency1 = 18;
|
74
94
|
if (pool.currency1 !== NULL_ADDRESS) {
|
75
|
-
|
76
|
-
|
95
|
+
try {
|
96
|
+
symbolCurrency1 = ERC20Interface.decodeFunctionResult("symbol", resCurrencies[index + 2].returnData)[0];
|
97
|
+
decimalsCurrency1 = ERC20Interface.decodeFunctionResult("decimals", resCurrencies[index + 3].returnData)[0];
|
98
|
+
}
|
99
|
+
catch {
|
100
|
+
log.error("getUniswapV4Pools", `issue when fetching symbol / decimals for currency1 ${pool.currency1} of pool ${pool.poolId} on ${NETWORK_LABELS[chainId]}`);
|
101
|
+
}
|
77
102
|
}
|
78
103
|
else {
|
79
104
|
symbolCurrency1 = "ETH";
|
@@ -88,7 +113,7 @@ async function getUniswapV4Pools() {
|
|
88
113
|
decimalsCurrency0,
|
89
114
|
decimalsCurrency1,
|
90
115
|
hooks: pool.hooks,
|
91
|
-
|
116
|
+
fetchedAtBlock: pool.fetchedAtBlock,
|
92
117
|
lpFee: pool.lpFee,
|
93
118
|
poolId: id,
|
94
119
|
poolKey: pool.poolKey,
|
@@ -105,9 +130,43 @@ async function getUniswapV4Pools() {
|
|
105
130
|
return perChainIdRes;
|
106
131
|
}));
|
107
132
|
UNIV4_CHAINIDS.forEach((chainId, i) => {
|
108
|
-
|
133
|
+
if (!!res[i])
|
134
|
+
pools[chainId] = res[i];
|
109
135
|
});
|
110
|
-
|
136
|
+
// Update the API database
|
137
|
+
const tableData = Object.values(pools).flatMap(pools => Object.values(pools));
|
138
|
+
if (Object.values(pools).length > 0) {
|
139
|
+
try {
|
140
|
+
await apiDbClient.logged.createMany({
|
141
|
+
data: tableData.map(pool => ({
|
142
|
+
fetchAtBlock: pool.fetchedAtBlock,
|
143
|
+
caughtFromAddress: UniswapV4Addresses[pool.chainId]?.PoolManager ?? NULL_ADDRESS,
|
144
|
+
chainId: pool.chainId,
|
145
|
+
entityData: pool,
|
146
|
+
id: Bun.hash(`${pool.poolId}-${pool.chainId}`).toString(),
|
147
|
+
type: LoggedEntityType.UNISWAP_V4,
|
148
|
+
})),
|
149
|
+
});
|
150
|
+
log.info("✅ successfully saved vaults to API database (`Logged` table)");
|
151
|
+
// }
|
152
|
+
}
|
153
|
+
catch (e) {
|
154
|
+
log.error("getUniswapV4Pools/LoggedTableUpdate", e);
|
155
|
+
throw new Error("Error while saving UniV4 pools to API database (`Logged` table)");
|
156
|
+
}
|
157
|
+
}
|
158
|
+
log.info(`✅ successfully fetched ${tableData.length} new pool(s) on UniswapV4`);
|
159
|
+
// _ Merge previoulsy stored pools with newly fetched ones
|
160
|
+
// TODO optimize this part
|
161
|
+
if (storedPools.length > 0) {
|
162
|
+
for (const pool of storedPools) {
|
163
|
+
const chainId = pool.chainId;
|
164
|
+
if (!pools[chainId])
|
165
|
+
pools[chainId] = {};
|
166
|
+
pools[chainId][pool.entityData.poolId] = pool.entityData;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
log.info("👋 exiting getUniswapV4Pools");
|
111
170
|
return pools;
|
112
171
|
}
|
113
172
|
export const getUniswapV4PoolsWithCache = async () => await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools);
|
@@ -222,10 +222,10 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
222
222
|
response: {
|
223
223
|
200: {
|
224
224
|
endTimestamp: bigint;
|
225
|
+
campaignId: string;
|
225
226
|
CampaignStatus: {
|
226
227
|
computedUntil: bigint;
|
227
228
|
}[];
|
228
|
-
campaignId: string;
|
229
229
|
}[];
|
230
230
|
};
|
231
231
|
};
|
@@ -141,20 +141,12 @@ export declare abstract class CampaignRepository {
|
|
141
141
|
}>;
|
142
142
|
static findCampaignsToProcess(distributionChainId: ChainId): Promise<{
|
143
143
|
endTimestamp: bigint;
|
144
|
+
campaignId: string;
|
144
145
|
CampaignStatus: {
|
145
146
|
computedUntil: bigint;
|
146
147
|
}[];
|
147
|
-
campaignId: string;
|
148
148
|
}[]>;
|
149
149
|
static findMany(query: GetCampaignQueryModel): Promise<({
|
150
|
-
CampaignStatus: {
|
151
|
-
error: string;
|
152
|
-
details: Prisma.JsonValue;
|
153
|
-
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
154
|
-
campaignId: string;
|
155
|
-
computedUntil: bigint;
|
156
|
-
processingStarted: bigint;
|
157
|
-
}[];
|
158
150
|
ComputeChain: {
|
159
151
|
name: string;
|
160
152
|
id: number;
|
@@ -178,6 +170,14 @@ export declare abstract class CampaignRepository {
|
|
178
170
|
isTest: boolean;
|
179
171
|
price: number | null;
|
180
172
|
};
|
173
|
+
CampaignStatus: {
|
174
|
+
error: string;
|
175
|
+
details: Prisma.JsonValue;
|
176
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
177
|
+
campaignId: string;
|
178
|
+
computedUntil: bigint;
|
179
|
+
processingStarted: bigint;
|
180
|
+
}[];
|
181
181
|
} & {
|
182
182
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
183
183
|
id: string;
|
@@ -132,10 +132,10 @@ export declare abstract class CampaignService {
|
|
132
132
|
}>;
|
133
133
|
static findCampaignsToProcess(distributionChainId: ChainId): Promise<{
|
134
134
|
endTimestamp: bigint;
|
135
|
+
campaignId: string;
|
135
136
|
CampaignStatus: {
|
136
137
|
computedUntil: bigint;
|
137
138
|
}[];
|
138
|
-
campaignId: string;
|
139
139
|
}[]>;
|
140
140
|
static pickCampaignToProcess(chainId: ChainId): Promise<string>;
|
141
141
|
static fill(campaigns: CampaignUnique[]): Promise<{
|
@@ -51,13 +51,13 @@ export declare const DynamicDataController: Elysia<"/dynamic-data", false, {
|
|
51
51
|
chainId?: number | undefined;
|
52
52
|
startTimestamp?: string | undefined;
|
53
53
|
endTimestamp?: string | undefined;
|
54
|
-
campaignStatus?: {} | undefined;
|
55
54
|
distributionChainId?: number | undefined;
|
56
55
|
campaignId?: string | undefined;
|
57
56
|
rewardTokenId?: string | undefined;
|
58
57
|
amount?: string | undefined;
|
59
58
|
opportunityId?: string | undefined;
|
60
59
|
creatorAddress?: string | undefined;
|
60
|
+
campaignStatus?: {} | undefined;
|
61
61
|
rewardToken?: {} | undefined;
|
62
62
|
rewardTokenAddress?: string | undefined;
|
63
63
|
distributionChain?: {} | undefined;
|
@@ -49,12 +49,11 @@ export class InteractionService {
|
|
49
49
|
}
|
50
50
|
static async getTargets(chainId, protocolId, identifier) {
|
51
51
|
const targets = [];
|
52
|
-
const ensoTarget = await InteractionService.getTargetFromEnso(chainId, protocolId, identifier);
|
52
|
+
// const ensoTarget = await InteractionService.getTargetFromEnso(chainId, protocolId, identifier);
|
53
53
|
const zapTarget = InteractionService.getTargetFromKyberZap(chainId, protocolId, identifier);
|
54
54
|
if (zapTarget)
|
55
55
|
targets.push(zapTarget);
|
56
|
-
if (ensoTarget)
|
57
|
-
targets.push(ensoTarget);
|
56
|
+
// if (ensoTarget) targets.push(ensoTarget);
|
58
57
|
return targets;
|
59
58
|
}
|
60
59
|
/**
|
@@ -266,6 +266,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
266
266
|
tags: string[];
|
267
267
|
icon: string;
|
268
268
|
} | null | undefined;
|
269
|
+
depositUrl?: string | undefined;
|
269
270
|
aprRecord?: {
|
270
271
|
timestamp: string | bigint;
|
271
272
|
cumulated: number;
|
@@ -277,7 +278,6 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
277
278
|
aprRecordId: string;
|
278
279
|
}[];
|
279
280
|
} | undefined;
|
280
|
-
depositUrl?: string | undefined;
|
281
281
|
tvlRecord?: {
|
282
282
|
total: number;
|
283
283
|
timestamp: string | bigint;
|
@@ -390,6 +390,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
390
390
|
tags: string[];
|
391
391
|
icon: string;
|
392
392
|
} | null | undefined;
|
393
|
+
depositUrl?: string | undefined;
|
393
394
|
aprRecord?: {
|
394
395
|
timestamp: string | bigint;
|
395
396
|
cumulated: number;
|
@@ -401,7 +402,6 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
401
402
|
aprRecordId: string;
|
402
403
|
}[];
|
403
404
|
} | undefined;
|
404
|
-
depositUrl?: string | undefined;
|
405
405
|
tvlRecord?: {
|
406
406
|
total: number;
|
407
407
|
timestamp: string | bigint;
|
@@ -549,6 +549,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
549
549
|
tags: string[];
|
550
550
|
icon: string;
|
551
551
|
} | null | undefined;
|
552
|
+
depositUrl?: string | undefined;
|
552
553
|
aprRecord?: {
|
553
554
|
timestamp: string | bigint;
|
554
555
|
cumulated: number;
|
@@ -560,7 +561,6 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
560
561
|
aprRecordId: string;
|
561
562
|
}[];
|
562
563
|
} | undefined;
|
563
|
-
depositUrl?: string | undefined;
|
564
564
|
tvlRecord?: {
|
565
565
|
total: number;
|
566
566
|
timestamp: string | bigint;
|
@@ -165,6 +165,11 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
|
|
165
165
|
icon: import("@sinclair/typebox").TString;
|
166
166
|
}>;
|
167
167
|
chainId: import("@sinclair/typebox").TNumber;
|
168
|
+
action: import("@sinclair/typebox").TString;
|
169
|
+
depositUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
170
|
+
tvl: import("@sinclair/typebox").TNumber;
|
171
|
+
apr: import("@sinclair/typebox").TNumber;
|
172
|
+
dailyRewards: import("@sinclair/typebox").TNumber;
|
168
173
|
aprRecord: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
169
174
|
cumulated: import("@sinclair/typebox").TNumber;
|
170
175
|
timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
@@ -180,11 +185,6 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
|
|
180
185
|
aprRecordId: import("@sinclair/typebox").TString;
|
181
186
|
}>>;
|
182
187
|
}>>;
|
183
|
-
action: import("@sinclair/typebox").TString;
|
184
|
-
depositUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
185
|
-
tvl: import("@sinclair/typebox").TNumber;
|
186
|
-
apr: import("@sinclair/typebox").TNumber;
|
187
|
-
dailyRewards: import("@sinclair/typebox").TNumber;
|
188
188
|
tvlRecord: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
189
189
|
total: import("@sinclair/typebox").TNumber;
|
190
190
|
timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|