@merkl/api 0.12.3 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/backgroundJobs/index.js +9 -0
- package/dist/src/cache/declaration.d.ts +1 -1
- package/dist/src/cache/declaration.js +1 -1
- package/dist/src/libs/campaigns/utils/getEulerV2Vaults.d.ts +1 -0
- package/dist/src/libs/campaigns/utils/getEulerV2Vaults.js +1 -1
- package/dist/src/libs/campaigns/utils/getUniswapV4Pools.d.ts +1 -0
- package/dist/src/libs/campaigns/utils/getUniswapV4Pools.js +4 -4
- package/dist/src/routes/v3/euler.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1,4 +1,7 @@
|
|
1
|
+
import { Redis } from "../cache";
|
1
2
|
import { redisClient } from "../cache/redis";
|
3
|
+
import { getEulerV2Vaults } from "../libs/campaigns/utils/getEulerV2Vaults";
|
4
|
+
import { getUniswapV4Pools } from "../libs/campaigns/utils/getUniswapV4Pools";
|
2
5
|
import { DungeonKeeperController } from "../modules/v4/dungeonKeeper";
|
3
6
|
import { log } from "../utils/logger";
|
4
7
|
import { engineDbClient } from "../utils/prisma";
|
@@ -25,6 +28,12 @@ new Elysia({
|
|
25
28
|
.use(priceUpdater) // /v3/updatePrices
|
26
29
|
.use(healthCheck) // /v3/health
|
27
30
|
.use(sync) // GET /jobs/api/sync-with-engine
|
31
|
+
.get("/eulerUpdate", async () => {
|
32
|
+
await Redis.safeSet("EulerV2Vaults", getEulerV2Vaults);
|
33
|
+
})
|
34
|
+
.get("/uniswapv4Update", async () => {
|
35
|
+
await Redis.safeSet("UniswapV4Pools", getUniswapV4Pools);
|
36
|
+
})
|
28
37
|
.group("/v4", app => {
|
29
38
|
return app.use(DungeonKeeperController);
|
30
39
|
})
|
@@ -12,7 +12,7 @@ export var LoggedEntityType;
|
|
12
12
|
LoggedEntityType["EULER"] = "EULER_VAULT";
|
13
13
|
LoggedEntityType["UNISWAP_V4"] = "UNISWAP_V4";
|
14
14
|
})(LoggedEntityType || (LoggedEntityType = {}));
|
15
|
-
async function getEulerV2Vaults() {
|
15
|
+
export async function getEulerV2Vaults() {
|
16
16
|
let vaults = [];
|
17
17
|
// 0_ Fetch all euler vaults from database
|
18
18
|
const storedVaults = await apiDbClient.logged.findMany({
|
@@ -2,11 +2,11 @@ import { Redis } from "../../../cache";
|
|
2
2
|
import { log } from "../../../utils/logger";
|
3
3
|
import { apiDbClient } from "../../../utils/prisma";
|
4
4
|
import { providers } from "../../../utils/providers";
|
5
|
-
import { ChainInteractionService, ERC20Interface, NETWORK_LABELS, NULL_ADDRESS,
|
5
|
+
import { ChainInteractionService, ERC20Interface, NETWORK_LABELS, NULL_ADDRESS, UniswapV4Addresses, UniswapV4PoolManagerInterface, getContractCreationBlock, } from "@sdk";
|
6
6
|
import { safeFetchLogs } from "./fetchLogs";
|
7
7
|
import { LoggedEntityType } from "./getEulerV2Vaults";
|
8
8
|
const UNIV4_CHAINIDS = Object.keys(UniswapV4Addresses).map((x) => Number(x));
|
9
|
-
async function getUniswapV4Pools() {
|
9
|
+
export async function getUniswapV4Pools() {
|
10
10
|
const pools = {};
|
11
11
|
// 0_ Fetch all euler vaults from database
|
12
12
|
const storedPools = await apiDbClient.logged.findMany({
|
@@ -30,9 +30,9 @@ async function getUniswapV4Pools() {
|
|
30
30
|
}
|
31
31
|
const toBlock = await jsonRPCprovider.getBlockNumber();
|
32
32
|
const logs = await safeFetchLogs(chainId, // TODO: rm type enforcing
|
33
|
-
[
|
33
|
+
[UniswapV4PoolManagerInterface.getEventTopic("Initialize")], [poolManagerAddress], fromBlock, toBlock);
|
34
34
|
const decodedPools = await Promise.all(logs.map(async (log) => {
|
35
|
-
const [id, currency0, currency1, fee, tickSpacing, hooks] =
|
35
|
+
const [id, currency0, currency1, fee, tickSpacing, hooks] = UniswapV4PoolManagerInterface.decodeEventLog("Initialize", log.data, log.topics);
|
36
36
|
// Respect typing
|
37
37
|
return {
|
38
38
|
poolId: id,
|