@merkl/api 0.16.32 → 0.16.33
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/libs/campaigns/campaignTypes/ERC20DynamicData.js +6 -2
- package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +13 -2
- 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
@@ -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,
|