@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
package/package.json
CHANGED
@@ -1,65 +0,0 @@
|
|
1
|
-
import { apiDbClient } from "src/utils/prisma";
|
2
|
-
export const getLastEligibilityRatio = async (campaign, chainId, currentRoot, backupCampaignIds) => {
|
3
|
-
if (campaign.campaignId === "0x6acb7a8cd2646f18e6e438658273bbee1ed6d664c19779d144cc339decf240ca") {
|
4
|
-
return 2;
|
5
|
-
}
|
6
|
-
let lastEligibilityRatio = 1; // By default it's 1
|
7
|
-
try {
|
8
|
-
const auxLastEligibilityRatioString = (await apiDbClient.rewardBreakdown.findFirst({
|
9
|
-
select: {
|
10
|
-
auxiliaryData1: true,
|
11
|
-
},
|
12
|
-
where: {
|
13
|
-
Reward: {
|
14
|
-
RewardToken: {
|
15
|
-
chainId,
|
16
|
-
},
|
17
|
-
root: currentRoot,
|
18
|
-
},
|
19
|
-
campaignId: campaign.campaignId,
|
20
|
-
},
|
21
|
-
orderBy: {
|
22
|
-
amount: "desc",
|
23
|
-
},
|
24
|
-
}))?.auxiliaryData1;
|
25
|
-
let auxLastEligibilityRatio = !!auxLastEligibilityRatioString
|
26
|
-
? Number.parseFloat(auxLastEligibilityRatioString)
|
27
|
-
: null;
|
28
|
-
// If the last eligibility ratio is 0 it means the campaign do not use eligibility
|
29
|
-
if (auxLastEligibilityRatio === undefined || auxLastEligibilityRatio === null) {
|
30
|
-
// Otherwise we search in the backup campaigns
|
31
|
-
for (const campaignId of backupCampaignIds) {
|
32
|
-
const auxLastEligibilityRatioString = (await apiDbClient.rewardBreakdown.findFirst({
|
33
|
-
select: {
|
34
|
-
auxiliaryData1: true,
|
35
|
-
},
|
36
|
-
where: {
|
37
|
-
Reward: {
|
38
|
-
RewardToken: {
|
39
|
-
chainId,
|
40
|
-
},
|
41
|
-
root: currentRoot,
|
42
|
-
},
|
43
|
-
campaignId: campaignId,
|
44
|
-
},
|
45
|
-
orderBy: {
|
46
|
-
amount: "desc",
|
47
|
-
},
|
48
|
-
}))?.auxiliaryData1;
|
49
|
-
auxLastEligibilityRatio = !!auxLastEligibilityRatioString
|
50
|
-
? Number.parseFloat(auxLastEligibilityRatioString)
|
51
|
-
: null;
|
52
|
-
if (!!auxLastEligibilityRatio)
|
53
|
-
break;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
if (!!auxLastEligibilityRatio) {
|
57
|
-
lastEligibilityRatio = auxLastEligibilityRatio * 100;
|
58
|
-
}
|
59
|
-
else if (auxLastEligibilityRatio === 0) {
|
60
|
-
lastEligibilityRatio = 1;
|
61
|
-
}
|
62
|
-
}
|
63
|
-
catch { }
|
64
|
-
return lastEligibilityRatio;
|
65
|
-
};
|