@merkl/api 0.12.11 → 0.12.12
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/ERC20SubTypes/processor/EqualizerGaugeProcessor.js
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
2
|
import axios from "axios";
|
3
3
|
import { GenericProcessor } from "./GenericProcessor";
|
4
|
+
const findObjectByFarm = (dict, farmAddress) => {
|
5
|
+
for (const key in dict) {
|
6
|
+
if (dict[key].config && dict[key].config.farm === farmAddress) {
|
7
|
+
return dict[key];
|
8
|
+
}
|
9
|
+
}
|
10
|
+
return null;
|
11
|
+
};
|
4
12
|
export class EqualizerGaugeProcessor extends GenericProcessor {
|
5
13
|
rounds = {
|
6
14
|
round1: [],
|
@@ -15,8 +23,22 @@ export class EqualizerGaugeProcessor extends GenericProcessor {
|
|
15
23
|
let tvl = 0;
|
16
24
|
let displayName = "Stake into Equalizer Gauge";
|
17
25
|
try {
|
18
|
-
|
19
|
-
|
26
|
+
if (!!data[typeInfo.tokenAddress]) {
|
27
|
+
tvl = data[typeInfo.tokenAddress].token0.reserveUsd + data[typeInfo.tokenAddress].token1.reserveUsd;
|
28
|
+
displayName = `Stake into ${data[typeInfo.tokenAddress].pair.displayName} Equalizer Gauge`;
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
const EXTERNAL_EQUALIZER_CL_ENDPOINT = "https://eqapi-sonic-prod-ltanm.ondigitalocean.app/sonic/v4/clsets";
|
32
|
+
const data = (await axios(EXTERNAL_EQUALIZER_CL_ENDPOINT)).data.data;
|
33
|
+
const pool = findObjectByFarm(data, typeInfo.tokenAddress);
|
34
|
+
if (!!pool) {
|
35
|
+
tvl = pool.integration.equalizerPair.tvlUsd;
|
36
|
+
displayName = `Stake into ${pool.name} Equalizer Gauge`;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
catch (e) { }
|
41
|
+
try {
|
20
42
|
}
|
21
43
|
catch (e) { }
|
22
44
|
const priceTargetToken = tvl / totalSupply;
|