@merkl/api 0.16.32 → 0.16.34
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/eden/index.d.ts +5 -5
- package/dist/src/index.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +6 -2
- package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +13 -2
- package/dist/src/modules/v4/router.d.ts +1 -1
- package/dist/src/modules/v4/status/status.controller.d.ts +1 -1
- package/dist/src/modules/v4/status/status.service.d.ts +1 -1
- package/dist/src/modules/v4/status/status.service.js +6 -4
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/libs/campaigns/utils/getLastEligibilityRatio.d.ts +0 -2
- package/dist/src/libs/campaigns/utils/getLastEligibilityRatio.js +0 -65
package/dist/src/eden/index.d.ts
CHANGED
@@ -2836,7 +2836,7 @@ declare const eden: {
|
|
2836
2836
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
2837
2837
|
200: {
|
2838
2838
|
delay: number;
|
2839
|
-
computedUntil:
|
2839
|
+
computedUntil: number;
|
2840
2840
|
startTimestamp: bigint;
|
2841
2841
|
endTimestamp: bigint;
|
2842
2842
|
computeChainId: number;
|
@@ -6122,7 +6122,7 @@ declare const eden: {
|
|
6122
6122
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6123
6123
|
200: {
|
6124
6124
|
delay: number;
|
6125
|
-
computedUntil:
|
6125
|
+
computedUntil: number;
|
6126
6126
|
startTimestamp: bigint;
|
6127
6127
|
endTimestamp: bigint;
|
6128
6128
|
computeChainId: number;
|
@@ -10737,7 +10737,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10737
10737
|
response: {
|
10738
10738
|
200: {
|
10739
10739
|
delay: number;
|
10740
|
-
computedUntil:
|
10740
|
+
computedUntil: number;
|
10741
10741
|
startTimestamp: bigint;
|
10742
10742
|
endTimestamp: bigint;
|
10743
10743
|
computeChainId: number;
|
@@ -15049,7 +15049,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
15049
15049
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
15050
15050
|
200: {
|
15051
15051
|
delay: number;
|
15052
|
-
computedUntil:
|
15052
|
+
computedUntil: number;
|
15053
15053
|
startTimestamp: bigint;
|
15054
15054
|
endTimestamp: bigint;
|
15055
15055
|
computeChainId: number;
|
@@ -18335,7 +18335,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
18335
18335
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
18336
18336
|
200: {
|
18337
18337
|
delay: number;
|
18338
|
-
computedUntil:
|
18338
|
+
computedUntil: number;
|
18339
18339
|
startTimestamp: bigint;
|
18340
18340
|
endTimestamp: bigint;
|
18341
18341
|
computeChainId: number;
|
package/dist/src/index.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { merklChainDataWithCache } from "../../merklChainData";
|
2
|
+
import { ComputedValueService } from "../../../modules/v4/computedValue";
|
2
3
|
import { TokenRepository } from "../../../modules/v4/token/token.repository";
|
3
4
|
import { log } from "../../../utils/logger";
|
4
5
|
import { BN2Number, BalancerPoolInterface, BalancerV3StablePoolInterface, ChainInteractionService, ERC20Interface, EnzymeInterface, FactoryInterface, LayerBankERC20Interface, MetamorphoInterface, YEAR, getEnv, } from "@sdk";
|
5
6
|
import { Pricer } from "../../../utils/pricer";
|
6
|
-
import { getLastEligibilityRatio } from "../utils/getLastEligibilityRatio";
|
7
7
|
import { getTVL } from "./ERC20SubTypes/helpers/getTVL";
|
8
8
|
import { tokenType } from "./ERC20SubTypes/helpers/tokenType";
|
9
9
|
import { getTokenPricesInfo } from "./ERC20SubTypes/subtypesPrices";
|
@@ -135,7 +135,11 @@ export async function ERC20DynamicData(chainId, campaigns) {
|
|
135
135
|
const priceTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.priceTargetToken;
|
136
136
|
let lastEligibilityRatio = 1;
|
137
137
|
if (!!campaign.campaignParameters.hooks?.length) {
|
138
|
-
lastEligibilityRatio =
|
138
|
+
lastEligibilityRatio =
|
139
|
+
(await ComputedValueService.findCampaignValue({
|
140
|
+
campaignId: `${campaign.campaignId}-${chainId}`,
|
141
|
+
field: "averageBoost",
|
142
|
+
}))?.averageBoost ?? 1;
|
139
143
|
}
|
140
144
|
dynamicData.push({
|
141
145
|
...campaign,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ComputedValueService } from "../../../modules/v4/computedValue";
|
1
2
|
import { engineDbClient } from "../../../utils/prisma";
|
2
3
|
import { BN2Number, ERC20Interface, NULL_ADDRESS, RadiantInterface, RadiantPoolInterface, YEAR, } from "@sdk";
|
3
4
|
import { Contract } from "ethers";
|
@@ -5,7 +6,6 @@ import { log } from "../../../utils/logger";
|
|
5
6
|
import { Pricer } from "../../../utils/pricer";
|
6
7
|
import { providers } from "../../../utils/providers";
|
7
8
|
import { merklChainDataWithCache } from "../../merklChainData";
|
8
|
-
import { getLastEligibilityRatio } from "../utils/getLastEligibilityRatio";
|
9
9
|
export async function RadiantDynamicData(chainId, campaigns) {
|
10
10
|
const pricer = await Pricer.load();
|
11
11
|
const calls = [];
|
@@ -58,7 +58,18 @@ export async function RadiantDynamicData(chainId, campaigns) {
|
|
58
58
|
.filter(c => c.campaignParameters?.symbolRewardToken === "mtwRDNT")
|
59
59
|
.sort((a, b) => b.endTimestamp - a.endTimestamp)
|
60
60
|
.map(c => c?.campaignId);
|
61
|
-
|
61
|
+
let lastEligibilityRatio = 1;
|
62
|
+
if (!!campaign.campaignParameters.hooks?.length) {
|
63
|
+
for (const campaignId of [campaign.campaignId, ...backupCampaignIds]) {
|
64
|
+
lastEligibilityRatio =
|
65
|
+
(await ComputedValueService.findCampaignValue({
|
66
|
+
campaignId: `${campaignId}-${chainId}`,
|
67
|
+
field: "averageBoost",
|
68
|
+
}))?.averageBoost ?? 1;
|
69
|
+
if (lastEligibilityRatio !== 1)
|
70
|
+
break;
|
71
|
+
}
|
72
|
+
}
|
62
73
|
const priceRewardToken = (await pricer.get({
|
63
74
|
address: campaign.rewardToken,
|
64
75
|
chainId,
|
@@ -150,7 +150,7 @@ export declare const StatusController: Elysia<"/campaign-status", false, {
|
|
150
150
|
response: {
|
151
151
|
200: {
|
152
152
|
delay: number;
|
153
|
-
computedUntil:
|
153
|
+
computedUntil: number;
|
154
154
|
startTimestamp: bigint;
|
155
155
|
endTimestamp: bigint;
|
156
156
|
computeChainId: number;
|
@@ -105,13 +105,15 @@ export class StatusService {
|
|
105
105
|
const now = moment().unix();
|
106
106
|
return (await StatusRepository.findManyDelay(query))
|
107
107
|
.map(x => {
|
108
|
-
const endTimestamp = Number
|
109
|
-
const
|
110
|
-
|
108
|
+
const endTimestamp = Number(x.endTimestamp);
|
109
|
+
const computedUntil = !!Number(x.CampaignStatus?.[0]?.computedUntil)
|
110
|
+
? Number(x.CampaignStatus?.[0]?.computedUntil)
|
111
|
+
: Number(x.startTimestamp);
|
112
|
+
const delay = Math.min(now, endTimestamp) - Math.min(now, endTimestamp, computedUntil);
|
111
113
|
return {
|
112
114
|
...x,
|
113
115
|
delay,
|
114
|
-
computedUntil
|
116
|
+
computedUntil,
|
115
117
|
};
|
116
118
|
})
|
117
119
|
.sort((a, b) => b.delay - a.delay)
|