@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.
@@ -2836,7 +2836,7 @@ declare const eden: {
2836
2836
  }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
2837
2837
  200: {
2838
2838
  delay: number;
2839
- computedUntil: bigint;
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: bigint;
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: bigint;
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: bigint;
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: bigint;
18338
+ computedUntil: number;
18339
18339
  startTimestamp: bigint;
18340
18340
  endTimestamp: bigint;
18341
18341
  computeChainId: number;
@@ -3467,7 +3467,7 @@ declare const app: Elysia<"", false, {
3467
3467
  response: {
3468
3468
  200: {
3469
3469
  delay: number;
3470
- computedUntil: bigint;
3470
+ computedUntil: number;
3471
3471
  startTimestamp: bigint;
3472
3472
  endTimestamp: bigint;
3473
3473
  computeChainId: number;
@@ -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 = await getLastEligibilityRatio(campaign, chainId, currentRoot, []);
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
- const lastEligibilityRatio = await getLastEligibilityRatio(campaign, chainId, currentRoot, backupCampaignIds);
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,
@@ -3337,7 +3337,7 @@ export declare const v4: Elysia<"/v4", false, {
3337
3337
  response: {
3338
3338
  200: {
3339
3339
  delay: number;
3340
- computedUntil: bigint;
3340
+ computedUntil: number;
3341
3341
  startTimestamp: bigint;
3342
3342
  endTimestamp: bigint;
3343
3343
  computeChainId: number;
@@ -150,7 +150,7 @@ export declare const StatusController: Elysia<"/campaign-status", false, {
150
150
  response: {
151
151
  200: {
152
152
  delay: number;
153
- computedUntil: bigint;
153
+ computedUntil: number;
154
154
  startTimestamp: bigint;
155
155
  endTimestamp: bigint;
156
156
  computeChainId: number;
@@ -51,7 +51,7 @@ export declare class StatusService {
51
51
  }>>;
52
52
  static findManyDelay(query: DelayModel): Promise<{
53
53
  delay: number;
54
- computedUntil: bigint;
54
+ computedUntil: number;
55
55
  startTimestamp: bigint;
56
56
  endTimestamp: bigint;
57
57
  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.parseInt(x.endTimestamp.toString());
109
- const delay = Math.min(now, endTimestamp) -
110
- Math.min(now, endTimestamp, Number.parseInt((x.CampaignStatus?.[0]?.computedUntil ?? x.startTimestamp).toString()));
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: x.CampaignStatus?.[0]?.computedUntil ?? x.startTimestamp,
116
+ computedUntil,
115
117
  };
116
118
  })
117
119
  .sort((a, b) => b.delay - a.delay)