@curvefi/api 2.8.7 → 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.
@@ -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
  });
@@ -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;
@@ -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) { // tricrypto2 (eth), tricrypto (arbitrum)
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.8.7",
3
+ "version": "2.8.8",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",