@curvefi/llamalend-api 2.2.2 → 2.2.3
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.
|
@@ -83,7 +83,7 @@ export const getFactoryMarketDataV2 = (llamalend) => __awaiter(void 0, void 0, v
|
|
|
83
83
|
const collateral_tokens = [];
|
|
84
84
|
const borrowed_tokens = [];
|
|
85
85
|
const monetary_policies = [];
|
|
86
|
-
const gauges =
|
|
86
|
+
const gauges = new Array(Number(markets_count)).fill(llamalend.constants.ZERO_ADDRESS);
|
|
87
87
|
for (let i = 0; i < markets_count; i++) {
|
|
88
88
|
const marketData = res[i];
|
|
89
89
|
vaults.push(marketData[0].toLowerCase());
|
|
@@ -93,7 +93,12 @@ export const getFactoryMarketDataV2 = (llamalend) => __awaiter(void 0, void 0, v
|
|
|
93
93
|
borrowed_tokens.push(marketData[4].toLowerCase());
|
|
94
94
|
monetary_policies.push(marketData[6].toLowerCase());
|
|
95
95
|
names.push(''); // new factory does not give names, it's generated at the market creation level
|
|
96
|
-
|
|
96
|
+
}
|
|
97
|
+
// Fetch gauges for non-mainnet chains. Mainnet will use the new approach of fetching gauges from the new factory.
|
|
98
|
+
const gaugeFactoryAddress = llamalend.constants.ALIASES.gauge_factory;
|
|
99
|
+
if (llamalend.chainId !== 1 && gaugeFactoryAddress && gaugeFactoryAddress !== llamalend.constants.ZERO_ADDRESS) {
|
|
100
|
+
const gaugeFactory = llamalend.contracts[gaugeFactoryAddress];
|
|
101
|
+
(yield llamalend.multicallProvider.all(vaults.map((vault) => createCall(gaugeFactory, "get_gauge_from_lp_token", [vault])))).forEach((gauge, i) => { gauges[i] = gauge.toLowerCase(); });
|
|
97
102
|
}
|
|
98
103
|
return {
|
|
99
104
|
names,
|
package/package.json
CHANGED
|
@@ -95,7 +95,7 @@ export const getFactoryMarketDataV2 = async (llamalend: Llamalend) => {
|
|
|
95
95
|
const collateral_tokens: string[] = [];
|
|
96
96
|
const borrowed_tokens: string[] = [];
|
|
97
97
|
const monetary_policies: string[] = [];
|
|
98
|
-
const gauges: string[] =
|
|
98
|
+
const gauges: string[] = new Array(Number(markets_count)).fill(llamalend.constants.ZERO_ADDRESS);
|
|
99
99
|
|
|
100
100
|
for (let i = 0; i < markets_count; i++) {
|
|
101
101
|
const marketData = res[i] as any;
|
|
@@ -107,7 +107,15 @@ export const getFactoryMarketDataV2 = async (llamalend: Llamalend) => {
|
|
|
107
107
|
borrowed_tokens.push(marketData[4].toLowerCase());
|
|
108
108
|
monetary_policies.push(marketData[6].toLowerCase());
|
|
109
109
|
names.push(''); // new factory does not give names, it's generated at the market creation level
|
|
110
|
-
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Fetch gauges for non-mainnet chains. Mainnet will use the new approach of fetching gauges from the new factory.
|
|
113
|
+
const gaugeFactoryAddress = llamalend.constants.ALIASES.gauge_factory;
|
|
114
|
+
if (llamalend.chainId !== 1 && gaugeFactoryAddress && gaugeFactoryAddress !== llamalend.constants.ZERO_ADDRESS) {
|
|
115
|
+
const gaugeFactory = llamalend.contracts[gaugeFactoryAddress];
|
|
116
|
+
(await llamalend.multicallProvider.all(
|
|
117
|
+
vaults.map((vault: string) => createCall(gaugeFactory, "get_gauge_from_lp_token", [vault]))
|
|
118
|
+
) as string[]).forEach((gauge, i) => { gauges[i] = gauge.toLowerCase(); });
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
return {
|