@curvefi/api 2.65.28 → 2.66.0
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/README.md +3 -0
- package/eslint.config.mjs +88 -0
- package/lib/boosting.js +13 -13
- package/lib/constants/coins/avalanche.js +4 -4
- package/lib/constants/coins/base.js +1 -1
- package/lib/constants/coins/celo.js +1 -1
- package/lib/constants/coins/ethereum.js +88 -88
- package/lib/constants/coins/fantom.js +5 -5
- package/lib/constants/coins/kava.js +1 -1
- package/lib/constants/coins/polygon.js +18 -18
- package/lib/constants/coins/zksync.js +1 -1
- package/lib/constants/factory/crypto.js +32 -32
- package/lib/constants/factory/stable.js +57 -57
- package/lib/constants/network_constants.js +37 -37
- package/lib/constants/pools/arbitrum.js +8 -8
- package/lib/constants/pools/aurora.js +2 -2
- package/lib/constants/pools/avalanche.js +13 -13
- package/lib/constants/pools/ethereum.js +89 -89
- package/lib/constants/pools/fantom.js +13 -13
- package/lib/constants/pools/moonbeam.js +3 -3
- package/lib/constants/pools/optimism.js +3 -3
- package/lib/constants/pools/polygon.js +21 -21
- package/lib/constants/pools/xdai.js +13 -13
- package/lib/curve.d.ts +10 -2
- package/lib/curve.js +80 -47
- package/lib/dao.js +12 -12
- package/lib/external-api.d.ts +0 -9
- package/lib/external-api.js +75 -104
- package/lib/factory/deploy.js +12 -12
- package/lib/factory/factory-api.js +13 -13
- package/lib/factory/factory-crypto.js +10 -10
- package/lib/factory/factory-tricrypto.js +11 -11
- package/lib/factory/factory-twocrypto.js +9 -9
- package/lib/factory/factory.js +13 -13
- package/lib/index.d.ts +60 -59
- package/lib/index.js +6 -3
- package/lib/pools/PoolTemplate.js +59 -59
- package/lib/pools/mixins/depositMixins.js +14 -14
- package/lib/pools/mixins/depositWrappedMixins.js +8 -8
- package/lib/pools/mixins/swapMixins.js +12 -12
- package/lib/pools/mixins/swapWrappedMixins.js +8 -8
- package/lib/pools/mixins/withdrawImbalanceMixins.js +12 -12
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +6 -6
- package/lib/pools/mixins/withdrawMixins.js +14 -14
- package/lib/pools/mixins/withdrawOneCoinMixins.js +14 -14
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +6 -6
- package/lib/pools/mixins/withdrawWrappedMixins.js +6 -6
- package/lib/pools/subClasses/gaugePool.js +4 -4
- package/lib/pools/subClasses/statsPool.js +3 -3
- package/lib/pools/utils.js +11 -11
- package/lib/route-graph.worker.js +3 -3
- package/lib/router.js +4 -5
- package/lib/utils.js +22 -24
- package/package.json +21 -18
package/lib/external-api.js
CHANGED
|
@@ -7,19 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axios from "axios";
|
|
11
10
|
import memoize from "memoizee";
|
|
12
|
-
export const _getPoolsFromApi = memoize((
|
|
11
|
+
export const _getPoolsFromApi = memoize((network_1, poolType_1, ...args_1) => __awaiter(void 0, [network_1, poolType_1, ...args_1], void 0, function* (network, poolType, isLiteChain = false) {
|
|
13
12
|
var _a;
|
|
14
13
|
const api = isLiteChain ? "https://api-core.curve.fi/v1/" : "https://api.curve.fi/api";
|
|
15
14
|
const url = `${api}/getPools/${network}/${poolType}`;
|
|
16
|
-
|
|
17
|
-
return (_a = response.data.data) !== null && _a !== void 0 ? _a : { poolData: [], tvl: 0, tvlAll: 0 };
|
|
15
|
+
return (_a = yield fetchData(url)) !== null && _a !== void 0 ? _a : { poolData: [], tvl: 0, tvlAll: 0 };
|
|
18
16
|
}), {
|
|
19
17
|
promise: true,
|
|
20
18
|
maxAge: 5 * 60 * 1000, // 5m
|
|
21
19
|
});
|
|
22
|
-
export const _getAllPoolsFromApi = (
|
|
20
|
+
export const _getAllPoolsFromApi = (network_1, ...args_1) => __awaiter(void 0, [network_1, ...args_1], void 0, function* (network, isLiteChain = false) {
|
|
23
21
|
if (isLiteChain) {
|
|
24
22
|
return yield Promise.all([
|
|
25
23
|
_getPoolsFromApi(network, "factory-twocrypto", isLiteChain),
|
|
@@ -42,106 +40,73 @@ export const _getAllPoolsFromApi = (network, isLiteChain = false) => __awaiter(v
|
|
|
42
40
|
}
|
|
43
41
|
});
|
|
44
42
|
export const _getSubgraphData = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
var _b, _c
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
week: item.latestWeeklyApy,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
const data = yield fetchData(`https://api.curve.fi/api/getSubgraphData/${network}`);
|
|
45
|
+
const poolsData = data.poolList.map((data) => ({
|
|
46
|
+
address: data.address,
|
|
47
|
+
volumeUSD: data.volumeUSD,
|
|
48
|
+
day: data.latestDailyApy,
|
|
49
|
+
week: data.latestWeeklyApy,
|
|
50
|
+
}));
|
|
56
51
|
return {
|
|
57
|
-
poolsData: poolsData
|
|
58
|
-
totalVolume: (
|
|
59
|
-
cryptoVolume: (
|
|
60
|
-
cryptoShare: (
|
|
52
|
+
poolsData: poolsData,
|
|
53
|
+
totalVolume: (_a = data.totalVolume) !== null && _a !== void 0 ? _a : 0,
|
|
54
|
+
cryptoVolume: (_b = data.cryptoVolume) !== null && _b !== void 0 ? _b : 0,
|
|
55
|
+
cryptoShare: (_c = data.cryptoShare) !== null && _c !== void 0 ? _c : 0,
|
|
61
56
|
};
|
|
62
57
|
}), {
|
|
63
58
|
promise: true,
|
|
64
59
|
maxAge: 5 * 60 * 1000, // 5m
|
|
65
60
|
});
|
|
66
61
|
export const _getVolumes = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
-
var
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
week: item.latestWeeklyApyPcent,
|
|
76
|
-
};
|
|
77
|
-
});
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
const { pools, totalVolumes } = yield fetchData(`https://api.curve.fi/api/getVolumes/${network}`);
|
|
64
|
+
const poolsData = pools.map((data) => ({
|
|
65
|
+
address: data.address,
|
|
66
|
+
volumeUSD: data.volumeUSD,
|
|
67
|
+
day: data.latestDailyApyPcent,
|
|
68
|
+
week: data.latestWeeklyApyPcent,
|
|
69
|
+
}));
|
|
78
70
|
return {
|
|
79
71
|
poolsData: poolsData !== null && poolsData !== void 0 ? poolsData : [],
|
|
80
|
-
totalVolume: (
|
|
81
|
-
cryptoVolume: (
|
|
82
|
-
cryptoShare: (
|
|
72
|
+
totalVolume: (_a = totalVolumes.totalVolume) !== null && _a !== void 0 ? _a : 0,
|
|
73
|
+
cryptoVolume: (_b = totalVolumes.totalCryptoVolume) !== null && _b !== void 0 ? _b : 0,
|
|
74
|
+
cryptoShare: (_c = totalVolumes.cryptoVolumeSharePcent) !== null && _c !== void 0 ? _c : 0,
|
|
83
75
|
};
|
|
84
76
|
}), {
|
|
85
77
|
promise: true,
|
|
86
78
|
maxAge: 5 * 60 * 1000, // 5m
|
|
87
79
|
});
|
|
88
80
|
export const _getFactoryAPYs = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const response = yield Promise.all([
|
|
93
|
-
axios.get(urlStable, { validateStatus: () => true }),
|
|
94
|
-
axios.get(urlCrypto, { validateStatus: () => true }),
|
|
95
|
-
]);
|
|
96
|
-
const stableVolume = response[0].data.data.totalVolumeUsd || response[0].data.data.totalVolume || 0;
|
|
97
|
-
const cryptoVolume = response[1].data.data.totalVolumeUsd || response[1].data.data.totalVolume || 0;
|
|
98
|
-
const poolsData = [...response[0].data.data.poolDetails, ...response[1].data.data.poolDetails].map((item) => {
|
|
99
|
-
var _a, _b, _c;
|
|
100
|
-
return {
|
|
101
|
-
address: item.poolAddress,
|
|
102
|
-
volumeUSD: (_a = item.totalVolumeUsd) !== null && _a !== void 0 ? _a : 0,
|
|
103
|
-
day: (_b = item.apy) !== null && _b !== void 0 ? _b : 0,
|
|
104
|
-
week: (_c = item.apy * 7) !== null && _c !== void 0 ? _c : 0, //Because api does not return week apy
|
|
105
|
-
};
|
|
106
|
-
});
|
|
81
|
+
const [stableData, cryptoData] = yield Promise.all(['stable', 'crypto'].map((type) => fetchData(`https://api.curve.fi/api/getFactoryAPYs/${network}/${type}`)));
|
|
82
|
+
const stableVolume = stableData.totalVolumeUsd || stableData.totalVolume || 0;
|
|
83
|
+
const cryptoVolume = cryptoData.totalVolumeUsd || cryptoData.totalVolume || 0;
|
|
107
84
|
return {
|
|
108
|
-
poolsData:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
85
|
+
poolsData: [...stableData.poolDetails, ...cryptoData.poolDetails].map((item) => {
|
|
86
|
+
var _a, _b, _c;
|
|
87
|
+
return ({
|
|
88
|
+
address: item.poolAddress,
|
|
89
|
+
volumeUSD: (_a = item.totalVolumeUsd) !== null && _a !== void 0 ? _a : 0,
|
|
90
|
+
day: (_b = item.apy) !== null && _b !== void 0 ? _b : 0,
|
|
91
|
+
week: ((_c = item.apy) !== null && _c !== void 0 ? _c : 0) * 7, // Because api does not return week apy
|
|
92
|
+
});
|
|
93
|
+
}),
|
|
94
|
+
totalVolume: stableVolume + cryptoVolume,
|
|
95
|
+
cryptoVolume,
|
|
96
|
+
cryptoShare: 100 * cryptoVolume / (stableVolume + cryptoVolume),
|
|
112
97
|
};
|
|
113
98
|
}), {
|
|
114
99
|
promise: true,
|
|
115
100
|
maxAge: 5 * 60 * 1000, // 5m
|
|
116
101
|
});
|
|
117
|
-
|
|
118
|
-
export const _getTotalVolumes = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
|
-
if (network === "aurora")
|
|
120
|
-
return {
|
|
121
|
-
totalVolume: 0,
|
|
122
|
-
cryptoVolume: 0,
|
|
123
|
-
cryptoShare: 0,
|
|
124
|
-
}; // Exclude Aurora
|
|
125
|
-
const url = `https://api.curve.fi/api/getSubgraphData/${network}`;
|
|
126
|
-
const response = yield axios.get(url, { validateStatus: () => true });
|
|
127
|
-
return response.data.data;
|
|
128
|
-
}), {
|
|
129
|
-
promise: true,
|
|
130
|
-
maxAge: 5 * 60 * 1000, // 5m
|
|
131
|
-
});
|
|
132
|
-
export const _getAllGauges = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
-
const url = `https://api.curve.fi/api/getAllGauges`;
|
|
134
|
-
const response = yield axios.get(url, { validateStatus: () => true });
|
|
135
|
-
return response.data.data;
|
|
136
|
-
}), {
|
|
102
|
+
export const _getAllGauges = memoize(() => fetchData(`https://api.curve.fi/api/getAllGauges`), {
|
|
137
103
|
promise: true,
|
|
138
104
|
maxAge: 5 * 60 * 1000, // 5m
|
|
139
105
|
});
|
|
140
106
|
export const _getAllGaugesFormatted = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
141
|
-
const
|
|
142
|
-
const response = yield axios.get(url, { validateStatus: () => true });
|
|
107
|
+
const data = yield fetchData(`https://api.curve.fi/api/getAllGauges`);
|
|
143
108
|
const gaugesDict = {};
|
|
144
|
-
Object.values(
|
|
109
|
+
Object.values(data).forEach((d) => {
|
|
145
110
|
var _a, _b;
|
|
146
111
|
gaugesDict[d.gauge.toLowerCase()] = {
|
|
147
112
|
is_killed: (_a = d.is_killed) !== null && _a !== void 0 ? _a : false,
|
|
@@ -153,18 +118,14 @@ export const _getAllGaugesFormatted = memoize(() => __awaiter(void 0, void 0, vo
|
|
|
153
118
|
promise: true,
|
|
154
119
|
maxAge: 60 * 60 * 1000, // 60m
|
|
155
120
|
});
|
|
156
|
-
export const _getHiddenPools = memoize(() =>
|
|
157
|
-
const url = `https://api.curve.fi/api/getHiddenPools`;
|
|
158
|
-
const response = yield axios.get(url, { validateStatus: () => true });
|
|
159
|
-
return response.data.data;
|
|
160
|
-
}), {
|
|
121
|
+
export const _getHiddenPools = memoize(() => fetchData(`https://api.curve.fi/api/getHiddenPools`), {
|
|
161
122
|
promise: true,
|
|
162
123
|
maxAge: 5 * 60 * 1000, // 5m
|
|
163
124
|
});
|
|
164
125
|
export const _generateBoostingProof = memoize((block, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
165
126
|
const url = `https://prices.curve.fi/v1/general/get_merkle_proof?block=${block}&account_address=${address}`;
|
|
166
|
-
const
|
|
167
|
-
return { block_header_rlp
|
|
127
|
+
const { block_header_rlp, proof_rlp } = yield fetchJson(url);
|
|
128
|
+
return { block_header_rlp, proof_rlp };
|
|
168
129
|
}), {
|
|
169
130
|
promise: true,
|
|
170
131
|
maxAge: 5 * 60 * 1000, // 5m
|
|
@@ -172,34 +133,31 @@ export const _generateBoostingProof = memoize((block, address) => __awaiter(void
|
|
|
172
133
|
// --- DAO ---
|
|
173
134
|
export const _getDaoProposalList = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
174
135
|
const url = "https://api-py.llama.airforce/curve/v1/dao/proposals";
|
|
175
|
-
const
|
|
176
|
-
return
|
|
136
|
+
const { proposals } = yield fetchJson(url);
|
|
137
|
+
return proposals;
|
|
177
138
|
}), {
|
|
178
139
|
promise: true,
|
|
179
140
|
maxAge: 5 * 60 * 1000, // 5m
|
|
180
141
|
});
|
|
181
|
-
export const _getDaoProposal = memoize((type, id) =>
|
|
182
|
-
const url = `https://api-py.llama.airforce/curve/v1/dao/proposals/${type.toLowerCase()}/${id}`;
|
|
183
|
-
const response = yield axios.get(url, { validateStatus: () => true });
|
|
184
|
-
return response.data;
|
|
185
|
-
}), {
|
|
142
|
+
export const _getDaoProposal = memoize((type, id) => fetchJson(`https://api-py.llama.airforce/curve/v1/dao/proposals/${type.toLowerCase()}/${id}`), {
|
|
186
143
|
promise: true,
|
|
187
144
|
maxAge: 5 * 60 * 1000, // 5m
|
|
188
145
|
});
|
|
189
146
|
// --- CURVE LITE ---
|
|
190
147
|
export const _getLiteNetworksData = memoize((networkName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
191
|
-
var
|
|
148
|
+
var _a, _b;
|
|
192
149
|
try {
|
|
193
150
|
const url = `https://api-core.curve.fi/v1/getDeployment/${networkName}`;
|
|
194
|
-
const response = yield
|
|
195
|
-
|
|
196
|
-
|
|
151
|
+
const response = yield fetch(url);
|
|
152
|
+
const { data } = (_a = yield response.json()) !== null && _a !== void 0 ? _a : {};
|
|
153
|
+
if (response.status !== 200 || !data) {
|
|
154
|
+
console.error('Failed to fetch network data:', response.status, data);
|
|
197
155
|
return null;
|
|
198
156
|
}
|
|
199
|
-
const { config, contracts } =
|
|
157
|
+
const { config, contracts } = data;
|
|
200
158
|
const network_name = config.network_name || 'Unknown Network';
|
|
201
159
|
const native_currency_symbol = config.native_currency_symbol || 'N/A';
|
|
202
|
-
const wrapped_native_token = ((
|
|
160
|
+
const wrapped_native_token = ((_b = config.wrapped_native_token) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || '';
|
|
203
161
|
return {
|
|
204
162
|
NAME: network_name,
|
|
205
163
|
ALIASES: {
|
|
@@ -236,14 +194,14 @@ export const _getLiteNetworksData = memoize((networkName) => __awaiter(void 0, v
|
|
|
236
194
|
maxAge: 5 * 60 * 1000, // 5 minutes
|
|
237
195
|
});
|
|
238
196
|
export const _getCurveLiteNetworks = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
239
|
-
var
|
|
240
|
-
const
|
|
241
|
-
const
|
|
242
|
-
if (response.status !== 200 || !(
|
|
197
|
+
var _a;
|
|
198
|
+
const response = yield fetch(`https://api-core.curve.fi/v1/getPlatforms`);
|
|
199
|
+
const { data } = (_a = yield response.json()) !== null && _a !== void 0 ? _a : {};
|
|
200
|
+
if (response.status !== 200 || !(data === null || data === void 0 ? void 0 : data.platforms)) {
|
|
243
201
|
console.error('Failed to fetch Curve platforms:', response);
|
|
244
202
|
return [];
|
|
245
203
|
}
|
|
246
|
-
const { platforms, platformsMetadata } =
|
|
204
|
+
const { platforms, platformsMetadata } = data;
|
|
247
205
|
return Object.keys(platforms)
|
|
248
206
|
.map((id) => {
|
|
249
207
|
var _a;
|
|
@@ -263,3 +221,16 @@ export const _getCurveLiteNetworks = memoize(() => __awaiter(void 0, void 0, voi
|
|
|
263
221
|
promise: true,
|
|
264
222
|
maxAge: 5 * 60 * 1000, // 5 minutes
|
|
265
223
|
});
|
|
224
|
+
function fetchJson(url) {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
var _a;
|
|
227
|
+
const response = yield fetch(url);
|
|
228
|
+
return (_a = yield response.json()) !== null && _a !== void 0 ? _a : {};
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
function fetchData(url) {
|
|
232
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
+
const { data } = yield fetchJson(url);
|
|
234
|
+
return data;
|
|
235
|
+
});
|
|
236
|
+
}
|
package/lib/factory/deploy.js
CHANGED
|
@@ -12,8 +12,8 @@ import { curve } from "../curve.js";
|
|
|
12
12
|
import { NETWORK_CONSTANTS } from "../constants/network_constants.js";
|
|
13
13
|
import { getPool } from "../pools/index.js";
|
|
14
14
|
import { parseUnits, BN, mulBy1_3, getPoolIdBySwapAddress, DIGas, smartNumber } from '../utils.js';
|
|
15
|
-
import CurveLpTokenV5ABI from "../constants/abis/curve_lp_token_v5.json"
|
|
16
|
-
import Plain2ETHOracleABIABI from "../constants/abis/factory-v2/Plain2ETHOracle.json"
|
|
15
|
+
import CurveLpTokenV5ABI from "../constants/abis/curve_lp_token_v5.json" with { type: 'json' };
|
|
16
|
+
import Plain2ETHOracleABIABI from "../constants/abis/factory-v2/Plain2ETHOracle.json" with { type: 'json' };
|
|
17
17
|
// ------- STABLE PLAIN POOLS -------
|
|
18
18
|
const _deployStablePlainPool = (name, symbol, coins, A, fee, // %
|
|
19
19
|
assetType, // 0 = USD, 1 = ETH, 2 = BTC, 3 = Other
|
|
@@ -65,22 +65,22 @@ oracleAddress, methodName, estimateGas) => __awaiter(void 0, void 0, void 0, fun
|
|
|
65
65
|
yield curve.updateFeeData();
|
|
66
66
|
return yield contract[methodToCall](...args, Object.assign(Object.assign({}, curve.options), { gasLimit }));
|
|
67
67
|
});
|
|
68
|
-
export const deployStablePlainPoolEstimateGas = (name, symbol, coins, A, fee, // %
|
|
68
|
+
export const deployStablePlainPoolEstimateGas = (name_1, symbol_1, coins_1, A_1, fee_1, assetType_1, implementationIdx_1, ...args_1) => __awaiter(void 0, [name_1, symbol_1, coins_1, A_1, fee_1, assetType_1, implementationIdx_1, ...args_1], void 0, function* (name, symbol, coins, A, fee, // %
|
|
69
69
|
assetType, // 0 = USD, 1 = ETH, 2 = BTC, 3 = Other
|
|
70
70
|
implementationIdx, emaTime = 600, // seconds
|
|
71
|
-
oracleAddress = curve.constants.ZERO_ADDRESS, methodName = "0x00000000")
|
|
71
|
+
oracleAddress = curve.constants.ZERO_ADDRESS, methodName = "0x00000000") {
|
|
72
72
|
return yield _deployStablePlainPool(name, symbol, coins, A, fee, assetType, implementationIdx, emaTime, oracleAddress, methodName, true);
|
|
73
73
|
});
|
|
74
|
-
export const deployStablePlainPool = (name, symbol, coins, A, fee, // %
|
|
74
|
+
export const deployStablePlainPool = (name_1, symbol_1, coins_1, A_1, fee_1, assetType_1, implementationIdx_1, ...args_1) => __awaiter(void 0, [name_1, symbol_1, coins_1, A_1, fee_1, assetType_1, implementationIdx_1, ...args_1], void 0, function* (name, symbol, coins, A, fee, // %
|
|
75
75
|
assetType, // 0 = USD, 1 = ETH, 2 = BTC, 3 = Other
|
|
76
76
|
implementationIdx, emaTime = 600, // seconds
|
|
77
|
-
oracleAddress = curve.constants.ZERO_ADDRESS, methodName = "0x00000000")
|
|
77
|
+
oracleAddress = curve.constants.ZERO_ADDRESS, methodName = "0x00000000") {
|
|
78
78
|
return yield _deployStablePlainPool(name, symbol, coins, A, fee, assetType, implementationIdx, emaTime, oracleAddress, methodName, false);
|
|
79
79
|
});
|
|
80
|
-
const _deployStableNgPlainPool = (name, symbol, coins, A, fee, // %
|
|
80
|
+
const _deployStableNgPlainPool = (name_1, symbol_1, coins_1, A_1, fee_1, offpegFeeMultiplier_1, assetTypes_1, implementationIdx_1, ...args_1) => __awaiter(void 0, [name_1, symbol_1, coins_1, A_1, fee_1, offpegFeeMultiplier_1, assetTypes_1, implementationIdx_1, ...args_1], void 0, function* (name, symbol, coins, A, fee, // %
|
|
81
81
|
offpegFeeMultiplier, assetTypes, // 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
|
|
82
82
|
implementationIdx, emaTime = 600, // seconds
|
|
83
|
-
oracleAddresses, methodNames, estimateGas)
|
|
83
|
+
oracleAddresses, methodNames, estimateGas) {
|
|
84
84
|
if (name.length > 32)
|
|
85
85
|
throw Error("Max name length = 32");
|
|
86
86
|
if (symbol.length > 10)
|
|
@@ -171,10 +171,10 @@ export const _setOracle = (poolAddress, oracleAddress, methodName, estimateGas)
|
|
|
171
171
|
yield curve.updateFeeData();
|
|
172
172
|
return yield poolContract.set_oracle(methodId, oracleAddress, Object.assign(Object.assign({}, curve.options), { gasLimit }));
|
|
173
173
|
});
|
|
174
|
-
export const setOracleEstimateGas = (
|
|
174
|
+
export const setOracleEstimateGas = (poolAddress_1, ...args_1) => __awaiter(void 0, [poolAddress_1, ...args_1], void 0, function* (poolAddress, oracleAddress = curve.constants.ZERO_ADDRESS, methodName = "0x00000000") {
|
|
175
175
|
return yield _setOracle(poolAddress, oracleAddress, methodName, true);
|
|
176
176
|
});
|
|
177
|
-
export const setOracle = (
|
|
177
|
+
export const setOracle = (poolAddress_1, ...args_1) => __awaiter(void 0, [poolAddress_1, ...args_1], void 0, function* (poolAddress, oracleAddress = curve.constants.ZERO_ADDRESS, methodName = "0x00000000") {
|
|
178
178
|
return yield _setOracle(poolAddress, oracleAddress, methodName, false);
|
|
179
179
|
});
|
|
180
180
|
// ------- STABLE META POOLS -------
|
|
@@ -208,10 +208,10 @@ export const deployStableMetaPool = (basePool, name, symbol, coin, A, fee, // %
|
|
|
208
208
|
implementationIdx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
209
209
|
return yield _deployStableMetaPool(basePool, name, symbol, coin, A, fee, implementationIdx, false);
|
|
210
210
|
});
|
|
211
|
-
const _deployStableNgMetaPool = (basePool, name, symbol, coin, A, fee, // %
|
|
211
|
+
const _deployStableNgMetaPool = (basePool_1, name_1, symbol_1, coin_1, A_1, fee_1, offpegFeeMultiplier_1, assetType_1, ...args_1) => __awaiter(void 0, [basePool_1, name_1, symbol_1, coin_1, A_1, fee_1, offpegFeeMultiplier_1, assetType_1, ...args_1], void 0, function* (basePool, name, symbol, coin, A, fee, // %
|
|
212
212
|
offpegFeeMultiplier, assetType, // 0 = Standard, 1 = Oracle, 2 = Rebasing, 3 = ERC4626
|
|
213
213
|
emaTime = 600, // seconds
|
|
214
|
-
implementationIdx = 0, methodName = "0x00000000", oracleAddress = curve.constants.ZERO_ADDRESS, estimateGas)
|
|
214
|
+
implementationIdx = 0, methodName = "0x00000000", oracleAddress = curve.constants.ZERO_ADDRESS, estimateGas) {
|
|
215
215
|
if (name.length > 32)
|
|
216
216
|
throw Error("Max name length = 32");
|
|
217
217
|
if (symbol.length > 10)
|
|
@@ -8,19 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { curve } from "../curve.js";
|
|
11
|
-
import factoryGaugeABI from "../constants/abis/gauge_factory.json"
|
|
12
|
-
import gaugeChildABI from "../constants/abis/gauge_child.json"
|
|
13
|
-
import ERC20ABI from "../constants/abis/ERC20.json"
|
|
14
|
-
import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json"
|
|
15
|
-
import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json"
|
|
16
|
-
import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json"
|
|
17
|
-
import tricryptoFactoryEthDisabledSwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool-eth-disabled.json"
|
|
11
|
+
import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
|
|
12
|
+
import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
|
|
13
|
+
import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
|
|
14
|
+
import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json" with { type: 'json' };
|
|
15
|
+
import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json" with { type: 'json' };
|
|
16
|
+
import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" with { type: 'json' };
|
|
17
|
+
import tricryptoFactoryEthDisabledSwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool-eth-disabled.json" with { type: 'json' };
|
|
18
18
|
import { getPoolIdByAddress, setFactoryZapContracts } from "./common.js";
|
|
19
19
|
import { _getPoolsFromApi } from "../external-api.js";
|
|
20
20
|
import { assetTypeNameHandler, getPoolName, isStableNgPool } from "../utils.js";
|
|
21
|
-
import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json"
|
|
22
|
-
import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json"
|
|
23
|
-
import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json"
|
|
21
|
+
import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json" with { type: 'json' };
|
|
22
|
+
import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" with { type: 'json' };
|
|
23
|
+
import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" with { type: 'json' };
|
|
24
24
|
export const lowerCasePoolDataAddresses = (poolsData) => {
|
|
25
25
|
var _a;
|
|
26
26
|
for (const poolData of poolsData) {
|
|
@@ -85,8 +85,8 @@ function setFactoryCoinsContracts(rawPoolList) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
export function getFactoryPoolsDataFromApi(factoryType) {
|
|
88
|
-
var _a;
|
|
89
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
var _a;
|
|
90
90
|
const network = this.constants.NETWORK_NAME;
|
|
91
91
|
const is_ng = ["factory-stable-ng", "factory-twocrypto", "factory-tricrypto"].includes(factoryType);
|
|
92
92
|
const isCrypto = ["factory-crypto", "factory-twocrypto", "factory-tricrypto"].includes(factoryType);
|
|
@@ -239,7 +239,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
239
239
|
token_address: pool.address,
|
|
240
240
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS,
|
|
241
241
|
deposit_address,
|
|
242
|
-
implementation_address: pool.implementationAddress,
|
|
242
|
+
implementation_address: pool.implementationAddress, // Only for testing
|
|
243
243
|
is_meta: true,
|
|
244
244
|
is_factory: true,
|
|
245
245
|
base_pool: basePoolId,
|
|
@@ -265,7 +265,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
265
265
|
swap_address: pool.address,
|
|
266
266
|
token_address: pool.address,
|
|
267
267
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS,
|
|
268
|
-
implementation_address: pool.implementationAddress,
|
|
268
|
+
implementation_address: pool.implementationAddress, // Only for testing
|
|
269
269
|
is_plain: true,
|
|
270
270
|
is_factory: true,
|
|
271
271
|
underlying_coins: coinNames,
|
|
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { curve } from "../curve.js";
|
|
11
|
-
import ERC20ABI from "../constants/abis/ERC20.json"
|
|
12
|
-
import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json"
|
|
13
|
-
import factoryGaugeABI from "../constants/abis/gauge_factory.json"
|
|
14
|
-
import gaugeChildABI from "../constants/abis/gauge_child.json"
|
|
11
|
+
import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
|
|
12
|
+
import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json" with { type: 'json' };
|
|
13
|
+
import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
|
|
14
|
+
import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
|
|
15
15
|
import { setFactoryZapContracts } from "./common.js";
|
|
16
16
|
const deepFlatten = (arr) => [].concat(...arr.map((v) => (Array.isArray(v) ? deepFlatten(v) : v)));
|
|
17
17
|
function getRecentlyCreatedCryptoPoolId(swapAddress) {
|
|
@@ -26,8 +26,8 @@ function getRecentlyCreatedCryptoPoolId(swapAddress) {
|
|
|
26
26
|
throw Error("Unknown pool");
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
function getCryptoFactoryIdsAndSwapAddresses(
|
|
30
|
-
return __awaiter(this,
|
|
29
|
+
function getCryptoFactoryIdsAndSwapAddresses() {
|
|
30
|
+
return __awaiter(this, arguments, void 0, function* (fromIdx = 0) {
|
|
31
31
|
const factoryContract = this.contracts[this.constants.ALIASES.crypto_factory].contract;
|
|
32
32
|
const factoryMulticallContract = this.contracts[this.constants.ALIASES.crypto_factory].multicallContract;
|
|
33
33
|
const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
|
|
@@ -195,9 +195,9 @@ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, e
|
|
|
195
195
|
return [tokenSymbols, tokenNames, coinAddrNamesDict, coinAddrDecimalsDict];
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
export function getCryptoFactoryPoolData(
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
export function getCryptoFactoryPoolData() {
|
|
199
|
+
return __awaiter(this, arguments, void 0, function* (fromIdx = 0, swapAddress) {
|
|
200
|
+
var _a, _b;
|
|
201
201
|
const [poolIds, swapAddresses] = swapAddress ?
|
|
202
202
|
[[yield getRecentlyCreatedCryptoPoolId.call(this, swapAddress)], [swapAddress.toLowerCase()]]
|
|
203
203
|
: yield getCryptoFactoryIdsAndSwapAddresses.call(this, fromIdx);
|
|
@@ -262,7 +262,7 @@ export function getCryptoFactoryPoolData(fromIdx = 0, swapAddress) {
|
|
|
262
262
|
token_address: tokenAddresses[i],
|
|
263
263
|
gauge_address: gaugeAddresses[i],
|
|
264
264
|
is_crypto: true,
|
|
265
|
-
is_plain: underlyingCoinAddresses[i].toString() === coinAddresses[i].toString(),
|
|
265
|
+
is_plain: underlyingCoinAddresses[i].toString() === coinAddresses[i].toString(), // WETH/ETH - NOT Plain
|
|
266
266
|
is_factory: true,
|
|
267
267
|
underlying_coins: [...underlyingCoinAddresses[i].map((addr) => coinAddressNameDict[addr])],
|
|
268
268
|
wrapped_coins: [...coinAddresses[i].map((addr) => coinAddressNameDict[addr])],
|
|
@@ -8,11 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { curve } from "../curve.js";
|
|
11
|
-
import ERC20ABI from "../constants/abis/ERC20.json"
|
|
12
|
-
import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json"
|
|
13
|
-
import tricryptoFactoryEthDisabledSwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool-eth-disabled.json"
|
|
14
|
-
import factoryGaugeABI from "../constants/abis/gauge_factory.json"
|
|
15
|
-
import gaugeChildABI from "../constants/abis/gauge_child.json"
|
|
11
|
+
import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
|
|
12
|
+
import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" with { type: 'json' };
|
|
13
|
+
import tricryptoFactoryEthDisabledSwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool-eth-disabled.json" with { type: 'json' };
|
|
14
|
+
import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
|
|
15
|
+
import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
|
|
16
16
|
const deepFlatten = (arr) => [].concat(...arr.map((v) => (Array.isArray(v) ? deepFlatten(v) : v)));
|
|
17
17
|
function getRecentlyCreatedCryptoPoolId(swapAddress) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -26,8 +26,8 @@ function getRecentlyCreatedCryptoPoolId(swapAddress) {
|
|
|
26
26
|
throw Error("Unknown pool");
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
function getCryptoFactoryIdsAndSwapAddresses(
|
|
30
|
-
return __awaiter(this,
|
|
29
|
+
function getCryptoFactoryIdsAndSwapAddresses() {
|
|
30
|
+
return __awaiter(this, arguments, void 0, function* (fromIdx = 0) {
|
|
31
31
|
const factoryContract = this.contracts[this.constants.ALIASES.tricrypto_factory].contract;
|
|
32
32
|
const factoryMulticallContract = this.contracts[this.constants.ALIASES.tricrypto_factory].multicallContract;
|
|
33
33
|
const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
|
|
@@ -166,9 +166,9 @@ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, e
|
|
|
166
166
|
return [tokenSymbols, tokenNames, coinAddrNamesDict, coinAddrDecimalsDict];
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
export function getTricryptoFactoryPoolData(
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
export function getTricryptoFactoryPoolData() {
|
|
170
|
+
return __awaiter(this, arguments, void 0, function* (fromIdx = 0, swapAddress) {
|
|
171
|
+
var _a;
|
|
172
172
|
const [poolIds, swapAddresses] = swapAddress ?
|
|
173
173
|
[[yield getRecentlyCreatedCryptoPoolId.call(this, swapAddress)], [swapAddress.toLowerCase()]]
|
|
174
174
|
: yield getCryptoFactoryIdsAndSwapAddresses.call(this, fromIdx);
|
|
@@ -205,7 +205,7 @@ export function getTricryptoFactoryPoolData(fromIdx = 0, swapAddress) {
|
|
|
205
205
|
token_address: swapAddresses[i],
|
|
206
206
|
gauge_address: gaugeAddresses[i],
|
|
207
207
|
is_crypto: true,
|
|
208
|
-
is_plain: underlyingCoinAddresses.toString() === coinAddresses[i].toString(),
|
|
208
|
+
is_plain: underlyingCoinAddresses.toString() === coinAddresses[i].toString(), // WETH/ETH - NOT Plain
|
|
209
209
|
is_factory: true,
|
|
210
210
|
underlying_coins: [...underlyingCoinAddresses.map((addr) => coinAddressNameDict[addr])],
|
|
211
211
|
wrapped_coins: [...coinAddresses[i].map((addr) => coinAddressNameDict[addr])],
|
|
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { curve } from "../curve.js";
|
|
11
|
-
import ERC20ABI from "../constants/abis/ERC20.json"
|
|
12
|
-
import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json"
|
|
13
|
-
import factoryGaugeABI from "../constants/abis/gauge_factory.json"
|
|
14
|
-
import gaugeChildABI from "../constants/abis/gauge_child.json"
|
|
11
|
+
import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
|
|
12
|
+
import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json" with { type: 'json' };
|
|
13
|
+
import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
|
|
14
|
+
import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
|
|
15
15
|
const deepFlatten = (arr) => [].concat(...arr.map((v) => (Array.isArray(v) ? deepFlatten(v) : v)));
|
|
16
16
|
function getRecentlyCreatedCryptoPoolId(swapAddress) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -25,8 +25,8 @@ function getRecentlyCreatedCryptoPoolId(swapAddress) {
|
|
|
25
25
|
throw Error("Unknown pool");
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
function getTwocryptoFactoryIdsAndSwapAddresses(
|
|
29
|
-
return __awaiter(this,
|
|
28
|
+
function getTwocryptoFactoryIdsAndSwapAddresses() {
|
|
29
|
+
return __awaiter(this, arguments, void 0, function* (fromIdx = 0) {
|
|
30
30
|
const factoryContract = this.contracts[this.constants.ALIASES.twocrypto_factory].contract;
|
|
31
31
|
const factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
|
|
32
32
|
const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
|
|
@@ -164,8 +164,8 @@ function getCoinsData(tokenAddresses, coinAddresses, existingCoinAddrNameDict, e
|
|
|
164
164
|
return [tokenSymbols, tokenNames, coinAddrNamesDict, coinAddrDecimalsDict];
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
-
export function getTwocryptoFactoryPoolData(
|
|
168
|
-
return __awaiter(this,
|
|
167
|
+
export function getTwocryptoFactoryPoolData() {
|
|
168
|
+
return __awaiter(this, arguments, void 0, function* (fromIdx = 0, swapAddress) {
|
|
169
169
|
const [poolIds, swapAddresses] = swapAddress ?
|
|
170
170
|
[[yield getRecentlyCreatedCryptoPoolId.call(this, swapAddress)], [swapAddress.toLowerCase()]]
|
|
171
171
|
: yield getTwocryptoFactoryIdsAndSwapAddresses.call(this, fromIdx);
|
|
@@ -193,7 +193,7 @@ export function getTwocryptoFactoryPoolData(fromIdx = 0, swapAddress) {
|
|
|
193
193
|
token_address: swapAddresses[i],
|
|
194
194
|
gauge_address: gaugeAddresses[i],
|
|
195
195
|
is_crypto: true,
|
|
196
|
-
is_plain: underlyingCoinAddresses[i].toString() === coinAddresses[i].toString(),
|
|
196
|
+
is_plain: underlyingCoinAddresses[i].toString() === coinAddresses[i].toString(), // WETH/ETH - NOT Plain
|
|
197
197
|
is_factory: true,
|
|
198
198
|
underlying_coins: [...underlyingCoinAddresses[i].map((addr) => coinAddressNameDict[addr])],
|
|
199
199
|
wrapped_coins: [...coinAddresses[i].map((addr) => coinAddressNameDict[addr])],
|
package/lib/factory/factory.js
CHANGED
|
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { Contract as MulticallContract } from "@curvefi/ethcall";
|
|
11
11
|
import { curve } from "../curve.js";
|
|
12
|
-
import ERC20ABI from "../constants/abis/ERC20.json"
|
|
13
|
-
import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json"
|
|
12
|
+
import ERC20ABI from "../constants/abis/ERC20.json" with { type: 'json' };
|
|
13
|
+
import PlainStableSwapNGABI from "../constants/abis/factory-stable-ng/plain-stableswap-ng.json" with { type: 'json' };
|
|
14
14
|
import MetaStableSwapNGABI from "../constants/abis/factory-stable-ng/meta-stableswap-ng.json" assert { type: 'json' };
|
|
15
|
-
import factoryGaugeABI from "../constants/abis/gauge_factory.json"
|
|
16
|
-
import gaugeChildABI from "../constants/abis/gauge_child.json"
|
|
17
|
-
import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json"
|
|
15
|
+
import factoryGaugeABI from "../constants/abis/gauge_factory.json" with { type: 'json' };
|
|
16
|
+
import gaugeChildABI from "../constants/abis/gauge_child.json" with { type: 'json' };
|
|
17
|
+
import StableNgBasePoolZapABI from "../constants/abis/stable-ng-base-pool-zap.json" with { type: 'json' };
|
|
18
18
|
import { getPoolIdByAddress, setFactoryZapContracts } from "./common.js";
|
|
19
19
|
import { getPoolName, isStableNgPool } from "../utils.js";
|
|
20
20
|
export const BLACK_LIST = {
|
|
@@ -71,9 +71,9 @@ function getRecentlyCreatedPoolId(swapAddress, factoryAddress) {
|
|
|
71
71
|
throw Error("Unknown pool");
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
function getFactoryIdsAndSwapAddresses(
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
function getFactoryIdsAndSwapAddresses() {
|
|
75
|
+
return __awaiter(this, arguments, void 0, function* (fromIdx = 0, factoryAddress) {
|
|
76
|
+
var _a;
|
|
77
77
|
const factoryContract = this.contracts[factoryAddress].contract;
|
|
78
78
|
const factoryMulticallContract = this.contracts[factoryAddress].multicallContract;
|
|
79
79
|
const poolCount = Number(curve.formatUnits(yield factoryContract.pool_count(this.constantOptions), 0));
|
|
@@ -222,9 +222,9 @@ function getCoinsData(coinAddresses, existingCoinAddrNameDict, existingCoinAddrD
|
|
|
222
222
|
return [coinAddrNamesDict, coinAddrDecimalsDict];
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
-
export function getFactoryPoolData(
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
export function getFactoryPoolData() {
|
|
226
|
+
return __awaiter(this, arguments, void 0, function* (fromIdx = 0, swapAddress, factoryAddress = curve.constants.ALIASES.factory) {
|
|
227
|
+
var _a, _b, _c;
|
|
228
228
|
const [rawPoolIds, rawSwapAddresses] = swapAddress ?
|
|
229
229
|
[[yield getRecentlyCreatedPoolId.call(this, swapAddress, factoryAddress)], [swapAddress.toLowerCase()]]
|
|
230
230
|
: yield getFactoryIdsAndSwapAddresses.call(this, fromIdx, factoryAddress);
|
|
@@ -282,7 +282,7 @@ export function getFactoryPoolData(fromIdx = 0, swapAddress, factoryAddress = cu
|
|
|
282
282
|
swap_address: swapAddresses[i],
|
|
283
283
|
token_address: swapAddresses[i],
|
|
284
284
|
gauge_address: gaugeAddresses[i],
|
|
285
|
-
implementation_address: implementations[i],
|
|
285
|
+
implementation_address: implementations[i], // Only for testing
|
|
286
286
|
is_plain: true,
|
|
287
287
|
is_factory: true,
|
|
288
288
|
underlying_coins: [...coinAddresses[i].map((addr) => coinAddressNameDict[addr])],
|
|
@@ -324,7 +324,7 @@ export function getFactoryPoolData(fromIdx = 0, swapAddress, factoryAddress = cu
|
|
|
324
324
|
token_address: swapAddresses[i],
|
|
325
325
|
gauge_address: gaugeAddresses[i],
|
|
326
326
|
deposit_address,
|
|
327
|
-
implementation_address: implementations[i],
|
|
327
|
+
implementation_address: implementations[i], // Only for testing
|
|
328
328
|
is_meta: true,
|
|
329
329
|
is_factory: true,
|
|
330
330
|
base_pool: basePools.ids[i],
|