@curvefi/api 2.16.3 → 2.17.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 CHANGED
@@ -1264,4 +1264,184 @@ import curve from "@curvefi/api";
1264
1264
  await curve.boosting.estimateGas.createLock('1000', 365);
1265
1265
  // 324953
1266
1266
  })()
1267
+ ```
1268
+
1269
+ ## Factory
1270
+
1271
+ ### Deploy stable plain pool
1272
+
1273
+ ```ts
1274
+ import curve from "@curvefi/api";
1275
+
1276
+ (async () => {
1277
+ await curve.init('JsonRpc', {}, { gasPrice: 0 });
1278
+
1279
+ const coins = [
1280
+ "0x1456688345527bE1f37E9e627DA0837D6f08C925", // USDP
1281
+ "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3", // MIM
1282
+ "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", // LUSD
1283
+ ];
1284
+
1285
+ // Deploy pool
1286
+
1287
+ const deployPoolTx = await curve.factory.deployPlainPool('Test pool', 'TST', coins, 200, 0.1, 0, 1);
1288
+ // {
1289
+ // hash: '0xb84206f6a17488459d8dfc9a9f41ae89c71d1920b7aa87ad2eefd3171ba5166c',
1290
+ // type: 0,
1291
+ // accessList: null,
1292
+ // blockHash: '0xf1c7d05a7cebfe2331cca0e8ce0e7b45aac2097934a23c73f6e0b16fac0a9b5f',
1293
+ // blockNumber: 15839419,
1294
+ // transactionIndex: 0,
1295
+ // confirmations: 1,
1296
+ // from: '0x66aB6D9362d4F35596279692F0251Db635165871',
1297
+ // gasPrice: BigNumber { _hex: '0x00', _isBigNumber: true },
1298
+ // gasLimit: BigNumber { _hex: '0x1037c4', _isBigNumber: true },
1299
+ // to: '0xB9fC157394Af804a3578134A6585C0dc9cc990d4',
1300
+ // value: BigNumber { _hex: '0x00', _isBigNumber: true },
1301
+ // nonce: 12,
1302
+ // data: '0x52f2db69000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000000001456688345527be1f37e9e627da0837d6f08c92500000000000000000000000099d8a9c45b2eca8864373a26d1459e3dff1e17f30000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000009896800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000095465737420706f6f6c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035453540000000000000000000000000000000000000000000000000000000000',
1303
+ // r: '0x0f8f0277c982e1cf3153fd5a63a104a0338bf907fdb270589dc847c6f4b6600d',
1304
+ // s: '0x32e2f279f759673e5254b893539cfe1258338f177e892b46e1edb7b73e869a3d',
1305
+ // v: 38,
1306
+ // creates: null,
1307
+ // chainId: 1,
1308
+ // wait: [Function (anonymous)]
1309
+ // }
1310
+ const poolAddress = await curve.factory.getDeployedPlainPoolAddress(deployPoolTx);
1311
+ // 0xa77b5d170f3aec2f72ca06490a7b9383a70ae5eb
1312
+
1313
+ // Deploy gauge
1314
+
1315
+ const deployGaugeTx = await curve.factory.deployGauge(poolAddress);
1316
+ // {
1317
+ // hash: '0x8bb0eb63430e6c522c30922a833fee263816ebc0f30367d53ecfe52e17b7c3a0',
1318
+ // type: 0,
1319
+ // accessList: null,
1320
+ // ...
1321
+ // }
1322
+ const gaugeAddress = await curve.factory.getDeployedGaugeAddress(deployGaugeTx);
1323
+ // 0x1400e08f1d9f5bc90ae19acd4bf81beabc9e79de
1324
+
1325
+ // Deposit & Stake
1326
+
1327
+ const poolId = await curve.factory.fetchRecentlyDeployedPool(poolAddress);
1328
+ // factory-v2-221
1329
+ const pool = curve.getPool(poolId);
1330
+
1331
+ await pool.depositAndStake([10, 10, 10]); // Initial amounts for stable pool must be equal
1332
+ const balances = await pool.stats.underlyingBalances();
1333
+ // [ '10.0', '10.0', '10.0' ]
1334
+ })()
1335
+ ```
1336
+
1337
+ ### Deploy stable meta pool
1338
+
1339
+ ```ts
1340
+ import curve from "@curvefi/api";
1341
+
1342
+ (async () => {
1343
+ await curve.init('JsonRpc', {}, { gasPrice: 0 });
1344
+
1345
+ const basePool = "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7"; // 3pool address
1346
+ const coin = "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3"; // MIM
1347
+
1348
+ // Deploy pool
1349
+
1350
+ const deployPoolTx = await curve.factory.deployMetaPool(basePool, 'Test pool', 'TST', coin, 200, 0.1, 0);
1351
+ // {
1352
+ // hash: '0xac49dead008ccc04988e513a8502dea35bad721b0c79fa1503054541ee51ea90',
1353
+ // type: 0,
1354
+ // accessList: null,
1355
+ // ...
1356
+ // }
1357
+ const poolAddress = await curve.factory.getDeployedMetaPoolAddress(deployPoolTx);
1358
+ // 0xd87f26c2f658657779e452dd043df9b2751ae7c4
1359
+
1360
+ // Deploy gauge
1361
+
1362
+ const deployGaugeTx = await curve.factory.deployGauge(poolAddress);
1363
+ // {
1364
+ // hash: '0x37a53a08d6c71095de8c25bcd4a01b39beec35990f77c7b98355bd064511541f',
1365
+ // type: 0,
1366
+ // accessList: null,
1367
+ // ...
1368
+ // }
1369
+
1370
+ const gaugeAddress = await curve.factory.getDeployedGaugeAddress(deployGaugeTx);
1371
+ // 0x326290a1b0004eee78fa6ed4f1d8f4b2523ab669
1372
+
1373
+ // Deposit & Stake Wrapped
1374
+
1375
+ const poolId = await curve.factory.fetchRecentlyDeployedPool(poolAddress);
1376
+ // factory-v2-222
1377
+ const pool = curve.getPool(poolId);
1378
+
1379
+ await pool.depositAndStakeWrapped([10, 10]); // Initial amounts for stable pool must be equal
1380
+ const balances = await pool.stats.wrappedBalances();
1381
+ // [ '10.0', '10.0' ]
1382
+ })()
1383
+ ```
1384
+
1385
+ ### Deploy crypto pool
1386
+
1387
+ ```ts
1388
+ import curve from "@curvefi/api";
1389
+
1390
+ (async () => {
1391
+ await curve.init('JsonRpc', {}, { gasPrice: 0 });
1392
+
1393
+ const coins = [
1394
+ "0xC581b735A1688071A1746c968e0798D642EDE491", // EURT
1395
+ "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
1396
+ ];
1397
+
1398
+ // Deploy pool
1399
+
1400
+ const deployPoolTx = await curve.cryptoFactory.deployPool(
1401
+ "Test crypto pool",
1402
+ "TCP",
1403
+ coins,
1404
+ 400000,
1405
+ 0.0000725,
1406
+ 0.25,
1407
+ 0.45,
1408
+ 0.000002,
1409
+ 0.00023,
1410
+ 0.000146,
1411
+ 600,
1412
+ 1500
1413
+ );
1414
+ // {
1415
+ // hash: '0x406900448e537f2fd5c833a4f62a81305b9567e71f870772e10c72271bd78c37',
1416
+ // type: 0,
1417
+ // accessList: null,
1418
+ // ...
1419
+ // }
1420
+ const poolAddress = await curve.cryptoFactory.getDeployedPoolAddress(deployPoolTx);
1421
+ // 0xe01a9ecdb0aaabe2f12a25a0d289480debf09e89
1422
+
1423
+ // Deploy gauge
1424
+
1425
+ const deployGaugeTx = await curve.cryptoFactory.deployGauge(poolAddress);
1426
+ // {
1427
+ // hash: '0x406900448e537f2fd5c833a4f62a81305b9567e71f870772e10c72271bd78c37',
1428
+ // type: 0,
1429
+ // accessList: null,
1430
+ // ...
1431
+ // }
1432
+ const gaugeAddress = await curve.factory.getDeployedGaugeAddress(deployGaugeTx);
1433
+ // 0x0b4f303a4434647dbf257e3ae4fb134259f3d4fa
1434
+
1435
+ // Deposit & Stake
1436
+
1437
+ const poolId = await curve.cryptoFactory.fetchRecentlyDeployedPool(poolAddress);
1438
+ // factory-crypto-155
1439
+ const pool = curve.getPool(poolId);
1440
+
1441
+ const amounts = await pool.cryptoSeedAmounts(30); // Initial amounts for crypto pools must have the ratio corresponding to initialPrice
1442
+ // [ '30', '0.02' ]
1443
+ await pool.depositAndStake(amounts);
1444
+ const underlyingBalances = await pool.stats.underlyingBalances();
1445
+ // [ '30.0', '0.02' ]
1446
+ })()
1267
1447
  ```
@@ -0,0 +1,444 @@
1
+ [
2
+ {
3
+ "name": "Approval",
4
+ "inputs": [
5
+ {
6
+ "name": "_owner",
7
+ "type": "address",
8
+ "indexed": true
9
+ },
10
+ {
11
+ "name": "_spender",
12
+ "type": "address",
13
+ "indexed": true
14
+ },
15
+ {
16
+ "name": "_value",
17
+ "type": "uint256",
18
+ "indexed": false
19
+ }
20
+ ],
21
+ "anonymous": false,
22
+ "type": "event"
23
+ },
24
+ {
25
+ "name": "Transfer",
26
+ "inputs": [
27
+ {
28
+ "name": "_from",
29
+ "type": "address",
30
+ "indexed": true
31
+ },
32
+ {
33
+ "name": "_to",
34
+ "type": "address",
35
+ "indexed": true
36
+ },
37
+ {
38
+ "name": "_value",
39
+ "type": "uint256",
40
+ "indexed": false
41
+ }
42
+ ],
43
+ "anonymous": false,
44
+ "type": "event"
45
+ },
46
+ {
47
+ "stateMutability": "nonpayable",
48
+ "type": "constructor",
49
+ "inputs": [],
50
+ "outputs": []
51
+ },
52
+ {
53
+ "stateMutability": "nonpayable",
54
+ "type": "function",
55
+ "name": "transfer",
56
+ "inputs": [
57
+ {
58
+ "name": "_to",
59
+ "type": "address"
60
+ },
61
+ {
62
+ "name": "_value",
63
+ "type": "uint256"
64
+ }
65
+ ],
66
+ "outputs": [
67
+ {
68
+ "name": "",
69
+ "type": "bool"
70
+ }
71
+ ],
72
+ "gas": "78632"
73
+ },
74
+ {
75
+ "stateMutability": "nonpayable",
76
+ "type": "function",
77
+ "name": "transferFrom",
78
+ "inputs": [
79
+ {
80
+ "name": "_from",
81
+ "type": "address"
82
+ },
83
+ {
84
+ "name": "_to",
85
+ "type": "address"
86
+ },
87
+ {
88
+ "name": "_value",
89
+ "type": "uint256"
90
+ }
91
+ ],
92
+ "outputs": [
93
+ {
94
+ "name": "",
95
+ "type": "bool"
96
+ }
97
+ ],
98
+ "gas": "116616"
99
+ },
100
+ {
101
+ "stateMutability": "nonpayable",
102
+ "type": "function",
103
+ "name": "approve",
104
+ "inputs": [
105
+ {
106
+ "name": "_spender",
107
+ "type": "address"
108
+ },
109
+ {
110
+ "name": "_value",
111
+ "type": "uint256"
112
+ }
113
+ ],
114
+ "outputs": [
115
+ {
116
+ "name": "",
117
+ "type": "bool"
118
+ }
119
+ ],
120
+ "gas": "39151"
121
+ },
122
+ {
123
+ "stateMutability": "nonpayable",
124
+ "type": "function",
125
+ "name": "permit",
126
+ "inputs": [
127
+ {
128
+ "name": "_owner",
129
+ "type": "address"
130
+ },
131
+ {
132
+ "name": "_spender",
133
+ "type": "address"
134
+ },
135
+ {
136
+ "name": "_value",
137
+ "type": "uint256"
138
+ },
139
+ {
140
+ "name": "_deadline",
141
+ "type": "uint256"
142
+ },
143
+ {
144
+ "name": "_v",
145
+ "type": "uint8"
146
+ },
147
+ {
148
+ "name": "_r",
149
+ "type": "bytes32"
150
+ },
151
+ {
152
+ "name": "_s",
153
+ "type": "bytes32"
154
+ }
155
+ ],
156
+ "outputs": [
157
+ {
158
+ "name": "",
159
+ "type": "bool"
160
+ }
161
+ ],
162
+ "gas": "102221"
163
+ },
164
+ {
165
+ "stateMutability": "nonpayable",
166
+ "type": "function",
167
+ "name": "increaseAllowance",
168
+ "inputs": [
169
+ {
170
+ "name": "_spender",
171
+ "type": "address"
172
+ },
173
+ {
174
+ "name": "_added_value",
175
+ "type": "uint256"
176
+ }
177
+ ],
178
+ "outputs": [
179
+ {
180
+ "name": "",
181
+ "type": "bool"
182
+ }
183
+ ],
184
+ "gas": "41711"
185
+ },
186
+ {
187
+ "stateMutability": "nonpayable",
188
+ "type": "function",
189
+ "name": "decreaseAllowance",
190
+ "inputs": [
191
+ {
192
+ "name": "_spender",
193
+ "type": "address"
194
+ },
195
+ {
196
+ "name": "_subtracted_value",
197
+ "type": "uint256"
198
+ }
199
+ ],
200
+ "outputs": [
201
+ {
202
+ "name": "",
203
+ "type": "bool"
204
+ }
205
+ ],
206
+ "gas": "41737"
207
+ },
208
+ {
209
+ "stateMutability": "nonpayable",
210
+ "type": "function",
211
+ "name": "mint",
212
+ "inputs": [
213
+ {
214
+ "name": "_to",
215
+ "type": "address"
216
+ },
217
+ {
218
+ "name": "_value",
219
+ "type": "uint256"
220
+ }
221
+ ],
222
+ "outputs": [
223
+ {
224
+ "name": "",
225
+ "type": "bool"
226
+ }
227
+ ],
228
+ "gas": "80902"
229
+ },
230
+ {
231
+ "stateMutability": "nonpayable",
232
+ "type": "function",
233
+ "name": "mint_relative",
234
+ "inputs": [
235
+ {
236
+ "name": "_to",
237
+ "type": "address"
238
+ },
239
+ {
240
+ "name": "frac",
241
+ "type": "uint256"
242
+ }
243
+ ],
244
+ "outputs": [
245
+ {
246
+ "name": "",
247
+ "type": "uint256"
248
+ }
249
+ ],
250
+ "gas": "81224"
251
+ },
252
+ {
253
+ "stateMutability": "nonpayable",
254
+ "type": "function",
255
+ "name": "burnFrom",
256
+ "inputs": [
257
+ {
258
+ "name": "_to",
259
+ "type": "address"
260
+ },
261
+ {
262
+ "name": "_value",
263
+ "type": "uint256"
264
+ }
265
+ ],
266
+ "outputs": [
267
+ {
268
+ "name": "",
269
+ "type": "bool"
270
+ }
271
+ ],
272
+ "gas": "80954"
273
+ },
274
+ {
275
+ "stateMutability": "view",
276
+ "type": "function",
277
+ "name": "decimals",
278
+ "inputs": [],
279
+ "outputs": [
280
+ {
281
+ "name": "",
282
+ "type": "uint8"
283
+ }
284
+ ],
285
+ "gas": "630"
286
+ },
287
+ {
288
+ "stateMutability": "view",
289
+ "type": "function",
290
+ "name": "version",
291
+ "inputs": [],
292
+ "outputs": [
293
+ {
294
+ "name": "",
295
+ "type": "string"
296
+ }
297
+ ],
298
+ "gas": "6287"
299
+ },
300
+ {
301
+ "stateMutability": "nonpayable",
302
+ "type": "function",
303
+ "name": "initialize",
304
+ "inputs": [
305
+ {
306
+ "name": "_name",
307
+ "type": "string"
308
+ },
309
+ {
310
+ "name": "_symbol",
311
+ "type": "string"
312
+ },
313
+ {
314
+ "name": "_pool",
315
+ "type": "address"
316
+ }
317
+ ],
318
+ "outputs": [],
319
+ "gas": "259459"
320
+ },
321
+ {
322
+ "stateMutability": "view",
323
+ "type": "function",
324
+ "name": "name",
325
+ "inputs": [],
326
+ "outputs": [
327
+ {
328
+ "name": "",
329
+ "type": "string"
330
+ }
331
+ ],
332
+ "gas": "13109"
333
+ },
334
+ {
335
+ "stateMutability": "view",
336
+ "type": "function",
337
+ "name": "symbol",
338
+ "inputs": [],
339
+ "outputs": [
340
+ {
341
+ "name": "",
342
+ "type": "string"
343
+ }
344
+ ],
345
+ "gas": "10868"
346
+ },
347
+ {
348
+ "stateMutability": "view",
349
+ "type": "function",
350
+ "name": "DOMAIN_SEPARATOR",
351
+ "inputs": [],
352
+ "outputs": [
353
+ {
354
+ "name": "",
355
+ "type": "bytes32"
356
+ }
357
+ ],
358
+ "gas": "2880"
359
+ },
360
+ {
361
+ "stateMutability": "view",
362
+ "type": "function",
363
+ "name": "balanceOf",
364
+ "inputs": [
365
+ {
366
+ "name": "arg0",
367
+ "type": "address"
368
+ }
369
+ ],
370
+ "outputs": [
371
+ {
372
+ "name": "",
373
+ "type": "uint256"
374
+ }
375
+ ],
376
+ "gas": "3176"
377
+ },
378
+ {
379
+ "stateMutability": "view",
380
+ "type": "function",
381
+ "name": "allowance",
382
+ "inputs": [
383
+ {
384
+ "name": "arg0",
385
+ "type": "address"
386
+ },
387
+ {
388
+ "name": "arg1",
389
+ "type": "address"
390
+ }
391
+ ],
392
+ "outputs": [
393
+ {
394
+ "name": "",
395
+ "type": "uint256"
396
+ }
397
+ ],
398
+ "gas": "3472"
399
+ },
400
+ {
401
+ "stateMutability": "view",
402
+ "type": "function",
403
+ "name": "totalSupply",
404
+ "inputs": [],
405
+ "outputs": [
406
+ {
407
+ "name": "",
408
+ "type": "uint256"
409
+ }
410
+ ],
411
+ "gas": "2970"
412
+ },
413
+ {
414
+ "stateMutability": "view",
415
+ "type": "function",
416
+ "name": "minter",
417
+ "inputs": [],
418
+ "outputs": [
419
+ {
420
+ "name": "",
421
+ "type": "address"
422
+ }
423
+ ],
424
+ "gas": "3000"
425
+ },
426
+ {
427
+ "stateMutability": "view",
428
+ "type": "function",
429
+ "name": "nonces",
430
+ "inputs": [
431
+ {
432
+ "name": "arg0",
433
+ "type": "address"
434
+ }
435
+ ],
436
+ "outputs": [
437
+ {
438
+ "name": "",
439
+ "type": "uint256"
440
+ }
441
+ ],
442
+ "gas": "3296"
443
+ }
444
+ ]