@curvefi/api 2.8.5 → 2.8.8
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/tricrypto-xdai/swap.json +1255 -0
- package/lib/constants/abis/tricrypto-xdai/zap.json +242 -0
- package/lib/constants/coins/xdai.js +4 -0
- package/lib/constants/pools/xdai.js +34 -0
- package/lib/curve.js +30 -29
- package/lib/factory/common.js +10 -0
- package/lib/factory/constants.js +6 -1
- package/lib/pools/PoolTemplate.js +13 -11
- package/lib/pools/poolConstructor.js +4 -3
- package/lib/utils.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "constructor",
|
|
4
|
+
"stateMutability": "nonpayable",
|
|
5
|
+
"outputs": [],
|
|
6
|
+
"inputs": [
|
|
7
|
+
{
|
|
8
|
+
"type": "address",
|
|
9
|
+
"name": "_pool"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "address",
|
|
13
|
+
"name": "_base_pool"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "function",
|
|
19
|
+
"stateMutability": "nonpayable",
|
|
20
|
+
"outputs": [],
|
|
21
|
+
"name": "add_liquidity",
|
|
22
|
+
"inputs": [
|
|
23
|
+
{
|
|
24
|
+
"type": "uint256[5]",
|
|
25
|
+
"name": "_amounts"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "uint256",
|
|
29
|
+
"name": "_min_mint_amount"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"gas": "67403"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "function",
|
|
36
|
+
"stateMutability": "nonpayable",
|
|
37
|
+
"outputs": [],
|
|
38
|
+
"name": "exchange_underlying",
|
|
39
|
+
"inputs": [
|
|
40
|
+
{
|
|
41
|
+
"type": "uint256",
|
|
42
|
+
"name": "i"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"type": "uint256",
|
|
46
|
+
"name": "j"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"type": "uint256",
|
|
50
|
+
"name": "_dx"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"type": "uint256",
|
|
54
|
+
"name": "_min_dy"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"gas": "42830"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "function",
|
|
61
|
+
"stateMutability": "nonpayable",
|
|
62
|
+
"outputs": [],
|
|
63
|
+
"name": "remove_liquidity",
|
|
64
|
+
"inputs": [
|
|
65
|
+
{
|
|
66
|
+
"type": "uint256",
|
|
67
|
+
"name": "_amount"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"type": "uint256[5]",
|
|
71
|
+
"name": "_min_amounts"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"gas": "93404"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"type": "function",
|
|
78
|
+
"stateMutability": "nonpayable",
|
|
79
|
+
"outputs": [],
|
|
80
|
+
"name": "remove_liquidity_one_coin",
|
|
81
|
+
"inputs": [
|
|
82
|
+
{
|
|
83
|
+
"type": "uint256",
|
|
84
|
+
"name": "_token_amount"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"type": "uint256",
|
|
88
|
+
"name": "i"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "uint256",
|
|
92
|
+
"name": "_min_amount"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"gas": "33153"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"type": "function",
|
|
99
|
+
"stateMutability": "view",
|
|
100
|
+
"outputs": [
|
|
101
|
+
{
|
|
102
|
+
"type": "uint256",
|
|
103
|
+
"name": ""
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"name": "get_dy_underlying",
|
|
107
|
+
"inputs": [
|
|
108
|
+
{
|
|
109
|
+
"type": "uint256",
|
|
110
|
+
"name": "i"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "uint256",
|
|
114
|
+
"name": "j"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"type": "uint256",
|
|
118
|
+
"name": "_dx"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"gas": "19678"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "function",
|
|
125
|
+
"stateMutability": "view",
|
|
126
|
+
"outputs": [
|
|
127
|
+
{
|
|
128
|
+
"type": "uint256",
|
|
129
|
+
"name": ""
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"name": "calc_token_amount",
|
|
133
|
+
"inputs": [
|
|
134
|
+
{
|
|
135
|
+
"type": "uint256[5]",
|
|
136
|
+
"name": "_amounts"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"type": "bool",
|
|
140
|
+
"name": "_is_deposit"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"gas": "9954"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"type": "function",
|
|
147
|
+
"stateMutability": "view",
|
|
148
|
+
"outputs": [
|
|
149
|
+
{
|
|
150
|
+
"type": "uint256",
|
|
151
|
+
"name": ""
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"name": "calc_withdraw_one_coin",
|
|
155
|
+
"inputs": [
|
|
156
|
+
{
|
|
157
|
+
"type": "uint256",
|
|
158
|
+
"name": "token_amount"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"type": "uint256",
|
|
162
|
+
"name": "i"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"gas": "14541"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"type": "function",
|
|
169
|
+
"stateMutability": "view",
|
|
170
|
+
"outputs": [
|
|
171
|
+
{
|
|
172
|
+
"type": "address",
|
|
173
|
+
"name": ""
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"name": "coins",
|
|
177
|
+
"inputs": [
|
|
178
|
+
{
|
|
179
|
+
"type": "uint256",
|
|
180
|
+
"name": "arg0"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"gas": "2709"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"type": "function",
|
|
187
|
+
"stateMutability": "view",
|
|
188
|
+
"outputs": [
|
|
189
|
+
{
|
|
190
|
+
"type": "address",
|
|
191
|
+
"name": ""
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"name": "underlying_coins",
|
|
195
|
+
"inputs": [
|
|
196
|
+
{
|
|
197
|
+
"type": "uint256",
|
|
198
|
+
"name": "arg0"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"gas": "2745"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"type": "function",
|
|
205
|
+
"stateMutability": "view",
|
|
206
|
+
"outputs": [
|
|
207
|
+
{
|
|
208
|
+
"type": "address",
|
|
209
|
+
"name": ""
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"name": "pool",
|
|
213
|
+
"inputs": [],
|
|
214
|
+
"gas": "2730"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"type": "function",
|
|
218
|
+
"stateMutability": "view",
|
|
219
|
+
"outputs": [
|
|
220
|
+
{
|
|
221
|
+
"type": "address",
|
|
222
|
+
"name": ""
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"name": "base_pool",
|
|
226
|
+
"inputs": [],
|
|
227
|
+
"gas": "2760"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"type": "function",
|
|
231
|
+
"stateMutability": "view",
|
|
232
|
+
"outputs": [
|
|
233
|
+
{
|
|
234
|
+
"type": "address",
|
|
235
|
+
"name": ""
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"name": "token",
|
|
239
|
+
"inputs": [],
|
|
240
|
+
"gas": "2790"
|
|
241
|
+
}
|
|
242
|
+
]
|
|
@@ -10,6 +10,10 @@ exports.COINS_XDAI = (0, utils_1.lowerCaseValues)({
|
|
|
10
10
|
'usdt': '0x4ECaBa5870353805a9F068101A40E0f32ed605C6',
|
|
11
11
|
'rai': '0xd7a28aa9c470e7e9d8c676bcd5dd2f40c5683afa',
|
|
12
12
|
'x3crv': '0x1337BedC9D22ecbe766dF105c9623922A27963EC',
|
|
13
|
+
// --- BTC ---
|
|
14
|
+
'wbtc': '0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252',
|
|
15
|
+
// --- ETH ---
|
|
16
|
+
'weth': '0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1',
|
|
13
17
|
});
|
|
14
18
|
exports.cTokensXDai = []; //.map((a) => a.toLowerCase());
|
|
15
19
|
exports.yTokensXDai = []; //.map((a) => a.toLowerCase());
|
|
@@ -7,6 +7,8 @@ exports.POOLS_DATA_XDAI = void 0;
|
|
|
7
7
|
var swap_json_1 = __importDefault(require("../abis/3pool/swap.json"));
|
|
8
8
|
var swap_json_2 = __importDefault(require("../abis/rai/swap.json"));
|
|
9
9
|
var deposit_json_1 = __importDefault(require("../abis/rai/deposit.json"));
|
|
10
|
+
var swap_json_3 = __importDefault(require("../abis/tricrypto-xdai/swap.json"));
|
|
11
|
+
var zap_json_1 = __importDefault(require("../abis/tricrypto-xdai/zap.json"));
|
|
10
12
|
var gauge_rewards_only_json_1 = __importDefault(require("../abis/gauge_rewards_only.json"));
|
|
11
13
|
var streamer_json_1 = __importDefault(require("../abis/streamer.json"));
|
|
12
14
|
var utils_1 = require("../utils");
|
|
@@ -68,4 +70,36 @@ exports.POOLS_DATA_XDAI = (0, utils_1.lowerCasePoolDataAddresses)({
|
|
|
68
70
|
gauge_abi: gauge_rewards_only_json_1.default,
|
|
69
71
|
deposit_abi: deposit_json_1.default,
|
|
70
72
|
},
|
|
73
|
+
tricrypto: {
|
|
74
|
+
name: "tricrypto",
|
|
75
|
+
full_name: "tricrypto",
|
|
76
|
+
symbol: "tricrypto",
|
|
77
|
+
reference_asset: 'CRYPTO',
|
|
78
|
+
swap_address: '0x5633E00994896D0F472926050eCb32E38bef3e65',
|
|
79
|
+
token_address: '0x02E7e2dd3BA409148A49D5cc9a9034D2f884F245',
|
|
80
|
+
gauge_address: '0x0000000000000000000000000000000000000000',
|
|
81
|
+
deposit_address: '0xF182926A64C0A19234E7E1FCDfE772aA7A1CA351',
|
|
82
|
+
is_crypto: true,
|
|
83
|
+
is_meta: true,
|
|
84
|
+
base_pool: '3pool',
|
|
85
|
+
underlying_coins: ['WXDAI', 'USDC', 'USDT', 'WBTC', 'WETH'],
|
|
86
|
+
wrapped_coins: ['x3CRV', 'WBTC', 'WETH'],
|
|
87
|
+
underlying_coin_addresses: [
|
|
88
|
+
'0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
|
|
89
|
+
'0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83',
|
|
90
|
+
'0x4ECaBa5870353805a9F068101A40E0f32ed605C6',
|
|
91
|
+
'0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252',
|
|
92
|
+
'0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1',
|
|
93
|
+
],
|
|
94
|
+
wrapped_coin_addresses: [
|
|
95
|
+
'0x1337BedC9D22ecbe766dF105c9623922A27963EC',
|
|
96
|
+
'0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252',
|
|
97
|
+
'0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1',
|
|
98
|
+
],
|
|
99
|
+
underlying_decimals: [18, 6, 6, 8, 18],
|
|
100
|
+
wrapped_decimals: [18, 8, 18],
|
|
101
|
+
swap_abi: swap_json_3.default,
|
|
102
|
+
gauge_abi: gauge_rewards_only_json_1.default,
|
|
103
|
+
deposit_abi: zap_json_1.default,
|
|
104
|
+
},
|
|
71
105
|
});
|
package/lib/curve.js
CHANGED
|
@@ -188,11 +188,12 @@ var Curve = /** @class */ (function () {
|
|
|
188
188
|
}
|
|
189
189
|
Curve.prototype.init = function (providerType, providerSettings, options // gasPrice in Gwei
|
|
190
190
|
) {
|
|
191
|
+
var _a;
|
|
191
192
|
if (options === void 0) { options = {}; }
|
|
192
193
|
return __awaiter(this, void 0, void 0, function () {
|
|
193
|
-
var network,
|
|
194
|
-
return __generator(this, function (
|
|
195
|
-
switch (
|
|
194
|
+
var network, _b, _c, cTokens, yTokens, ycTokens, aTokens, customAbiTokens, _d, err_1, _i, _e, pool, _f, _g, coinAddr, _h, _j, coinAddr, _k, _l, coinAddr, _minterABI, addressProviderContract, _m;
|
|
195
|
+
return __generator(this, function (_o) {
|
|
196
|
+
switch (_o.label) {
|
|
196
197
|
case 0:
|
|
197
198
|
// @ts-ignore
|
|
198
199
|
this.provider = null;
|
|
@@ -228,7 +229,7 @@ var Curve = /** @class */ (function () {
|
|
|
228
229
|
if (providerSettings.privateKey) {
|
|
229
230
|
this.signer = new ethers_1.ethers.Wallet(providerSettings.privateKey, this.provider);
|
|
230
231
|
}
|
|
231
|
-
else {
|
|
232
|
+
else if (!((_a = providerSettings.url) === null || _a === void 0 ? void 0 : _a.startsWith("https://rpc.gnosischain.com"))) {
|
|
232
233
|
this.signer = this.provider.getSigner();
|
|
233
234
|
}
|
|
234
235
|
// Web3 provider
|
|
@@ -253,14 +254,14 @@ var Curve = /** @class */ (function () {
|
|
|
253
254
|
else {
|
|
254
255
|
throw Error('Wrong providerType');
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
-
if (
|
|
257
|
+
_b = this.provider.network;
|
|
258
|
+
if (_b) return [3 /*break*/, 2];
|
|
258
259
|
return [4 /*yield*/, this.provider._networkPromise];
|
|
259
260
|
case 1:
|
|
260
|
-
|
|
261
|
-
|
|
261
|
+
_b = (_o.sent());
|
|
262
|
+
_o.label = 2;
|
|
262
263
|
case 2:
|
|
263
|
-
network =
|
|
264
|
+
network = _b;
|
|
264
265
|
console.log("CURVE-JS IS CONNECTED TO NETWORK:", network);
|
|
265
266
|
this.chainId = network.chainId === 1337 ? 1 : network.chainId;
|
|
266
267
|
this.constants.NETWORK_NAME = exports.NETWORK_CONSTANTS[this.chainId].NAME;
|
|
@@ -269,41 +270,41 @@ var Curve = /** @class */ (function () {
|
|
|
269
270
|
this.constants.COINS = exports.NETWORK_CONSTANTS[this.chainId].COINS;
|
|
270
271
|
this.constants.DECIMALS = (0, utils_1.extractDecimals)(this.constants.POOLS_DATA);
|
|
271
272
|
this.constants.GAUGES = (0, utils_1.extractGauges)(this.constants.POOLS_DATA);
|
|
272
|
-
|
|
273
|
+
_c = [
|
|
273
274
|
exports.NETWORK_CONSTANTS[this.chainId].cTokens,
|
|
274
275
|
exports.NETWORK_CONSTANTS[this.chainId].yTokens,
|
|
275
276
|
exports.NETWORK_CONSTANTS[this.chainId].ycTokens,
|
|
276
277
|
exports.NETWORK_CONSTANTS[this.chainId].aTokens,
|
|
277
|
-
], cTokens =
|
|
278
|
+
], cTokens = _c[0], yTokens = _c[1], ycTokens = _c[2], aTokens = _c[3];
|
|
278
279
|
customAbiTokens = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], cTokens, true), yTokens, true), ycTokens, true), aTokens, true);
|
|
279
280
|
this.multicallProvider = new ethcall_1.Provider();
|
|
280
281
|
return [4 /*yield*/, this.multicallProvider.init(this.provider)];
|
|
281
282
|
case 3:
|
|
282
|
-
|
|
283
|
+
_o.sent();
|
|
283
284
|
if (!this.signer) return [3 /*break*/, 8];
|
|
284
|
-
|
|
285
|
+
_o.label = 4;
|
|
285
286
|
case 4:
|
|
286
|
-
|
|
287
|
-
|
|
287
|
+
_o.trys.push([4, 6, , 7]);
|
|
288
|
+
_d = this;
|
|
288
289
|
return [4 /*yield*/, this.signer.getAddress()];
|
|
289
290
|
case 5:
|
|
290
|
-
|
|
291
|
+
_d.signerAddress = _o.sent();
|
|
291
292
|
return [3 /*break*/, 7];
|
|
292
293
|
case 6:
|
|
293
|
-
err_1 =
|
|
294
|
+
err_1 = _o.sent();
|
|
294
295
|
this.signer = null;
|
|
295
296
|
return [3 /*break*/, 7];
|
|
296
297
|
case 7: return [3 /*break*/, 9];
|
|
297
298
|
case 8:
|
|
298
299
|
this.signerAddress = '';
|
|
299
|
-
|
|
300
|
+
_o.label = 9;
|
|
300
301
|
case 9:
|
|
301
302
|
this.feeData = { gasPrice: options.gasPrice, maxFeePerGas: options.maxFeePerGas, maxPriorityFeePerGas: options.maxPriorityFeePerGas };
|
|
302
303
|
return [4 /*yield*/, this.updateFeeData()];
|
|
303
304
|
case 10:
|
|
304
|
-
|
|
305
|
-
for (_i = 0,
|
|
306
|
-
pool =
|
|
305
|
+
_o.sent();
|
|
306
|
+
for (_i = 0, _e = Object.values(this.constants.POOLS_DATA); _i < _e.length; _i++) {
|
|
307
|
+
pool = _e[_i];
|
|
307
308
|
this.contracts[pool.swap_address] = {
|
|
308
309
|
contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
|
|
309
310
|
multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
|
|
@@ -326,15 +327,15 @@ var Curve = /** @class */ (function () {
|
|
|
326
327
|
multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
|
|
327
328
|
};
|
|
328
329
|
}
|
|
329
|
-
for (
|
|
330
|
-
coinAddr = _f
|
|
330
|
+
for (_f = 0, _g = pool.underlying_coin_addresses; _f < _g.length; _f++) {
|
|
331
|
+
coinAddr = _g[_f];
|
|
331
332
|
this.contracts[coinAddr] = {
|
|
332
333
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
333
334
|
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
334
335
|
};
|
|
335
336
|
}
|
|
336
|
-
for (
|
|
337
|
-
coinAddr = _h
|
|
337
|
+
for (_h = 0, _j = pool.wrapped_coin_addresses; _h < _j.length; _h++) {
|
|
338
|
+
coinAddr = _j[_h];
|
|
338
339
|
if (customAbiTokens.includes(coinAddr))
|
|
339
340
|
continue;
|
|
340
341
|
if (coinAddr in this.contracts)
|
|
@@ -345,8 +346,8 @@ var Curve = /** @class */ (function () {
|
|
|
345
346
|
};
|
|
346
347
|
}
|
|
347
348
|
// TODO add all coins
|
|
348
|
-
for (
|
|
349
|
-
coinAddr = _k
|
|
349
|
+
for (_k = 0, _l = pool.wrapped_coin_addresses; _k < _l.length; _k++) {
|
|
350
|
+
coinAddr = _l[_k];
|
|
350
351
|
if (cTokens.includes(coinAddr)) {
|
|
351
352
|
this.contracts[coinAddr] = {
|
|
352
353
|
contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
|
|
@@ -414,10 +415,10 @@ var Curve = /** @class */ (function () {
|
|
|
414
415
|
multicallContract: new ethcall_1.Contract(this.constants.ALIASES.address_provider, address_provider_json_1.default),
|
|
415
416
|
};
|
|
416
417
|
addressProviderContract = this.contracts[this.constants.ALIASES.address_provider].contract;
|
|
417
|
-
|
|
418
|
+
_m = this.constants.ALIASES;
|
|
418
419
|
return [4 /*yield*/, addressProviderContract.get_address(2, this.constantOptions)];
|
|
419
420
|
case 11:
|
|
420
|
-
|
|
421
|
+
_m.registry_exchange = _o.sent();
|
|
421
422
|
this.contracts[this.constants.ALIASES.registry_exchange] = {
|
|
422
423
|
contract: new ethers_1.Contract(this.constants.ALIASES.registry_exchange, registry_exchange_json_1.default, this.signer || this.provider),
|
|
423
424
|
multicallContract: new ethcall_1.Contract(this.constants.ALIASES.registry_exchange, registry_exchange_json_1.default),
|
package/lib/factory/common.js
CHANGED
|
@@ -32,6 +32,11 @@ function setFactoryZapContracts() {
|
|
|
32
32
|
contract: new ethers_1.Contract(metaUsdZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
33
33
|
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, deposit_json_1.default),
|
|
34
34
|
};
|
|
35
|
+
var metaUsd2ZapAddress = "0x4244eB811D6e0Ef302326675207A95113dB4E1F8".toLowerCase();
|
|
36
|
+
this.contracts[metaUsd2ZapAddress] = {
|
|
37
|
+
contract: new ethers_1.Contract(metaUsd2ZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
38
|
+
multicallContract: new ethcall_1.Contract(metaUsd2ZapAddress, DepositZapFantom_json_1.default),
|
|
39
|
+
};
|
|
35
40
|
}
|
|
36
41
|
else if (this.chainId === 100) {
|
|
37
42
|
var metaUsdZapAddress = "0x87C067fAc25f123554a0E76596BF28cFa37fD5E9".toLowerCase();
|
|
@@ -92,6 +97,11 @@ function setFactoryZapContracts() {
|
|
|
92
97
|
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
93
98
|
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapFantom_json_1.default),
|
|
94
99
|
};
|
|
100
|
+
var metaUsd2ZapAddress = "0x58AC91f5BE7dC0c35b24B96B19BAc55FBB8E705e".toLowerCase();
|
|
101
|
+
this.contracts[metaUsd2ZapAddress] = {
|
|
102
|
+
contract: new ethers_1.Contract(metaUsd2ZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
103
|
+
multicallContract: new ethcall_1.Contract(metaUsd2ZapAddress, DepositZapFantom_json_1.default),
|
|
104
|
+
};
|
|
95
105
|
}
|
|
96
106
|
}
|
|
97
107
|
exports.setFactoryZapContracts = setFactoryZapContracts;
|
package/lib/factory/constants.js
CHANGED
|
@@ -110,6 +110,8 @@ exports.implementationABIDictArbitrum = {
|
|
|
110
110
|
"0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5": MetaUSDBalances_json_1.default,
|
|
111
111
|
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": MetaBTCRen_json_1.default,
|
|
112
112
|
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": MetaBTCBalancesRen_json_1.default,
|
|
113
|
+
"0x8DEb66a4A40E370355bEe35f12E55Fe9c755d686": MetaFraxUSD_json_1.default,
|
|
114
|
+
"0x3edE9b145F82e9e46C03f8A8F67B77aEE847b632": MetaFraxUSDBalances_json_1.default,
|
|
113
115
|
"0x54e8A25d0Ac0E4945b697C80b8372445FEA17A62": Plain2Basic_json_1.default,
|
|
114
116
|
"0xD68970e266cE1A015953897C7055a5E0bC657Af8": Plain2Balances_json_1.default,
|
|
115
117
|
"0x7DA64233Fefb352f8F501B357c018158ED8aA455": Plain2ETH_json_1.default,
|
|
@@ -193,6 +195,8 @@ exports.implementationBasePoolIdDictArbitrum = {
|
|
|
193
195
|
"0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5": "2pool",
|
|
194
196
|
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": "ren",
|
|
195
197
|
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": "ren",
|
|
198
|
+
"0x8DEb66a4A40E370355bEe35f12E55Fe9c755d686": "factory-v2-41",
|
|
199
|
+
"0x3edE9b145F82e9e46C03f8A8F67B77aEE847b632": "factory-v2-41", // fraxbp
|
|
196
200
|
};
|
|
197
201
|
exports.implementationBasePoolIdDictOptimism = {
|
|
198
202
|
"0x78CF256256C8089d68Cde634Cf7cDEFb39286470": "3pool",
|
|
@@ -226,10 +230,11 @@ exports.basePoolIdZapDictAvalanche = {
|
|
|
226
230
|
exports.basePoolIdZapDictArbitrum = {
|
|
227
231
|
"2pool": "0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287".toLowerCase(),
|
|
228
232
|
ren: "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2".toLowerCase(),
|
|
233
|
+
"factory-v2-41": "0x58AC91f5BE7dC0c35b24B96B19BAc55FBB8E705e".toLowerCase(),
|
|
229
234
|
};
|
|
230
235
|
exports.basePoolIdZapDictOptimism = {
|
|
231
236
|
"3pool": "0x167e42a1c7ab4be03764a2222aac57f5f6754411".toLowerCase(),
|
|
232
|
-
"factory-v2-16": "
|
|
237
|
+
"factory-v2-16": "0x4244eB811D6e0Ef302326675207A95113dB4E1F8".toLowerCase(),
|
|
233
238
|
};
|
|
234
239
|
exports.basePoolIdZapDictXDai = {
|
|
235
240
|
"3pool": "0x87C067fAc25f123554a0E76596BF28cFa37fD5E9".toLowerCase(),
|
|
@@ -228,7 +228,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
228
228
|
case 4: return [4 /*yield*/, (0, utils_1._getUsdRate)(curve_1.curve.constants.ALIASES.crv)];
|
|
229
229
|
case 5:
|
|
230
230
|
crvRate_1 = _f.sent();
|
|
231
|
-
apy = inflationRateBN.times(31536000).times(crvRate_1).div(Number(totalLiquidityUSD));
|
|
231
|
+
apy = inflationRateBN.times(31536000).times(0.4).times(crvRate_1).div(Number(totalLiquidityUSD));
|
|
232
232
|
return [2 /*return*/, [apy.times(100).toFixed(4), apy.times(100).toFixed(4)]];
|
|
233
233
|
case 6:
|
|
234
234
|
gaugeContract = curve_1.curve.contracts[this.gauge].multicallContract;
|
|
@@ -569,9 +569,9 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
569
569
|
};
|
|
570
570
|
// ---------------- REWARDS PROFIT, CLAIM ----------------
|
|
571
571
|
this.rewardTokens = (0, memoizee_1.default)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
572
|
-
var gaugeContract, gaugeMulticallContract, rewardCount, _c, _d, _e, tokenCalls, i, tokens, tokenInfoCalls, _i, tokens_1, token, tokenMulticallContract, tokenInfo_1, i, rewardContract, method, token, tokenMulticallContract,
|
|
573
|
-
return __generator(this, function (
|
|
574
|
-
switch (
|
|
572
|
+
var gaugeContract, gaugeMulticallContract, rewardCount, _c, _d, _e, tokenCalls, i, tokens, tokenInfoCalls, _i, tokens_1, token, tokenMulticallContract, tokenInfo_1, i, rewardContract, method, token, tokenMulticallContract, res, symbol, decimals;
|
|
573
|
+
return __generator(this, function (_f) {
|
|
574
|
+
switch (_f.label) {
|
|
575
575
|
case 0:
|
|
576
576
|
if (this.gauge === ethers_1.ethers.constants.AddressZero)
|
|
577
577
|
return [2 /*return*/, []];
|
|
@@ -584,8 +584,8 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
584
584
|
_e = (_d = ethers_1.ethers.utils).formatUnits;
|
|
585
585
|
return [4 /*yield*/, gaugeContract.reward_count(curve_1.curve.constantOptions)];
|
|
586
586
|
case 1:
|
|
587
|
-
rewardCount = _c.apply(void 0, [_e.apply(_d, [
|
|
588
|
-
|
|
587
|
+
rewardCount = _c.apply(void 0, [_e.apply(_d, [_f.sent(), 0])]);
|
|
588
|
+
_f.label = 2;
|
|
589
589
|
case 2:
|
|
590
590
|
tokenCalls = [];
|
|
591
591
|
for (i = 0; i < rewardCount; i++) {
|
|
@@ -593,7 +593,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
593
593
|
}
|
|
594
594
|
return [4 /*yield*/, curve_1.curve.multicallProvider.all(tokenCalls)];
|
|
595
595
|
case 3:
|
|
596
|
-
tokens = (
|
|
596
|
+
tokens = (_f.sent())
|
|
597
597
|
.filter(function (addr) { return addr !== ethers_1.ethers.constants.AddressZero; })
|
|
598
598
|
.map(function (addr) { return addr.toLowerCase(); });
|
|
599
599
|
tokenInfoCalls = [];
|
|
@@ -605,7 +605,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
605
605
|
}
|
|
606
606
|
return [4 /*yield*/, curve_1.curve.multicallProvider.all(tokenInfoCalls)];
|
|
607
607
|
case 4:
|
|
608
|
-
tokenInfo_1 =
|
|
608
|
+
tokenInfo_1 = _f.sent();
|
|
609
609
|
for (i = 0; i < tokens.length; i++) {
|
|
610
610
|
curve_1.curve.constants.DECIMALS[tokens[i]] = tokenInfo_1[(i * 2) + 1];
|
|
611
611
|
}
|
|
@@ -617,7 +617,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
617
617
|
;
|
|
618
618
|
return [4 /*yield*/, rewardContract[method](curve_1.curve.constantOptions)];
|
|
619
619
|
case 6:
|
|
620
|
-
token = (
|
|
620
|
+
token = (_f.sent()).toLowerCase();
|
|
621
621
|
(0, utils_1._setContracts)(token, ERC20_json_1.default);
|
|
622
622
|
tokenMulticallContract = curve_1.curve.contracts[token].multicallContract;
|
|
623
623
|
return [4 /*yield*/, curve_1.curve.multicallProvider.all([
|
|
@@ -625,7 +625,9 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
625
625
|
tokenMulticallContract.decimals(),
|
|
626
626
|
])];
|
|
627
627
|
case 7:
|
|
628
|
-
|
|
628
|
+
res = _f.sent();
|
|
629
|
+
symbol = res[0];
|
|
630
|
+
decimals = res[0].toNumber();
|
|
629
631
|
return [2 /*return*/, [{ token: token, symbol: symbol, decimals: decimals }]];
|
|
630
632
|
case 8: return [2 /*return*/, []]; // gauge
|
|
631
633
|
}
|
|
@@ -699,7 +701,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
699
701
|
])];
|
|
700
702
|
case 8:
|
|
701
703
|
_d = _f.sent(), _inflationRate = _d[0], _periodFinish = _d[1], _balance = _d[2], _totalSupply = _d[3];
|
|
702
|
-
periodFinish =
|
|
704
|
+
periodFinish = _periodFinish.toNumber() * 1000;
|
|
703
705
|
inflationRateBN = periodFinish > Date.now() ? (0, utils_1.toBN)(_inflationRate, rewardToken.decimals) : (0, utils_1.BN)(0);
|
|
704
706
|
balanceBN = (0, utils_1.toBN)(_balance);
|
|
705
707
|
totalSupplyBN = (0, utils_1.toBN)(_totalSupply);
|
|
@@ -45,7 +45,7 @@ var getPool = function (poolId) {
|
|
|
45
45
|
return Pool;
|
|
46
46
|
}(PoolTemplate_1.PoolTemplate));
|
|
47
47
|
// statsBalances
|
|
48
|
-
if (poolDummy.isFake) {
|
|
48
|
+
if (poolDummy.isFake || (curve_1.curve.chainId === 100 && poolDummy.id === "tricrypto")) { // 100 is xDAI
|
|
49
49
|
Object.assign(Pool.prototype, poolBalancesMixin_1.poolBalancesAtricrypto3Mixin);
|
|
50
50
|
}
|
|
51
51
|
else if (poolDummy.isMeta) {
|
|
@@ -104,7 +104,7 @@ var getPool = function (poolId) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
// withdrawExpected
|
|
107
|
-
if (poolDummy.isFake) {
|
|
107
|
+
if (poolDummy.isFake || (curve_1.curve.chainId === 100 && poolDummy.id === "tricrypto")) { // 100 is xDAI
|
|
108
108
|
Object.assign(Pool.prototype, withdrawExpectedMixins_1.withdrawExpectedAtricrypto3Mixin);
|
|
109
109
|
}
|
|
110
110
|
else if (poolDummy.isMeta) {
|
|
@@ -227,7 +227,8 @@ var getPool = function (poolId) {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
// swap and swapEstimateGas
|
|
230
|
-
if ('exchange(uint256,uint256,uint256,uint256,bool)' in curve_1.curve.contracts[poolDummy.address].contract
|
|
230
|
+
if ('exchange(uint256,uint256,uint256,uint256,bool)' in curve_1.curve.contracts[poolDummy.address].contract &&
|
|
231
|
+
!(curve_1.curve.chainId === 100 && poolDummy.id === "tricrypto")) { // tricrypto2 (eth), tricrypto (arbitrum); 100 is xDAI
|
|
231
232
|
Object.assign(Pool.prototype, swapMixins_1.swapTricrypto2Mixin);
|
|
232
233
|
}
|
|
233
234
|
else if (poolDummy.isMetaFactory && ((0, exports.getPool)(poolDummy.basePool).isLending || (0, exports.getPool)(poolDummy.basePool).isFake)) {
|
package/lib/utils.js
CHANGED
|
@@ -553,7 +553,7 @@ var getTVL = function (chainId) {
|
|
|
553
553
|
return [4 /*yield*/, Promise.all(promises)];
|
|
554
554
|
case 1:
|
|
555
555
|
allTypesExtendedPoolData = _b.sent();
|
|
556
|
-
return [2 /*return*/, allTypesExtendedPoolData.reduce(function (sum, data) { var _a; return sum + ((_a = data.tvl) !== null && _a !== void 0 ? _a : data.tvlAll); }, 0)];
|
|
556
|
+
return [2 /*return*/, allTypesExtendedPoolData.reduce(function (sum, data) { var _a, _b; return sum + ((_b = (_a = data.tvl) !== null && _a !== void 0 ? _a : data.tvlAll) !== null && _b !== void 0 ? _b : 0); }, 0)];
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
559
|
});
|