@curvefi/api 2.5.1 → 2.8.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/lib/constants/abis/3pool/swap.json +0 -26
- package/lib/constants/abis/3pool-optimism/swap.json +1074 -0
- package/lib/constants/abis/eursusd2/swap.json +1199 -0
- package/lib/constants/abis/eursusd2/zap.json +270 -0
- package/lib/constants/abis/ren-arbitrum/swap.json +1069 -0
- package/lib/constants/aliases.d.ts +3 -0
- package/lib/constants/aliases.js +37 -1
- package/lib/constants/coins/arbitrum.d.ts +7 -0
- package/lib/constants/coins/arbitrum.js +23 -0
- package/lib/constants/coins/optimism.d.ts +7 -0
- package/lib/constants/coins/optimism.js +21 -0
- package/lib/constants/coins/xdai.d.ts +7 -0
- package/lib/constants/coins/xdai.js +17 -0
- package/lib/constants/pools/arbitrum.d.ts +4 -0
- package/lib/constants/pools/arbitrum.js +125 -0
- package/lib/constants/pools/index.d.ts +4 -1
- package/lib/constants/pools/index.js +7 -1
- package/lib/constants/pools/optimism.d.ts +4 -0
- package/lib/constants/pools/optimism.js +37 -0
- package/lib/constants/pools/xdai.d.ts +4 -0
- package/lib/constants/pools/xdai.js +71 -0
- package/lib/curve.js +40 -5
- package/lib/factory/common.js +26 -0
- package/lib/factory/constants.d.ts +9 -0
- package/lib/factory/constants.js +108 -4
- package/lib/factory/factory-crypto.js +6 -0
- package/lib/factory/factory.js +14 -5
- package/lib/pools/PoolTemplate.js +1 -1
- package/lib/pools/poolConstructor.js +3 -2
- package/lib/pools/utils.js +22 -14
- package/lib/utils.js +10 -1
- package/package.json +1 -1
package/lib/factory/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FACTORY_CONSTANTS = exports.NATIVE_TOKENS = exports.NATIVE_TOKEN_ADDRESS = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictFantom = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictAvalanche = exports.implementationABIDictFantom = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
6
|
+
exports.FACTORY_CONSTANTS = exports.NATIVE_TOKENS = exports.NATIVE_TOKEN_ADDRESS = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictXDai = exports.implementationBasePoolIdDictOptimism = exports.implementationBasePoolIdDictArbitrum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictFantom = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictXDai = exports.implementationABIDictOptimism = exports.implementationABIDictArbitrum = exports.implementationABIDictAvalanche = exports.implementationABIDictFantom = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
7
7
|
var swap_json_1 = __importDefault(require("../constants/abis/factoryPools/swap.json"));
|
|
8
8
|
var MetaUSD_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSD.json"));
|
|
9
9
|
var MetaUSDBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSDBalances.json"));
|
|
@@ -105,6 +105,56 @@ exports.implementationABIDictAvalanche = {
|
|
|
105
105
|
"0x0eb0F1FaF5F509Ac53fA224477509EAD167cf410": Plain4ETH_json_1.default,
|
|
106
106
|
"0xCE94D3E5b0D80565D7B713A687b39a3Dc81780BA": Plain4Optimized_json_1.default,
|
|
107
107
|
};
|
|
108
|
+
exports.implementationABIDictArbitrum = {
|
|
109
|
+
"0x09672362833d8f703D5395ef3252D4Bfa51c15ca": MetaUSD_json_1.default,
|
|
110
|
+
"0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5": MetaUSDBalances_json_1.default,
|
|
111
|
+
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": MetaBTCRen_json_1.default,
|
|
112
|
+
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": MetaBTCBalancesRen_json_1.default,
|
|
113
|
+
"0x54e8A25d0Ac0E4945b697C80b8372445FEA17A62": Plain2Basic_json_1.default,
|
|
114
|
+
"0xD68970e266cE1A015953897C7055a5E0bC657Af8": Plain2Balances_json_1.default,
|
|
115
|
+
"0x7DA64233Fefb352f8F501B357c018158ED8aA455": Plain2ETH_json_1.default,
|
|
116
|
+
"0x0100fBf414071977B19fC38e6fc7c32FE444F5C9": Plain2Optimized_json_1.default,
|
|
117
|
+
"0xe381C25de995d62b453aF8B931aAc84fcCaa7A62": Plain3Basic_json_1.default,
|
|
118
|
+
"0xc379bA7b8e1c6C48D64e1cf9dD602C97c9fD0F40": Plain3Balances_json_1.default,
|
|
119
|
+
"0xAAe75FAebCae43b9d541Fd875622BE48D9B4f5D0": Plain3ETH_json_1.default,
|
|
120
|
+
"0x8866414733F22295b7563f9C5299715D2D76CAf4": Plain3Optimized_json_1.default,
|
|
121
|
+
"0x8d53E5De033078367Ad91527c53abfd1Eb6bfa86": Plain4Basic_json_1.default,
|
|
122
|
+
"0x2ac56cEBc2D27c9bB51a11773355E44371Eb88D3": Plain4Balances_json_1.default,
|
|
123
|
+
"0x89287c32c2CAC1C76227F6d300B2DBbab6b75C08": Plain4ETH_json_1.default,
|
|
124
|
+
"0x06e3C4da96fd076b97b7ca3Ae23527314b6140dF": Plain4Optimized_json_1.default,
|
|
125
|
+
};
|
|
126
|
+
exports.implementationABIDictOptimism = {
|
|
127
|
+
"0x78CF256256C8089d68Cde634Cf7cDEFb39286470": MetaUSD_json_1.default,
|
|
128
|
+
"0xADf698e4d8Df08b3E2c79682891636eF00F6e205": MetaUSDBalances_json_1.default,
|
|
129
|
+
"0xC2b1DF84112619D190193E48148000e3990Bf627": Plain2Basic_json_1.default,
|
|
130
|
+
"0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90": Plain2Balances_json_1.default,
|
|
131
|
+
"0x4f3E8F405CF5aFC05D68142F3783bDfE13811522": Plain2ETH_json_1.default,
|
|
132
|
+
"0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1": Plain2Optimized_json_1.default,
|
|
133
|
+
"0x78D0fC2B9D5AE65512DB242e424a9c683F18c243": Plain3Basic_json_1.default,
|
|
134
|
+
"0x35796DAc54f144DFBAD1441Ec7C32313A7c29F39": Plain3Balances_json_1.default,
|
|
135
|
+
"0x6600e98b71dabfD4A8Cac03b302B0189Adb86Afb": Plain3ETH_json_1.default,
|
|
136
|
+
"0x6D65b498cb23deAba52db31c93Da9BFFb340FB8F": Plain3Optimized_json_1.default,
|
|
137
|
+
"0x445FE580eF8d70FF569aB36e80c647af338db351": Plain4Basic_json_1.default,
|
|
138
|
+
"0xF6bDc2619FFDA72c537Cd9605e0A274Dc48cB1C9": Plain4Balances_json_1.default,
|
|
139
|
+
"0x1AEf73d49Dedc4b1778d0706583995958Dc862e6": Plain4ETH_json_1.default,
|
|
140
|
+
"0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6": Plain4Optimized_json_1.default,
|
|
141
|
+
};
|
|
142
|
+
exports.implementationABIDictXDai = {
|
|
143
|
+
"0x4A5bF7Ab9A8202692051c19B102d3eDD62aaBAE6": MetaUSD_json_1.default,
|
|
144
|
+
"0x0B4dc7A945695D11FD83e40B2DfC2B896A02395F": MetaUSDBalances_json_1.default,
|
|
145
|
+
"0x04e39EF8332e979Cf8e4f8891E64934FF65F231b": Plain2Basic_json_1.default,
|
|
146
|
+
"0xC9438d8928486bD9621D326002F4672bF684187A": Plain2Balances_json_1.default,
|
|
147
|
+
"0x2b70A5B878665FfDB4A06Ba40a264d6c70f68F4B": Plain2ETH_json_1.default,
|
|
148
|
+
"0x2D036f0Ff6F440dB623e0D9D3B5Daa509e5500C3": Plain2Optimized_json_1.default,
|
|
149
|
+
"0xec9cEBE650E181079576C1b6d0d2e092B1EdfF13": Plain3Basic_json_1.default,
|
|
150
|
+
"0xe8269B33E47761f552E1a3070119560d5fa8bBD6": Plain3Balances_json_1.default,
|
|
151
|
+
"0x114C4042B11a2b16F58Fe1BFe847589a122F678a": Plain3ETH_json_1.default,
|
|
152
|
+
"0x4244eB811D6e0Ef302326675207A95113dB4E1F8": Plain3Optimized_json_1.default,
|
|
153
|
+
"0x66B5792ED50a2a7405Ea75C4B6B1913eF4E46661": Plain4Basic_json_1.default,
|
|
154
|
+
"0xcB4eB43E31C830e22baF764c64F11F32C280496c": Plain4Balances_json_1.default,
|
|
155
|
+
"0xc1C49622b63B961ce1D352ecb7D8261Ab5556695": Plain4ETH_json_1.default,
|
|
156
|
+
"0x0E2615ce69Cd3Dc3Ff6f66a975bEa0655F3bA7b9": Plain4Optimized_json_1.default,
|
|
157
|
+
};
|
|
108
158
|
exports.implementationBasePoolIdDictEthereum = {
|
|
109
159
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
|
|
110
160
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
|
|
@@ -136,6 +186,20 @@ exports.implementationBasePoolIdDictAvalanche = {
|
|
|
136
186
|
"0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": "ren",
|
|
137
187
|
"0x505C34ED8dBE96d2D5C7D83158aA844887770970": "ren",
|
|
138
188
|
};
|
|
189
|
+
exports.implementationBasePoolIdDictArbitrum = {
|
|
190
|
+
"0x09672362833d8f703D5395ef3252D4Bfa51c15ca": "2pool",
|
|
191
|
+
"0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5": "2pool",
|
|
192
|
+
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": "ren",
|
|
193
|
+
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": "ren",
|
|
194
|
+
};
|
|
195
|
+
exports.implementationBasePoolIdDictOptimism = {
|
|
196
|
+
"0x78CF256256C8089d68Cde634Cf7cDEFb39286470": "3pool",
|
|
197
|
+
"0xADf698e4d8Df08b3E2c79682891636eF00F6e205": "3pool",
|
|
198
|
+
};
|
|
199
|
+
exports.implementationBasePoolIdDictXDai = {
|
|
200
|
+
"0x4A5bF7Ab9A8202692051c19B102d3eDD62aaBAE6": "3pool",
|
|
201
|
+
"0x0B4dc7A945695D11FD83e40B2DfC2B896A02395F": "3pool",
|
|
202
|
+
};
|
|
139
203
|
exports.basePoolIdZapDictEthereum = {
|
|
140
204
|
'3pool': "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
141
205
|
fraxusdc: "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase(),
|
|
@@ -155,22 +219,47 @@ exports.basePoolIdZapDictAvalanche = {
|
|
|
155
219
|
aave: "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase(),
|
|
156
220
|
ren: "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase(),
|
|
157
221
|
};
|
|
222
|
+
exports.basePoolIdZapDictArbitrum = {
|
|
223
|
+
"2pool": "0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287".toLowerCase(),
|
|
224
|
+
ren: "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2".toLowerCase(),
|
|
225
|
+
};
|
|
226
|
+
exports.basePoolIdZapDictOptimism = {
|
|
227
|
+
"3pool": "0x167e42a1c7ab4be03764a2222aac57f5f6754411".toLowerCase(),
|
|
228
|
+
};
|
|
229
|
+
exports.basePoolIdZapDictXDai = {
|
|
230
|
+
"3pool": "0x87C067fAc25f123554a0E76596BF28cFa37fD5E9".toLowerCase(),
|
|
231
|
+
};
|
|
158
232
|
exports.NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
159
233
|
exports.NATIVE_TOKENS = {
|
|
160
234
|
1: {
|
|
161
235
|
symbol: 'ETH',
|
|
162
236
|
wrappedSymbol: 'WETH',
|
|
163
|
-
wrappedAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
237
|
+
wrappedAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'.toLowerCase(),
|
|
238
|
+
},
|
|
239
|
+
10: {
|
|
240
|
+
symbol: 'ETH',
|
|
241
|
+
wrappedSymbol: 'WETH',
|
|
242
|
+
wrappedAddress: '0x4200000000000000000000000000000000000006'.toLowerCase(),
|
|
243
|
+
},
|
|
244
|
+
100: {
|
|
245
|
+
symbol: 'XDAi',
|
|
246
|
+
wrappedSymbol: 'WXDAI',
|
|
247
|
+
wrappedAddress: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d'.toLowerCase(),
|
|
164
248
|
},
|
|
165
249
|
137: {
|
|
166
250
|
symbol: 'MATIC',
|
|
167
251
|
wrappedSymbol: 'WMATIC',
|
|
168
|
-
wrappedAddress: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',
|
|
252
|
+
wrappedAddress: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'.toLowerCase(),
|
|
169
253
|
},
|
|
170
254
|
250: {
|
|
171
255
|
symbol: 'FTM',
|
|
172
256
|
wrappedSymbol: 'WFTM',
|
|
173
|
-
wrappedAddress: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83',
|
|
257
|
+
wrappedAddress: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83'.toLowerCase(),
|
|
258
|
+
},
|
|
259
|
+
42161: {
|
|
260
|
+
symbol: 'ETH',
|
|
261
|
+
wrappedSymbol: 'WETH',
|
|
262
|
+
wrappedAddress: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'.toLowerCase(),
|
|
174
263
|
},
|
|
175
264
|
};
|
|
176
265
|
exports.FACTORY_CONSTANTS = {
|
|
@@ -179,6 +268,16 @@ exports.FACTORY_CONSTANTS = {
|
|
|
179
268
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictEthereum,
|
|
180
269
|
basePoolIdZapDict: exports.basePoolIdZapDictEthereum,
|
|
181
270
|
},
|
|
271
|
+
10: {
|
|
272
|
+
implementationABIDict: exports.implementationABIDictOptimism,
|
|
273
|
+
implementationBasePoolIdDict: exports.implementationBasePoolIdDictOptimism,
|
|
274
|
+
basePoolIdZapDict: exports.basePoolIdZapDictOptimism,
|
|
275
|
+
},
|
|
276
|
+
100: {
|
|
277
|
+
implementationABIDict: exports.implementationABIDictXDai,
|
|
278
|
+
implementationBasePoolIdDict: exports.implementationBasePoolIdDictXDai,
|
|
279
|
+
basePoolIdZapDict: exports.basePoolIdZapDictXDai,
|
|
280
|
+
},
|
|
182
281
|
137: {
|
|
183
282
|
implementationABIDict: exports.implementationABIDictPolygon,
|
|
184
283
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictPolygon,
|
|
@@ -194,4 +293,9 @@ exports.FACTORY_CONSTANTS = {
|
|
|
194
293
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictAvalanche,
|
|
195
294
|
basePoolIdZapDict: exports.basePoolIdZapDictAvalanche,
|
|
196
295
|
},
|
|
296
|
+
42161: {
|
|
297
|
+
implementationABIDict: exports.implementationABIDictArbitrum,
|
|
298
|
+
implementationBasePoolIdDict: exports.implementationBasePoolIdDictArbitrum,
|
|
299
|
+
basePoolIdZapDict: exports.basePoolIdZapDictArbitrum,
|
|
300
|
+
},
|
|
197
301
|
};
|
|
@@ -223,12 +223,18 @@ function getExistingCoinAddressNameDict() {
|
|
|
223
223
|
}
|
|
224
224
|
if (this.chainId === 1)
|
|
225
225
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
|
|
226
|
+
if (this.chainId === 10)
|
|
227
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
|
|
228
|
+
if (this.chainId === 100)
|
|
229
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "XDAI";
|
|
226
230
|
if (this.chainId === 137)
|
|
227
231
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "MATIC";
|
|
228
232
|
if (this.chainId === 250)
|
|
229
233
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "FTM";
|
|
230
234
|
if (this.chainId === 43114)
|
|
231
235
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "AVAX";
|
|
236
|
+
if (this.chainId === 42161)
|
|
237
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
|
|
232
238
|
return dict;
|
|
233
239
|
}
|
|
234
240
|
function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
|
package/lib/factory/factory.js
CHANGED
|
@@ -58,6 +58,8 @@ var common_1 = require("./common");
|
|
|
58
58
|
var constants_1 = require("./constants");
|
|
59
59
|
var BLACK_LIST = {
|
|
60
60
|
1: [],
|
|
61
|
+
10: [],
|
|
62
|
+
100: [],
|
|
61
63
|
137: [
|
|
62
64
|
"0x666dc3b4babfd063faf965bd020024af0dc51b64",
|
|
63
65
|
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
|
|
@@ -65,6 +67,7 @@ var BLACK_LIST = {
|
|
|
65
67
|
],
|
|
66
68
|
250: [],
|
|
67
69
|
43114: [],
|
|
70
|
+
42161: [],
|
|
68
71
|
};
|
|
69
72
|
var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
|
|
70
73
|
function getFactoryIdsAndSwapAddresses() {
|
|
@@ -253,13 +256,19 @@ function getExistingCoinAddressNameDict() {
|
|
|
253
256
|
_loop_1(poolData);
|
|
254
257
|
}
|
|
255
258
|
if (this.chainId === 1)
|
|
256
|
-
dict[
|
|
259
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
|
|
260
|
+
if (this.chainId === 10)
|
|
261
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
|
|
262
|
+
if (this.chainId === 100)
|
|
263
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "XDAI";
|
|
257
264
|
if (this.chainId === 137)
|
|
258
|
-
dict[
|
|
265
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "MATIC";
|
|
259
266
|
if (this.chainId === 250)
|
|
260
|
-
dict[
|
|
267
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "FTM";
|
|
261
268
|
if (this.chainId === 43114)
|
|
262
|
-
dict[
|
|
269
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "AVAX";
|
|
270
|
+
if (this.chainId === 42161)
|
|
271
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
|
|
263
272
|
return dict;
|
|
264
273
|
}
|
|
265
274
|
function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
|
|
@@ -323,7 +332,7 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
|
|
|
323
332
|
newCoinAddresses.forEach(function (addr, i) {
|
|
324
333
|
coinAddrNamesDict[addr] = decimals[i];
|
|
325
334
|
});
|
|
326
|
-
coinAddrNamesDict[
|
|
335
|
+
coinAddrNamesDict[constants_1.NATIVE_TOKEN_ADDRESS] = 18;
|
|
327
336
|
return [2 /*return*/, coinAddrNamesDict];
|
|
328
337
|
}
|
|
329
338
|
});
|
|
@@ -262,7 +262,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
262
262
|
case 0:
|
|
263
263
|
if (this.gauge === ethers_1.ethers.constants.AddressZero)
|
|
264
264
|
return [2 /*return*/, []];
|
|
265
|
-
if (![137, 250, 43114].includes(curve_1.curve.chainId)) return [3 /*break*/, 8];
|
|
265
|
+
if (![10, 100, 137, 250, 43114, 42161].includes(curve_1.curve.chainId)) return [3 /*break*/, 8];
|
|
266
266
|
apy = [];
|
|
267
267
|
return [4 /*yield*/, this.rewardTokens()];
|
|
268
268
|
case 1:
|
|
@@ -16,6 +16,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.getPool = void 0;
|
|
19
|
+
var curve_1 = require("../curve");
|
|
19
20
|
var PoolTemplate_1 = require("./PoolTemplate");
|
|
20
21
|
var poolBalancesMixin_1 = require("./mixins/poolBalancesMixin");
|
|
21
22
|
var depositBalancedAmountsMixins_1 = require("./mixins/depositBalancedAmountsMixins");
|
|
@@ -226,7 +227,7 @@ var getPool = function (poolId) {
|
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
229
|
// swap and swapEstimateGas
|
|
229
|
-
if (
|
|
230
|
+
if ('exchange(uint256,uint256,uint256,uint256,bool)' in curve_1.curve.contracts[poolDummy.address].contract) { // tricrypto2 (eth), tricrypto (arbitrum)
|
|
230
231
|
Object.assign(Pool.prototype, swapMixins_1.swapTricrypto2Mixin);
|
|
231
232
|
}
|
|
232
233
|
else if (poolDummy.isMetaFactory && (0, exports.getPool)(poolDummy.basePool).isLending) {
|
|
@@ -238,7 +239,7 @@ var getPool = function (poolId) {
|
|
|
238
239
|
// swapWrapped and swapWrappedEstimateGas
|
|
239
240
|
if (!poolDummy.isPlain && !poolDummy.isFake) {
|
|
240
241
|
Object.assign(Pool.prototype, swapWrappedMixins_1.swapWrappedExpectedAndApproveMixin);
|
|
241
|
-
if (
|
|
242
|
+
if ('exchange(uint256,uint256,uint256,uint256,bool)' in curve_1.curve.contracts[poolDummy.address].contract) { // tricrypto2 (eth), tricrypto (arbitrum)
|
|
242
243
|
Object.assign(Pool.prototype, swapWrappedMixins_1.swapWrappedTricrypto2Mixin);
|
|
243
244
|
}
|
|
244
245
|
else {
|
package/lib/pools/utils.js
CHANGED
|
@@ -46,6 +46,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.getUserPoolList = exports.getCryptoFactoryPoolList = exports.getFactoryPoolList = exports.getPoolList = void 0;
|
|
49
|
+
var ethers_1 = require("ethers");
|
|
49
50
|
var curve_1 = require("../curve");
|
|
50
51
|
var poolConstructor_1 = require("./poolConstructor");
|
|
51
52
|
var getPoolList = function () { return Object.keys(curve_1.curve.constants.POOLS_DATA); };
|
|
@@ -55,27 +56,34 @@ exports.getFactoryPoolList = getFactoryPoolList;
|
|
|
55
56
|
var getCryptoFactoryPoolList = function () { return Object.keys(curve_1.curve.constants.CRYPTO_FACTORY_POOLS_DATA); };
|
|
56
57
|
exports.getCryptoFactoryPoolList = getCryptoFactoryPoolList;
|
|
57
58
|
var getUserPoolList = function (address) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var
|
|
59
|
-
return __generator(this, function (
|
|
60
|
-
switch (
|
|
59
|
+
var poolIds, calls, _i, poolIds_1, poolId, pool, userPoolList, _rawBalances, _a, poolIds_2, poolId, pool, _balance;
|
|
60
|
+
return __generator(this, function (_b) {
|
|
61
|
+
switch (_b.label) {
|
|
61
62
|
case 0:
|
|
62
63
|
if (!address)
|
|
63
64
|
address = curve_1.curve.signerAddress;
|
|
64
65
|
address = address;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
for (_i = 0,
|
|
68
|
-
|
|
69
|
-
pool = (0, poolConstructor_1.getPool)(
|
|
70
|
-
|
|
66
|
+
poolIds = __spreadArray(__spreadArray(__spreadArray([], (0, exports.getPoolList)(), true), (0, exports.getFactoryPoolList)(), true), (0, exports.getCryptoFactoryPoolList)(), true);
|
|
67
|
+
calls = [];
|
|
68
|
+
for (_i = 0, poolIds_1 = poolIds; _i < poolIds_1.length; _i++) {
|
|
69
|
+
poolId = poolIds_1[_i];
|
|
70
|
+
pool = (0, poolConstructor_1.getPool)(poolId);
|
|
71
|
+
calls.push(curve_1.curve.contracts[pool.lpToken].multicallContract.balanceOf(address));
|
|
72
|
+
if (pool.gauge !== ethers_1.ethers.constants.AddressZero)
|
|
73
|
+
calls.push(curve_1.curve.contracts[pool.gauge].multicallContract.balanceOf(address));
|
|
71
74
|
}
|
|
72
75
|
userPoolList = [];
|
|
73
|
-
return [4 /*yield*/,
|
|
76
|
+
return [4 /*yield*/, curve_1.curve.multicallProvider.all(calls)];
|
|
74
77
|
case 1:
|
|
75
|
-
|
|
76
|
-
for (
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
_rawBalances = _b.sent();
|
|
79
|
+
for (_a = 0, poolIds_2 = poolIds; _a < poolIds_2.length; _a++) {
|
|
80
|
+
poolId = poolIds_2[_a];
|
|
81
|
+
pool = (0, poolConstructor_1.getPool)(poolId);
|
|
82
|
+
_balance = _rawBalances.shift();
|
|
83
|
+
if (pool.gauge !== ethers_1.ethers.constants.AddressZero)
|
|
84
|
+
_balance = _balance.add(_rawBalances.shift());
|
|
85
|
+
if (_balance.gt(0)) {
|
|
86
|
+
userPoolList.push(poolId);
|
|
79
87
|
}
|
|
80
88
|
}
|
|
81
89
|
return [2 /*return*/, userPoolList];
|
package/lib/utils.js
CHANGED
|
@@ -240,7 +240,7 @@ var _getAllowance = function (coins, address, spender) { return __awaiter(void 0
|
|
|
240
240
|
_coins.splice(ethIndex, 1);
|
|
241
241
|
}
|
|
242
242
|
if (!(_coins.length === 1)) return [3 /*break*/, 2];
|
|
243
|
-
return [4 /*yield*/, curve_1.curve.contracts[_coins[0]].contract.allowance(address, spender)];
|
|
243
|
+
return [4 /*yield*/, curve_1.curve.contracts[_coins[0]].contract.allowance(address, spender, curve_1.curve.constantOptions)];
|
|
244
244
|
case 1:
|
|
245
245
|
allowance = [_a.sent()];
|
|
246
246
|
return [3 /*break*/, 4];
|
|
@@ -452,15 +452,21 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
|
|
|
452
452
|
return [2 /*return*/, 1];
|
|
453
453
|
chainName = {
|
|
454
454
|
1: 'ethereum',
|
|
455
|
+
10: 'optimistic-ethereum',
|
|
456
|
+
100: 'xdai',
|
|
455
457
|
137: 'polygon-pos',
|
|
456
458
|
250: 'fantom',
|
|
457
459
|
43114: 'avalanche',
|
|
460
|
+
42161: 'arbitrum-one',
|
|
458
461
|
}[curve_1.curve.chainId];
|
|
459
462
|
nativeTokenName = {
|
|
460
463
|
1: 'ethereum',
|
|
464
|
+
10: 'ethereum',
|
|
465
|
+
100: 'xdai',
|
|
461
466
|
137: 'matic-network',
|
|
462
467
|
250: 'fantom',
|
|
463
468
|
43114: 'avalanche-2',
|
|
469
|
+
42161: 'ethereum',
|
|
464
470
|
}[curve_1.curve.chainId];
|
|
465
471
|
if (chainName === undefined) {
|
|
466
472
|
throw Error('curve object is not initialized');
|
|
@@ -523,9 +529,12 @@ var getTVL = function (chainId) {
|
|
|
523
529
|
case 0:
|
|
524
530
|
network = (_a = {
|
|
525
531
|
1: "ethereum",
|
|
532
|
+
10: 'optimism',
|
|
533
|
+
100: 'xdai',
|
|
526
534
|
137: "polygon",
|
|
527
535
|
250: "fantom",
|
|
528
536
|
43114: "avalanche",
|
|
537
|
+
42161: "arbitrum",
|
|
529
538
|
}[chainId]) !== null && _a !== void 0 ? _a : "ethereum";
|
|
530
539
|
promises = [
|
|
531
540
|
(0, external_api_1._getPoolsFromApi)(network, "main"),
|