@merkl/api 0.19.8 → 0.19.10
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 +2 -2
- package/dist/src/engine/dynamicData/implementations/EventBased.js +1 -1
- package/dist/src/engine/dynamicData/implementations/Hyperdrive.d.ts +1 -1
- package/dist/src/engine/dynamicData/implementations/Hyperdrive.js +12 -2
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.d.ts +1 -1
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +1 -1
- package/dist/src/engine/opportunityMetadata/implementations/EventBased.js +1 -1
- package/dist/src/libs/positions/prepareFetch.js +1 -1
- package/dist/src/modules/v4/enso/enso.model.d.ts +1 -1
- package/dist/src/modules/v4/enso/enso.model.js +1 -1
- package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +2 -2
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +2 -2
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +3 -3
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -3
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1,8 +1,8 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
import { Redis } from "@/cache";
|
3
3
|
import { redisClient } from "@/cache/redis";
|
4
|
-
import { getEulerV2Vaults, updateEulerVaultsCollatInDatabase } from "@/
|
5
|
-
import { getUniswapV4Pools } from "@/
|
4
|
+
import { getEulerV2Vaults, updateEulerVaultsCollatInDatabase } from "@/engine/dynamicData/utils/getEulerV2Vaults";
|
5
|
+
import { getUniswapV4Pools } from "@/engine/dynamicData/utils/getUniswapV4Pools";
|
6
6
|
import { log } from "@/utils/logger";
|
7
7
|
import { engineDbClient } from "@db";
|
8
8
|
import { swagger } from "@elysiajs/swagger";
|
@@ -42,7 +42,7 @@ async function computeEventBasedPoolTVLFromMostRecentStateSave(chainId, campaign
|
|
42
42
|
const bucket = new BucketService(bucketName, "merkl-production");
|
43
43
|
const storedStates = JSON.parse(await bucket.pull(fileName));
|
44
44
|
for (const [_, { value, params: _params }] of Object.entries(storedStates)) {
|
45
|
-
tvl += BN2Number(value.allTimeValue, decimalsCurrency);
|
45
|
+
tvl += BN2Number(value.allTimeValue, 18 - decimalsCurrency);
|
46
46
|
}
|
47
47
|
tvl = tvl * priceCurrency;
|
48
48
|
tvl = Math.max(tvl, 1);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { Campaign, type CampaignParameters, type MerklChainId } from "@sdk";
|
2
2
|
import type { DynamicDataBuilder } from "../interface";
|
3
3
|
type campaignType = Campaign.HYPERDRIVELOGPROCESSOR | Campaign.HYPERDRIVELOGFIXPROCESSOR;
|
4
4
|
export declare class HyperdriveDynamicData implements DynamicDataBuilder<campaignType> {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { TokenService } from "@/modules/v4/token/token.service";
|
2
2
|
import { Pricer } from "@/utils/pricer";
|
3
|
-
import { BN2Number, ChainInteractionService, ETH_ADDRESS, HyperDriveSubCampaignType, HyperdriveTargetInterface, YEAR, } from "@sdk";
|
3
|
+
import { BN2Number, Campaign, ChainInteractionService, ETH_ADDRESS, HyperDriveSubCampaignType, HyperdriveTargetInterface, YEAR, } from "@sdk";
|
4
4
|
export class HyperdriveDynamicData {
|
5
5
|
async build(chainId, campaigns) {
|
6
6
|
const pricer = await Pricer.load();
|
@@ -44,11 +44,21 @@ export class HyperdriveDynamicData {
|
|
44
44
|
chainId,
|
45
45
|
symbol: campaign.campaignParameters.baseTokenSymbol,
|
46
46
|
})) ?? 0;
|
47
|
+
let multiplier = 1;
|
48
|
+
if (campaign.campaignType === Campaign.HYPERDRIVELOGPROCESSOR) {
|
49
|
+
const spot_price = ((BN2Number(poolConfig.initialVaultSharePrice, 18) *
|
50
|
+
(BN2Number(poolInfo.shareReserves, 18) - BN2Number(poolInfo.shareAdjustment, 18))) /
|
51
|
+
BN2Number(poolInfo.bondReserves)) **
|
52
|
+
BN2Number(poolConfig.timeStretch);
|
53
|
+
if (spot_price < 1) {
|
54
|
+
multiplier = 1 / (1 - spot_price);
|
55
|
+
}
|
56
|
+
}
|
47
57
|
const tvl = campaign.campaignSubType === HyperDriveSubCampaignType.LP
|
48
58
|
? priceBaseToken * marketSupply
|
49
59
|
: campaign.campaignSubType === HyperDriveSubCampaignType.LONG
|
50
60
|
? priceBaseToken * longSupply
|
51
|
-
: priceBaseToken * shortSupply;
|
61
|
+
: (priceBaseToken * shortSupply) / multiplier;
|
52
62
|
dynamicData.push({
|
53
63
|
...campaign,
|
54
64
|
totalSupplyTargetToken: marketSupply,
|
@@ -44,7 +44,7 @@ export class ClammMetadata {
|
|
44
44
|
{ chainId: computeChainId, address: params.token0 },
|
45
45
|
{ chainId: computeChainId, address: params.token1 },
|
46
46
|
],
|
47
|
-
mainProtocol: camelToKebabCase(AMM[params.amm]),
|
47
|
+
mainProtocol: AMM[params.amm] ? camelToKebabCase(AMM[params.amm]) : undefined,
|
48
48
|
};
|
49
49
|
}
|
50
50
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// @ts-nocheck
|
2
|
+
import { VEST_TOKEN } from "@/engine/dynamicData/implementations/Vest";
|
2
3
|
import { Campaign, Forwarder, MorphoSubCampaignType, } from "@sdk";
|
3
4
|
import { utils } from "ethers";
|
4
|
-
import { VEST_TOKEN } from "../campaigns/campaignTypes/VestDynamicData";
|
5
5
|
function prepareClammFetch(previous, campaign) {
|
6
6
|
if (campaign.campaignType !== Campaign.CLAMM) {
|
7
7
|
return previous;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { ChainId } from "@sdk";
|
2
2
|
import { t } from "elysia";
|
3
3
|
export const dexIdToProtocolId = {
|
4
|
-
DEX_UNISWAPV3: "uniswap
|
5
|
-
DEX_UNISWAPV2: "uniswap
|
4
|
+
DEX_UNISWAPV3: "uniswap",
|
5
|
+
DEX_UNISWAPV2: "uniswap",
|
6
6
|
DEX_PANCAKESWAPV3: "pancakeswap-v3",
|
7
7
|
DEX_SUSHISWAPV3: "sushiswap-v3",
|
8
8
|
DEX_CURVE: "curve",
|
@@ -654,7 +654,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
654
654
|
campaignType: Campaign.EVENT_BASED,
|
655
655
|
contract: "0xd0bc067cf877f7b76ceb331891331d9e6acda1a7",
|
656
656
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
657
|
-
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 7, multiplier: (
|
657
|
+
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 7, multiplier: (3n ** 10n).toString() }],
|
658
658
|
computeScoreParameters: {
|
659
659
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
660
660
|
computeSettings: {
|
@@ -694,7 +694,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
694
694
|
campaignType: Campaign.EVENT_BASED,
|
695
695
|
contract: "0x65ea4dd7f789c71c0f57ed84b3bdc3062898d3cb",
|
696
696
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
697
|
-
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 7, multiplier: (
|
697
|
+
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 7, multiplier: (3n ** 10n).toString() }],
|
698
698
|
computeScoreParameters: {
|
699
699
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
700
700
|
computeSettings: {
|
@@ -734,7 +734,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
734
734
|
campaignType: Campaign.EVENT_BASED,
|
735
735
|
contract: "0xbb6b01d94e3f6ebae8647cb56d544f57928ab758",
|
736
736
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
737
|
-
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 7, multiplier: (
|
737
|
+
topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 7, multiplier: (3n ** 10n).toString() }],
|
738
738
|
computeScoreParameters: {
|
739
739
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
740
740
|
computeSettings: {
|
@@ -9,7 +9,7 @@ export type Protocol = Resource<"Protocol", undefined, {
|
|
9
9
|
numberOfLiveCampaigns?: number;
|
10
10
|
opportunityLiveTags?: string[];
|
11
11
|
}>;
|
12
|
-
declare const protocolTypes: readonly ["ambient", "arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "
|
12
|
+
declare const protocolTypes: readonly ["uniswap", "ambient", "arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "velodrome", "aerodrome", "balancer", "curve", "cross_curve", "curveNPool", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "syncswap-v3", "neptune", "zkSwapThreePool", "syncswap", "rfx", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "venus", "woofi", "reactor_fusion", "eigenlayer", "vest", "zerolend", "hyperdrive", "gamma", "oku", "hourglass", "veda", "kyo", "sonex", "quickswap-algebra", "velodrome"];
|
13
13
|
export type ProtocolId = (typeof protocolTypes)[number];
|
14
14
|
export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
|
15
15
|
id: import("@sinclair/typebox").TString;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { t } from "elysia";
|
2
2
|
const protocolTypes = [
|
3
3
|
// ─── AMM ─────────────────────────────────────────────────────────────
|
4
|
+
"uniswap",
|
4
5
|
"ambient",
|
5
6
|
"arthswap",
|
6
7
|
"baseswap",
|
@@ -21,16 +22,13 @@ const protocolTypes = [
|
|
21
22
|
"sushiswap-v3",
|
22
23
|
"swapr",
|
23
24
|
"thruster",
|
24
|
-
"uniswap-v3",
|
25
25
|
"voltage",
|
26
26
|
"zero",
|
27
27
|
"koi",
|
28
28
|
"supswap-v3",
|
29
29
|
"zkswap",
|
30
30
|
"thirdtrade",
|
31
|
-
"uniswapv4",
|
32
31
|
// ─── LP DEX ──────────────────────────────────────────────────────────
|
33
|
-
"uniswap-v2",
|
34
32
|
"velodrome",
|
35
33
|
"aerodrome",
|
36
34
|
"balancer",
|