@curvefi/api 2.63.0 → 2.63.1
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/lib/boosting.js +247 -645
- package/lib/constants/L2Networks.js +1 -1
- package/lib/constants/aliases.js +19 -19
- package/lib/constants/coins/arbitrum.js +5 -5
- package/lib/constants/coins/aurora.js +5 -5
- package/lib/constants/coins/avalanche.js +6 -6
- package/lib/constants/coins/base.js +5 -5
- package/lib/constants/coins/bsc.js +5 -5
- package/lib/constants/coins/celo.js +5 -5
- package/lib/constants/coins/ethereum.js +9 -9
- package/lib/constants/coins/fantom.js +7 -7
- package/lib/constants/coins/fraxtal.js +5 -5
- package/lib/constants/coins/kava.js +5 -5
- package/lib/constants/coins/mantle.js +5 -5
- package/lib/constants/coins/moonbeam.js +5 -5
- package/lib/constants/coins/optimism.js +5 -5
- package/lib/constants/coins/polygon.js +6 -6
- package/lib/constants/coins/xdai.js +5 -5
- package/lib/constants/coins/xlayer.js +5 -5
- package/lib/constants/coins/zksync.js +5 -5
- package/lib/constants/pools/arbitrum.js +1 -1
- package/lib/constants/pools/aurora.js +1 -1
- package/lib/constants/pools/avalanche.js +1 -1
- package/lib/constants/pools/base.js +1 -1
- package/lib/constants/pools/bsc.js +1 -1
- package/lib/constants/pools/celo.js +1 -1
- package/lib/constants/pools/ethereum.js +2 -2
- package/lib/constants/pools/fantom.js +1 -1
- package/lib/constants/pools/fraxtal.js +1 -1
- package/lib/constants/pools/kava.js +1 -1
- package/lib/constants/pools/mantle.js +1 -1
- package/lib/constants/pools/moonbeam.js +1 -1
- package/lib/constants/pools/optimism.js +1 -1
- package/lib/constants/pools/polygon.js +1 -1
- package/lib/constants/pools/xdai.js +1 -1
- package/lib/constants/pools/xlayer.js +1 -1
- package/lib/constants/pools/zksync.js +1 -1
- package/lib/constants/tricryptoDeployImplementations.js +1 -1
- package/lib/constants/utils.js +18 -19
- package/lib/constants/volumeNetworks.js +1 -1
- package/lib/curve.d.ts +3 -1
- package/lib/curve.js +534 -909
- package/lib/dao.js +351 -705
- package/lib/external-api.js +127 -256
- package/lib/factory/common.js +4 -4
- package/lib/factory/constants-crypto.js +33 -33
- package/lib/factory/constants.js +34 -34
- package/lib/factory/deploy.js +542 -907
- package/lib/factory/factory-api.js +205 -269
- package/lib/factory/factory-crypto.js +202 -342
- package/lib/factory/factory-tricrypto.js +164 -286
- package/lib/factory/factory-twocrypto.js +151 -269
- package/lib/factory/factory.js +245 -385
- package/lib/index.js +109 -198
- package/lib/interfaces.d.ts +1 -6
- package/lib/pools/PoolTemplate.js +1773 -3025
- package/lib/pools/gaugePool.js +112 -251
- package/lib/pools/mixins/common.js +22 -93
- package/lib/pools/mixins/depositBalancedAmountsMixins.js +52 -118
- package/lib/pools/mixins/depositMixins.js +160 -386
- package/lib/pools/mixins/depositWrappedMixins.js +79 -205
- package/lib/pools/mixins/poolBalancesMixin.js +24 -87
- package/lib/pools/mixins/swapMixins.js +139 -324
- package/lib/pools/mixins/swapWrappedMixins.js +111 -265
- package/lib/pools/mixins/withdrawExpectedMixins.js +27 -91
- package/lib/pools/mixins/withdrawImbalanceMixins.js +111 -293
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +58 -169
- package/lib/pools/mixins/withdrawMixins.js +139 -359
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +20 -75
- package/lib/pools/mixins/withdrawOneCoinMixins.js +140 -360
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +10 -51
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +60 -167
- package/lib/pools/mixins/withdrawWrappedMixins.js +57 -167
- package/lib/pools/poolConstructor.js +5 -25
- package/lib/pools/utils.js +301 -469
- package/lib/route-finder.worker.d.ts +9 -0
- package/lib/route-finder.worker.js +112 -0
- package/lib/route-graph.worker.d.ts +11 -0
- package/lib/route-graph.worker.js +334 -0
- package/lib/router.js +323 -912
- package/lib/utils.d.ts +5 -4
- package/lib/utils.js +539 -918
- package/package.json +1 -1
package/lib/external-api.js
CHANGED
|
@@ -7,301 +7,172 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
-
if (ar || !(i in from)) {
|
|
40
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
-
ar[i] = from[i];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
-
};
|
|
46
10
|
import axios from "axios";
|
|
47
11
|
import memoize from "memoizee";
|
|
48
|
-
export
|
|
49
|
-
var url, response;
|
|
12
|
+
export const _getPoolsFromApi = memoize((network, poolType) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
13
|
var _a;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
56
|
-
case 1:
|
|
57
|
-
response = _b.sent();
|
|
58
|
-
return [2 /*return*/, (_a = response.data.data) !== null && _a !== void 0 ? _a : { poolData: [], tvl: 0, tvlAll: 0 }];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}); }, {
|
|
14
|
+
const url = `https://api.curve.fi/api/getPools/${network}/${poolType}`;
|
|
15
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
16
|
+
return (_a = response.data.data) !== null && _a !== void 0 ? _a : { poolData: [], tvl: 0, tvlAll: 0 };
|
|
17
|
+
}), {
|
|
62
18
|
promise: true,
|
|
63
19
|
maxAge: 5 * 60 * 1000, // 5m
|
|
64
20
|
});
|
|
65
|
-
export
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
url = "https://api.curve.fi/api/getSubgraphData/".concat(network);
|
|
90
|
-
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
91
|
-
case 1:
|
|
92
|
-
response = _d.sent();
|
|
93
|
-
poolsData = response.data.data.poolList.map(function (item) {
|
|
94
|
-
return {
|
|
95
|
-
address: item.address,
|
|
96
|
-
volumeUSD: item.volumeUSD,
|
|
97
|
-
day: item.latestDailyApy,
|
|
98
|
-
week: item.latestWeeklyApy,
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
return [2 /*return*/, {
|
|
102
|
-
poolsData: poolsData !== null && poolsData !== void 0 ? poolsData : [],
|
|
103
|
-
totalVolume: (_a = response.data.data.totalVolume) !== null && _a !== void 0 ? _a : 0,
|
|
104
|
-
cryptoVolume: (_b = response.data.data.cryptoVolume) !== null && _b !== void 0 ? _b : 0,
|
|
105
|
-
cryptoShare: (_c = response.data.data.cryptoShare) !== null && _c !== void 0 ? _c : 0,
|
|
106
|
-
}];
|
|
107
|
-
}
|
|
21
|
+
export const _getAllPoolsFromApi = (network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
return yield Promise.all([
|
|
23
|
+
_getPoolsFromApi(network, "main"),
|
|
24
|
+
_getPoolsFromApi(network, "crypto"),
|
|
25
|
+
_getPoolsFromApi(network, "factory"),
|
|
26
|
+
_getPoolsFromApi(network, "factory-crvusd"),
|
|
27
|
+
_getPoolsFromApi(network, "factory-eywa"),
|
|
28
|
+
_getPoolsFromApi(network, "factory-crypto"),
|
|
29
|
+
_getPoolsFromApi(network, "factory-twocrypto"),
|
|
30
|
+
_getPoolsFromApi(network, "factory-tricrypto"),
|
|
31
|
+
_getPoolsFromApi(network, "factory-stable-ng"),
|
|
32
|
+
]);
|
|
33
|
+
});
|
|
34
|
+
export const _getSubgraphData = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
var _b, _c, _d;
|
|
36
|
+
const url = `https://api.curve.fi/api/getSubgraphData/${network}`;
|
|
37
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
38
|
+
const poolsData = response.data.data.poolList.map((item) => {
|
|
39
|
+
return {
|
|
40
|
+
address: item.address,
|
|
41
|
+
volumeUSD: item.volumeUSD,
|
|
42
|
+
day: item.latestDailyApy,
|
|
43
|
+
week: item.latestWeeklyApy,
|
|
44
|
+
};
|
|
108
45
|
});
|
|
109
|
-
|
|
46
|
+
return {
|
|
47
|
+
poolsData: poolsData !== null && poolsData !== void 0 ? poolsData : [],
|
|
48
|
+
totalVolume: (_b = response.data.data.totalVolume) !== null && _b !== void 0 ? _b : 0,
|
|
49
|
+
cryptoVolume: (_c = response.data.data.cryptoVolume) !== null && _c !== void 0 ? _c : 0,
|
|
50
|
+
cryptoShare: (_d = response.data.data.cryptoShare) !== null && _d !== void 0 ? _d : 0,
|
|
51
|
+
};
|
|
52
|
+
}), {
|
|
110
53
|
promise: true,
|
|
111
54
|
maxAge: 5 * 60 * 1000, // 5m
|
|
112
55
|
});
|
|
113
|
-
export
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
address: item.address,
|
|
126
|
-
volumeUSD: item.volumeUSD,
|
|
127
|
-
day: item.latestDailyApyPcent,
|
|
128
|
-
week: item.latestWeeklyApyPcent,
|
|
129
|
-
};
|
|
130
|
-
});
|
|
131
|
-
return [2 /*return*/, {
|
|
132
|
-
poolsData: poolsData !== null && poolsData !== void 0 ? poolsData : [],
|
|
133
|
-
totalVolume: (_a = response.data.data.totalVolumes.totalVolume) !== null && _a !== void 0 ? _a : 0,
|
|
134
|
-
cryptoVolume: (_b = response.data.data.totalVolumes.totalCryptoVolume) !== null && _b !== void 0 ? _b : 0,
|
|
135
|
-
cryptoShare: (_c = response.data.data.totalVolumes.cryptoVolumeSharePcent) !== null && _c !== void 0 ? _c : 0,
|
|
136
|
-
}];
|
|
137
|
-
}
|
|
56
|
+
export const _getVolumes = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
var _e, _f, _g;
|
|
58
|
+
const url = `https://api.curve.fi/api/getVolumes/${network}`;
|
|
59
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
60
|
+
const poolsData = response.data.data.pools.map((item) => {
|
|
61
|
+
return {
|
|
62
|
+
address: item.address,
|
|
63
|
+
volumeUSD: item.volumeUSD,
|
|
64
|
+
day: item.latestDailyApyPcent,
|
|
65
|
+
week: item.latestWeeklyApyPcent,
|
|
66
|
+
};
|
|
138
67
|
});
|
|
139
|
-
|
|
68
|
+
return {
|
|
69
|
+
poolsData: poolsData !== null && poolsData !== void 0 ? poolsData : [],
|
|
70
|
+
totalVolume: (_e = response.data.data.totalVolumes.totalVolume) !== null && _e !== void 0 ? _e : 0,
|
|
71
|
+
cryptoVolume: (_f = response.data.data.totalVolumes.totalCryptoVolume) !== null && _f !== void 0 ? _f : 0,
|
|
72
|
+
cryptoShare: (_g = response.data.data.totalVolumes.cryptoVolumeSharePcent) !== null && _g !== void 0 ? _g : 0,
|
|
73
|
+
};
|
|
74
|
+
}), {
|
|
140
75
|
promise: true,
|
|
141
76
|
maxAge: 5 * 60 * 1000, // 5m
|
|
142
77
|
});
|
|
143
|
-
export
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
address: item.poolAddress,
|
|
163
|
-
volumeUSD: (_a = item.totalVolumeUsd) !== null && _a !== void 0 ? _a : 0,
|
|
164
|
-
day: (_b = item.apy) !== null && _b !== void 0 ? _b : 0,
|
|
165
|
-
week: (_c = item.apy * 7) !== null && _c !== void 0 ? _c : 0, //Because api does not return week apy
|
|
166
|
-
};
|
|
167
|
-
});
|
|
168
|
-
return [2 /*return*/, {
|
|
169
|
-
poolsData: poolsData !== null && poolsData !== void 0 ? poolsData : [],
|
|
170
|
-
totalVolume: (_a = stableVolume + cryptoVolume) !== null && _a !== void 0 ? _a : 0,
|
|
171
|
-
cryptoVolume: cryptoVolume !== null && cryptoVolume !== void 0 ? cryptoVolume : 0,
|
|
172
|
-
cryptoShare: 100 * cryptoVolume / (stableVolume + cryptoVolume) || 0,
|
|
173
|
-
}];
|
|
174
|
-
}
|
|
78
|
+
export const _getFactoryAPYs = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
+
var _h;
|
|
80
|
+
const urlStable = `https://api.curve.fi/api/getFactoryAPYs/${network}/stable`;
|
|
81
|
+
const urlCrypto = `https://api.curve.fi/api/getFactoryAPYs/${network}/crypto`;
|
|
82
|
+
const response = yield Promise.all([
|
|
83
|
+
axios.get(urlStable, { validateStatus: () => true }),
|
|
84
|
+
axios.get(urlCrypto, { validateStatus: () => true }),
|
|
85
|
+
]);
|
|
86
|
+
const stableVolume = response[0].data.data.totalVolumeUsd || response[0].data.data.totalVolume || 0;
|
|
87
|
+
const cryptoVolume = response[1].data.data.totalVolumeUsd || response[1].data.data.totalVolume || 0;
|
|
88
|
+
const poolsData = [...response[0].data.data.poolDetails, ...response[1].data.data.poolDetails].map((item) => {
|
|
89
|
+
var _a, _b, _c;
|
|
90
|
+
return {
|
|
91
|
+
address: item.poolAddress,
|
|
92
|
+
volumeUSD: (_a = item.totalVolumeUsd) !== null && _a !== void 0 ? _a : 0,
|
|
93
|
+
day: (_b = item.apy) !== null && _b !== void 0 ? _b : 0,
|
|
94
|
+
week: (_c = item.apy * 7) !== null && _c !== void 0 ? _c : 0, //Because api does not return week apy
|
|
95
|
+
};
|
|
175
96
|
});
|
|
176
|
-
|
|
97
|
+
return {
|
|
98
|
+
poolsData: poolsData !== null && poolsData !== void 0 ? poolsData : [],
|
|
99
|
+
totalVolume: (_h = stableVolume + cryptoVolume) !== null && _h !== void 0 ? _h : 0,
|
|
100
|
+
cryptoVolume: cryptoVolume !== null && cryptoVolume !== void 0 ? cryptoVolume : 0,
|
|
101
|
+
cryptoShare: 100 * cryptoVolume / (stableVolume + cryptoVolume) || 0,
|
|
102
|
+
};
|
|
103
|
+
}), {
|
|
177
104
|
promise: true,
|
|
178
105
|
maxAge: 5 * 60 * 1000, // 5m
|
|
179
106
|
});
|
|
180
107
|
//4
|
|
181
|
-
export
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
url = "https://api.curve.fi/api/getSubgraphData/".concat(network);
|
|
193
|
-
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
194
|
-
case 1:
|
|
195
|
-
response = _a.sent();
|
|
196
|
-
return [2 /*return*/, response.data.data];
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}); }, {
|
|
108
|
+
export const _getTotalVolumes = memoize((network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
109
|
+
if (network === "aurora")
|
|
110
|
+
return {
|
|
111
|
+
totalVolume: 0,
|
|
112
|
+
cryptoVolume: 0,
|
|
113
|
+
cryptoShare: 0,
|
|
114
|
+
}; // Exclude Aurora
|
|
115
|
+
const url = `https://api.curve.fi/api/getSubgraphData/${network}`;
|
|
116
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
117
|
+
return response.data.data;
|
|
118
|
+
}), {
|
|
200
119
|
promise: true,
|
|
201
120
|
maxAge: 5 * 60 * 1000, // 5m
|
|
202
121
|
});
|
|
203
|
-
export
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
url = "https://api.curve.fi/api/getAllGauges";
|
|
209
|
-
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
210
|
-
case 1:
|
|
211
|
-
response = _a.sent();
|
|
212
|
-
return [2 /*return*/, response.data.data];
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}); }, {
|
|
122
|
+
export const _getAllGauges = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
+
const url = `https://api.curve.fi/api/getAllGauges`;
|
|
124
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
125
|
+
return response.data.data;
|
|
126
|
+
}), {
|
|
216
127
|
promise: true,
|
|
217
128
|
maxAge: 5 * 60 * 1000, // 5m
|
|
218
129
|
});
|
|
219
|
-
export
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
Object.values(response.data.data).forEach(function (d) {
|
|
230
|
-
var _a, _b;
|
|
231
|
-
gaugesDict[d.gauge.toLowerCase()] = {
|
|
232
|
-
is_killed: (_a = d.is_killed) !== null && _a !== void 0 ? _a : false,
|
|
233
|
-
gaugeStatus: (_b = d.gaugeStatus) !== null && _b !== void 0 ? _b : null,
|
|
234
|
-
};
|
|
235
|
-
});
|
|
236
|
-
return [2 /*return*/, gaugesDict];
|
|
237
|
-
}
|
|
130
|
+
export const _getAllGaugesFormatted = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
131
|
+
const url = `https://api.curve.fi/api/getAllGauges`;
|
|
132
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
133
|
+
const gaugesDict = {};
|
|
134
|
+
Object.values(response.data.data).forEach((d) => {
|
|
135
|
+
var _a, _b;
|
|
136
|
+
gaugesDict[d.gauge.toLowerCase()] = {
|
|
137
|
+
is_killed: (_a = d.is_killed) !== null && _a !== void 0 ? _a : false,
|
|
138
|
+
gaugeStatus: (_b = d.gaugeStatus) !== null && _b !== void 0 ? _b : null,
|
|
139
|
+
};
|
|
238
140
|
});
|
|
239
|
-
|
|
141
|
+
return gaugesDict;
|
|
142
|
+
}), {
|
|
240
143
|
promise: true,
|
|
241
144
|
maxAge: 60 * 60 * 1000, // 60m
|
|
242
145
|
});
|
|
243
|
-
export
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
url = "https://api.curve.fi/api/getHiddenPools";
|
|
249
|
-
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
250
|
-
case 1:
|
|
251
|
-
response = _a.sent();
|
|
252
|
-
return [2 /*return*/, response.data.data];
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
}); }, {
|
|
146
|
+
export const _getHiddenPools = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
147
|
+
const url = `https://api.curve.fi/api/getHiddenPools`;
|
|
148
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
149
|
+
return response.data.data;
|
|
150
|
+
}), {
|
|
256
151
|
promise: true,
|
|
257
152
|
maxAge: 5 * 60 * 1000, // 5m
|
|
258
153
|
});
|
|
259
|
-
export
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
url = "https://prices.curve.fi/v1/general/get_merkle_proof?block=".concat(block, "&account_address=").concat(address);
|
|
265
|
-
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
266
|
-
case 1:
|
|
267
|
-
response = _a.sent();
|
|
268
|
-
return [2 /*return*/, { block_header_rlp: response.data.block_header_rlp, proof_rlp: response.data.proof_rlp }];
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
}); }, {
|
|
154
|
+
export const _generateBoostingProof = memoize((block, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
|
+
const url = `https://prices.curve.fi/v1/general/get_merkle_proof?block=${block}&account_address=${address}`;
|
|
156
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
157
|
+
return { block_header_rlp: response.data.block_header_rlp, proof_rlp: response.data.proof_rlp };
|
|
158
|
+
}), {
|
|
272
159
|
promise: true,
|
|
273
160
|
maxAge: 5 * 60 * 1000, // 5m
|
|
274
161
|
});
|
|
275
162
|
// --- DAO ---
|
|
276
|
-
export
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
url = "https://api-py.llama.airforce/curve/v1/dao/proposals";
|
|
282
|
-
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
283
|
-
case 1:
|
|
284
|
-
response = _a.sent();
|
|
285
|
-
return [2 /*return*/, response.data.proposals];
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
}); }, {
|
|
163
|
+
export const _getDaoProposalList = memoize(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
164
|
+
const url = "https://api-py.llama.airforce/curve/v1/dao/proposals";
|
|
165
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
166
|
+
return response.data.proposals;
|
|
167
|
+
}), {
|
|
289
168
|
promise: true,
|
|
290
169
|
maxAge: 5 * 60 * 1000, // 5m
|
|
291
170
|
});
|
|
292
|
-
export
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
url = "https://api-py.llama.airforce/curve/v1/dao/proposals/".concat(type.toLowerCase(), "/").concat(id);
|
|
298
|
-
return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
|
|
299
|
-
case 1:
|
|
300
|
-
response = _a.sent();
|
|
301
|
-
return [2 /*return*/, response.data];
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
}); }, {
|
|
171
|
+
export const _getDaoProposal = memoize((type, id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
172
|
+
const url = `https://api-py.llama.airforce/curve/v1/dao/proposals/${type.toLowerCase()}/${id}`;
|
|
173
|
+
const response = yield axios.get(url, { validateStatus: () => true });
|
|
174
|
+
return response.data;
|
|
175
|
+
}), {
|
|
305
176
|
promise: true,
|
|
306
177
|
maxAge: 5 * 60 * 1000, // 5m
|
|
307
178
|
});
|
package/lib/factory/common.js
CHANGED
|
@@ -2,18 +2,18 @@ import { FACTORY_CONSTANTS } from "./constants.js";
|
|
|
2
2
|
import { CRYPTO_FACTORY_CONSTANTS } from "./constants-crypto.js";
|
|
3
3
|
import { getPoolIdBySwapAddress } from "../utils.js";
|
|
4
4
|
export function setFactoryZapContracts(isCrypto) {
|
|
5
|
-
|
|
6
|
-
for (
|
|
5
|
+
const basePoolIdZapDict = (isCrypto ? CRYPTO_FACTORY_CONSTANTS : FACTORY_CONSTANTS)[this.chainId].basePoolIdZapDict;
|
|
6
|
+
for (const basePoolId in basePoolIdZapDict) {
|
|
7
7
|
if (!Object.prototype.hasOwnProperty.call(basePoolIdZapDict, basePoolId))
|
|
8
8
|
continue;
|
|
9
|
-
|
|
9
|
+
const basePool = basePoolIdZapDict[basePoolId];
|
|
10
10
|
if (basePool.address in this.constants)
|
|
11
11
|
continue;
|
|
12
12
|
this.setContract(basePool.address, basePool.ABI);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export function getPoolIdByAddress(poolList, address) {
|
|
16
|
-
|
|
16
|
+
const pool = poolList.find((item) => item.address.toLowerCase() === address.toLowerCase());
|
|
17
17
|
if (pool) {
|
|
18
18
|
return pool.id;
|
|
19
19
|
}
|
|
@@ -3,28 +3,28 @@ import { lowerCaseKeys } from "../constants/utils.js";
|
|
|
3
3
|
import atricrypto3ZapABI from "../constants/abis/atricrypto3/base_pool_zap.json" assert { type: 'json' };
|
|
4
4
|
import tripoolZapABI from "../constants/abis/3pool/meta_zap_crypto.json" assert { type: 'json' };
|
|
5
5
|
import fraxusdcZapABI from "../constants/abis/fraxusdc/meta_zap_crypto.json" assert { type: 'json' };
|
|
6
|
-
export
|
|
6
|
+
export const lpTokenBasePoolIdDictEthereum = lowerCaseKeys({
|
|
7
7
|
'0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490': '3pool',
|
|
8
8
|
'0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC': 'fraxusdc',
|
|
9
9
|
});
|
|
10
|
-
export
|
|
10
|
+
export const lpTokenBasePoolIdDictPolygon = lowerCaseKeys({
|
|
11
11
|
'0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3': 'atricrypto3',
|
|
12
12
|
});
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
13
|
+
export const lpTokenBasePoolIdDictFantom = lowerCaseKeys({});
|
|
14
|
+
export const lpTokenBasePoolIdDictAvalanche = lowerCaseKeys({});
|
|
15
|
+
export const lpTokenBasePoolIdDictArbitrum = lowerCaseKeys({});
|
|
16
|
+
export const lpTokenBasePoolIdDictOptimism = lowerCaseKeys({});
|
|
17
|
+
export const lpTokenBasePoolIdDictXDai = lowerCaseKeys({});
|
|
18
|
+
export const lpTokenBasePoolIdDictMoonbeam = lowerCaseKeys({});
|
|
19
|
+
export const lpTokenBasePoolIdDictKava = lowerCaseKeys({});
|
|
20
|
+
export const lpTokenBasePoolIdDictCelo = lowerCaseKeys({});
|
|
21
|
+
export const lpTokenBasePoolIdDictZkSync = lowerCaseKeys({});
|
|
22
|
+
export const lpTokenBasePoolIdDictBase = lowerCaseKeys({});
|
|
23
|
+
export const lpTokenBasePoolIdDictBsc = lowerCaseKeys({});
|
|
24
|
+
export const lpTokenBasePoolIdDictFraxtal = lowerCaseKeys({});
|
|
25
|
+
export const lpTokenBasePoolIdDictXLayer = lowerCaseKeys({});
|
|
26
|
+
export const lpTokenBasePoolIdDictMantle = lowerCaseKeys({});
|
|
27
|
+
export const basePoolIdZapDictEthereum = {
|
|
28
28
|
'3pool': {
|
|
29
29
|
address: "0x97aDC08FA1D849D2C48C5dcC1DaB568B169b0267".toLowerCase(),
|
|
30
30
|
ABI: tripoolZapABI,
|
|
@@ -34,27 +34,27 @@ export var basePoolIdZapDictEthereum = {
|
|
|
34
34
|
ABI: fraxusdcZapABI,
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export const basePoolIdZapDictPolygon = {
|
|
38
38
|
atricrypto3: {
|
|
39
39
|
address: "0x3d8EADb739D1Ef95dd53D718e4810721837c69c1".toLowerCase(),
|
|
40
40
|
ABI: atricrypto3ZapABI,
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
-
export
|
|
48
|
-
export
|
|
49
|
-
export
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
43
|
+
export const basePoolIdZapDictFantom = {};
|
|
44
|
+
export const basePoolIdZapDictAvalanche = {};
|
|
45
|
+
export const basePoolIdZapDictArbitrum = {};
|
|
46
|
+
export const basePoolIdZapDictOptimism = {};
|
|
47
|
+
export const basePoolIdZapDictXDai = {};
|
|
48
|
+
export const basePoolIdZapDictMoonbeam = {};
|
|
49
|
+
export const basePoolIdZapDictKava = {};
|
|
50
|
+
export const basePoolIdZapDictCelo = {};
|
|
51
|
+
export const basePoolIdZapDictZkSync = {};
|
|
52
|
+
export const basePoolIdZapDictBase = {};
|
|
53
|
+
export const basePoolIdZapDictBsc = {};
|
|
54
|
+
export const basePoolIdZapDictFraxtal = {};
|
|
55
|
+
export const basePoolIdZapDictXLayer = {};
|
|
56
|
+
export const basePoolIdZapDictMantle = {};
|
|
57
|
+
export const CRYPTO_FACTORY_CONSTANTS = {
|
|
58
58
|
1: {
|
|
59
59
|
lpTokenBasePoolIdDict: lpTokenBasePoolIdDictEthereum,
|
|
60
60
|
basePoolIdZapDict: basePoolIdZapDictEthereum,
|