@dhedge/v2-sdk 1.10.4 → 1.10.6

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,486 @@
1
+ [
2
+ {
3
+ "anonymous": false,
4
+ "inputs": [
5
+ {
6
+ "indexed": true,
7
+ "internalType": "uint256",
8
+ "name": "tokenId",
9
+ "type": "uint256"
10
+ },
11
+ {
12
+ "indexed": false,
13
+ "internalType": "address",
14
+ "name": "recipient",
15
+ "type": "address"
16
+ },
17
+ {
18
+ "indexed": false,
19
+ "internalType": "uint256",
20
+ "name": "amount0",
21
+ "type": "uint256"
22
+ },
23
+ {
24
+ "indexed": false,
25
+ "internalType": "uint256",
26
+ "name": "amount1",
27
+ "type": "uint256"
28
+ }
29
+ ],
30
+ "name": "Collect",
31
+ "type": "event"
32
+ },
33
+ {
34
+ "anonymous": false,
35
+ "inputs": [
36
+ {
37
+ "indexed": true,
38
+ "internalType": "uint256",
39
+ "name": "tokenId",
40
+ "type": "uint256"
41
+ },
42
+ {
43
+ "indexed": false,
44
+ "internalType": "uint128",
45
+ "name": "liquidity",
46
+ "type": "uint128"
47
+ },
48
+ {
49
+ "indexed": false,
50
+ "internalType": "uint256",
51
+ "name": "amount0",
52
+ "type": "uint256"
53
+ },
54
+ {
55
+ "indexed": false,
56
+ "internalType": "uint256",
57
+ "name": "amount1",
58
+ "type": "uint256"
59
+ }
60
+ ],
61
+ "name": "DecreaseLiquidity",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "anonymous": false,
66
+ "inputs": [
67
+ {
68
+ "indexed": true,
69
+ "internalType": "uint256",
70
+ "name": "tokenId",
71
+ "type": "uint256"
72
+ },
73
+ {
74
+ "indexed": false,
75
+ "internalType": "uint128",
76
+ "name": "liquidity",
77
+ "type": "uint128"
78
+ },
79
+ {
80
+ "indexed": false,
81
+ "internalType": "uint256",
82
+ "name": "amount0",
83
+ "type": "uint256"
84
+ },
85
+ {
86
+ "indexed": false,
87
+ "internalType": "uint256",
88
+ "name": "amount1",
89
+ "type": "uint256"
90
+ }
91
+ ],
92
+ "name": "IncreaseLiquidity",
93
+ "type": "event"
94
+ },
95
+ {
96
+ "inputs": [
97
+ {
98
+ "internalType": "uint256",
99
+ "name": "tokenId",
100
+ "type": "uint256"
101
+ }
102
+ ],
103
+ "name": "burn",
104
+ "outputs": [],
105
+ "stateMutability": "payable",
106
+ "type": "function"
107
+ },
108
+ {
109
+ "inputs": [
110
+ {
111
+ "components": [
112
+ {
113
+ "internalType": "uint256",
114
+ "name": "tokenId",
115
+ "type": "uint256"
116
+ },
117
+ {
118
+ "internalType": "address",
119
+ "name": "recipient",
120
+ "type": "address"
121
+ },
122
+ {
123
+ "internalType": "uint128",
124
+ "name": "amount0Max",
125
+ "type": "uint128"
126
+ },
127
+ {
128
+ "internalType": "uint128",
129
+ "name": "amount1Max",
130
+ "type": "uint128"
131
+ }
132
+ ],
133
+ "internalType": "struct IRamsesNonfungiblePositionManager.CollectParams",
134
+ "name": "params",
135
+ "type": "tuple"
136
+ }
137
+ ],
138
+ "name": "collect",
139
+ "outputs": [
140
+ {
141
+ "internalType": "uint256",
142
+ "name": "amount0",
143
+ "type": "uint256"
144
+ },
145
+ {
146
+ "internalType": "uint256",
147
+ "name": "amount1",
148
+ "type": "uint256"
149
+ }
150
+ ],
151
+ "stateMutability": "payable",
152
+ "type": "function"
153
+ },
154
+ {
155
+ "inputs": [
156
+ {
157
+ "components": [
158
+ {
159
+ "internalType": "uint256",
160
+ "name": "tokenId",
161
+ "type": "uint256"
162
+ },
163
+ {
164
+ "internalType": "uint128",
165
+ "name": "liquidity",
166
+ "type": "uint128"
167
+ },
168
+ {
169
+ "internalType": "uint256",
170
+ "name": "amount0Min",
171
+ "type": "uint256"
172
+ },
173
+ {
174
+ "internalType": "uint256",
175
+ "name": "amount1Min",
176
+ "type": "uint256"
177
+ },
178
+ {
179
+ "internalType": "uint256",
180
+ "name": "deadline",
181
+ "type": "uint256"
182
+ }
183
+ ],
184
+ "internalType": "struct IRamsesNonfungiblePositionManager.DecreaseLiquidityParams",
185
+ "name": "params",
186
+ "type": "tuple"
187
+ }
188
+ ],
189
+ "name": "decreaseLiquidity",
190
+ "outputs": [
191
+ {
192
+ "internalType": "uint256",
193
+ "name": "amount0",
194
+ "type": "uint256"
195
+ },
196
+ {
197
+ "internalType": "uint256",
198
+ "name": "amount1",
199
+ "type": "uint256"
200
+ }
201
+ ],
202
+ "stateMutability": "payable",
203
+ "type": "function"
204
+ },
205
+ {
206
+ "inputs": [],
207
+ "name": "factory",
208
+ "outputs": [
209
+ {
210
+ "internalType": "address",
211
+ "name": "",
212
+ "type": "address"
213
+ }
214
+ ],
215
+ "stateMutability": "view",
216
+ "type": "function"
217
+ },
218
+ {
219
+ "inputs": [
220
+ {
221
+ "internalType": "uint256",
222
+ "name": "tokenId",
223
+ "type": "uint256"
224
+ },
225
+ {
226
+ "internalType": "address[]",
227
+ "name": "tokens",
228
+ "type": "address[]"
229
+ }
230
+ ],
231
+ "name": "getReward",
232
+ "outputs": [],
233
+ "stateMutability": "nonpayable",
234
+ "type": "function"
235
+ },
236
+ {
237
+ "inputs": [
238
+ {
239
+ "components": [
240
+ {
241
+ "internalType": "uint256",
242
+ "name": "tokenId",
243
+ "type": "uint256"
244
+ },
245
+ {
246
+ "internalType": "uint256",
247
+ "name": "amount0Desired",
248
+ "type": "uint256"
249
+ },
250
+ {
251
+ "internalType": "uint256",
252
+ "name": "amount1Desired",
253
+ "type": "uint256"
254
+ },
255
+ {
256
+ "internalType": "uint256",
257
+ "name": "amount0Min",
258
+ "type": "uint256"
259
+ },
260
+ {
261
+ "internalType": "uint256",
262
+ "name": "amount1Min",
263
+ "type": "uint256"
264
+ },
265
+ {
266
+ "internalType": "uint256",
267
+ "name": "deadline",
268
+ "type": "uint256"
269
+ }
270
+ ],
271
+ "internalType": "struct IRamsesNonfungiblePositionManager.IncreaseLiquidityParams",
272
+ "name": "params",
273
+ "type": "tuple"
274
+ }
275
+ ],
276
+ "name": "increaseLiquidity",
277
+ "outputs": [
278
+ {
279
+ "internalType": "uint128",
280
+ "name": "liquidity",
281
+ "type": "uint128"
282
+ },
283
+ {
284
+ "internalType": "uint256",
285
+ "name": "amount0",
286
+ "type": "uint256"
287
+ },
288
+ {
289
+ "internalType": "uint256",
290
+ "name": "amount1",
291
+ "type": "uint256"
292
+ }
293
+ ],
294
+ "stateMutability": "payable",
295
+ "type": "function"
296
+ },
297
+ {
298
+ "inputs": [
299
+ {
300
+ "components": [
301
+ {
302
+ "internalType": "address",
303
+ "name": "token0",
304
+ "type": "address"
305
+ },
306
+ {
307
+ "internalType": "address",
308
+ "name": "token1",
309
+ "type": "address"
310
+ },
311
+ {
312
+ "internalType": "uint24",
313
+ "name": "fee",
314
+ "type": "uint24"
315
+ },
316
+ {
317
+ "internalType": "int24",
318
+ "name": "tickLower",
319
+ "type": "int24"
320
+ },
321
+ {
322
+ "internalType": "int24",
323
+ "name": "tickUpper",
324
+ "type": "int24"
325
+ },
326
+ {
327
+ "internalType": "uint256",
328
+ "name": "amount0Desired",
329
+ "type": "uint256"
330
+ },
331
+ {
332
+ "internalType": "uint256",
333
+ "name": "amount1Desired",
334
+ "type": "uint256"
335
+ },
336
+ {
337
+ "internalType": "uint256",
338
+ "name": "amount0Min",
339
+ "type": "uint256"
340
+ },
341
+ {
342
+ "internalType": "uint256",
343
+ "name": "amount1Min",
344
+ "type": "uint256"
345
+ },
346
+ {
347
+ "internalType": "address",
348
+ "name": "recipient",
349
+ "type": "address"
350
+ },
351
+ {
352
+ "internalType": "uint256",
353
+ "name": "deadline",
354
+ "type": "uint256"
355
+ },
356
+ {
357
+ "internalType": "uint256",
358
+ "name": "veRamTokenId",
359
+ "type": "uint256"
360
+ }
361
+ ],
362
+ "internalType": "struct IRamsesNonfungiblePositionManager.MintParams",
363
+ "name": "params",
364
+ "type": "tuple"
365
+ }
366
+ ],
367
+ "name": "mint",
368
+ "outputs": [
369
+ {
370
+ "internalType": "uint256",
371
+ "name": "tokenId",
372
+ "type": "uint256"
373
+ },
374
+ {
375
+ "internalType": "uint128",
376
+ "name": "liquidity",
377
+ "type": "uint128"
378
+ },
379
+ {
380
+ "internalType": "uint256",
381
+ "name": "amount0",
382
+ "type": "uint256"
383
+ },
384
+ {
385
+ "internalType": "uint256",
386
+ "name": "amount1",
387
+ "type": "uint256"
388
+ }
389
+ ],
390
+ "stateMutability": "payable",
391
+ "type": "function"
392
+ },
393
+ {
394
+ "inputs": [
395
+ {
396
+ "internalType": "uint256",
397
+ "name": "tokenId",
398
+ "type": "uint256"
399
+ }
400
+ ],
401
+ "name": "positions",
402
+ "outputs": [
403
+ {
404
+ "internalType": "uint96",
405
+ "name": "nonce",
406
+ "type": "uint96"
407
+ },
408
+ {
409
+ "internalType": "address",
410
+ "name": "operator",
411
+ "type": "address"
412
+ },
413
+ {
414
+ "internalType": "address",
415
+ "name": "token0",
416
+ "type": "address"
417
+ },
418
+ {
419
+ "internalType": "address",
420
+ "name": "token1",
421
+ "type": "address"
422
+ },
423
+ {
424
+ "internalType": "uint24",
425
+ "name": "fee",
426
+ "type": "uint24"
427
+ },
428
+ {
429
+ "internalType": "int24",
430
+ "name": "tickLower",
431
+ "type": "int24"
432
+ },
433
+ {
434
+ "internalType": "int24",
435
+ "name": "tickUpper",
436
+ "type": "int24"
437
+ },
438
+ {
439
+ "internalType": "uint128",
440
+ "name": "liquidity",
441
+ "type": "uint128"
442
+ },
443
+ {
444
+ "internalType": "uint256",
445
+ "name": "feeGrowthInside0LastX128",
446
+ "type": "uint256"
447
+ },
448
+ {
449
+ "internalType": "uint256",
450
+ "name": "feeGrowthInside1LastX128",
451
+ "type": "uint256"
452
+ },
453
+ {
454
+ "internalType": "uint128",
455
+ "name": "tokensOwed0",
456
+ "type": "uint128"
457
+ },
458
+ {
459
+ "internalType": "uint128",
460
+ "name": "tokensOwed1",
461
+ "type": "uint128"
462
+ }
463
+ ],
464
+ "stateMutability": "view",
465
+ "type": "function"
466
+ },
467
+ {
468
+ "inputs": [
469
+ {
470
+ "internalType": "address",
471
+ "name": "owner",
472
+ "type": "address"
473
+ }
474
+ ],
475
+ "name": "balanceOf",
476
+ "outputs": [
477
+ {
478
+ "internalType": "uint256",
479
+ "name": "",
480
+ "type": "uint256"
481
+ }
482
+ ],
483
+ "stateMutability": "view",
484
+ "type": "function"
485
+ }
486
+ ]
package/src/config.ts CHANGED
@@ -30,7 +30,7 @@ export const routerAddress: AddressDappNetworkMap = {
30
30
  [Dapp.BALANCER]: "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
31
31
  [Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
32
32
  [Dapp.ARRAKIS]: "0xc73fb100a995b33f9fa181d420f4c8d74506df66",
33
- [Dapp.TOROS]: "0xB2F1498983bf9c9442c35F772e6C1AdE66a8DeDE",
33
+ [Dapp.TOROS]: "0x45b90480D6F643dE2f128db091A357C3c90399f2",
34
34
  [Dapp.ZEROEX]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff"
35
35
  },
36
36
  [Network.OPTIMISM]: {
@@ -38,7 +38,7 @@ export const routerAddress: AddressDappNetworkMap = {
38
38
  [Dapp.SYNTHETIX]: "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4",
39
39
  [Dapp.AAVEV3]: "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
40
40
  [Dapp.ONEINCH]: "0x111111125421ca6dc452d289314280a0f8842a65",
41
- [Dapp.TOROS]: "0x3988513793bCE39f0167064A9F7fC3617FaF35AB",
41
+ [Dapp.TOROS]: "0x2Ed1bd7f66e47113672f3870308b5E867C5bb743",
42
42
  [Dapp.VELODROME]: "0x9c12939390052919aF3155f41Bf4160Fd3666A6f",
43
43
  [Dapp.VELODROMEV2]: "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858",
44
44
  [Dapp.LYRA]: "0xCCE7819d65f348c64B7Beb205BA367b3fE33763B",
@@ -51,13 +51,15 @@ export const routerAddress: AddressDappNetworkMap = {
51
51
  [Dapp.AAVEV3]: "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
52
52
  [Dapp.BALANCER]: "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
53
53
  [Dapp.RAMSES]: "0xaaa87963efeb6f7e0a2711f397663105acb1805e",
54
- [Dapp.ZEROEX]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff"
54
+ [Dapp.ZEROEX]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
55
+ [Dapp.TOROS]: "0xA5679C4272A056Bb83f039961fae7D99C48529F5"
55
56
  },
56
57
  [Network.BASE]: {
57
58
  [Dapp.ONEINCH]: "0x111111125421ca6dc452d289314280a0f8842a65",
58
59
  [Dapp.ZEROEX]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
59
60
  [Dapp.AERODROME]: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
60
- [Dapp.AAVEV3]: "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5"
61
+ [Dapp.AAVEV3]: "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5",
62
+ [Dapp.TOROS]: "0xf067575Eb60c7587C11e867907AA7284833704d1"
61
63
  }
62
64
  };
63
65
 
@@ -110,7 +112,8 @@ export const nonfungiblePositionManagerAddress: AddressDappNetworkMap = {
110
112
  [Dapp.VELODROMECL]: "0x416b433906b1B72FA758e166e239c43d68dC6F29"
111
113
  },
112
114
  [Network.ARBITRUM]: {
113
- [Dapp.UNISWAPV3]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
115
+ [Dapp.UNISWAPV3]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
116
+ [Dapp.RAMSESCL]: "0xAA277CB7914b7e5514946Da92cb9De332Ce610EF"
114
117
  },
115
118
  [Network.BASE]: {
116
119
  [Dapp.UNISWAPV3]: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",
@@ -40,7 +40,10 @@ import {
40
40
  getUniswapV3MintTxData
41
41
  } from "../services/uniswap/V3Liquidity";
42
42
  import { getUniswapV3SwapTxData } from "../services/uniswap/V3Trade";
43
- import { getEasySwapperTxData } from "../services/toros/easySwapper";
43
+ import {
44
+ getCompleteWithdrawalTxData,
45
+ getEasySwapperTxData
46
+ } from "../services/toros/easySwapper";
44
47
  import { getAaveV3ClaimTxData } from "../services/aave/incentives";
45
48
  import {
46
49
  getVelodromeAddLiquidityTxData,
@@ -64,7 +67,8 @@ import { getZeroExTradeTxData } from "../services/zeroEx/zeroExTrade";
64
67
  import { getOneInchSwapTxData } from "../services/oneInch";
65
68
  import {
66
69
  getCreateVestTxData,
67
- getExitVestTxData
70
+ getExitVestTxData,
71
+ getRewardsTxDta
68
72
  } from "../services/ramses/vesting";
69
73
  import { getPoolTxOrGasEstimate } from "../utils/contract";
70
74
  import {
@@ -370,13 +374,13 @@ export class Pool {
370
374
  );
371
375
  break;
372
376
  case Dapp.ONEINCH:
373
- swapTxData = await getOneInchSwapTxData(
377
+ ({ swapTxData } = await getOneInchSwapTxData(
374
378
  this,
375
379
  assetFrom,
376
380
  assetTo,
377
381
  amountIn,
378
382
  slippage
379
- );
383
+ ));
380
384
  break;
381
385
  case Dapp.BALANCER:
382
386
  swapTxData = await this.utils.getBalancerSwapTx(
@@ -1038,7 +1042,7 @@ export class Pool {
1038
1042
 
1039
1043
  /**
1040
1044
  * Create UniswapV3 liquidity pool
1041
- * @param {dapp} Platform UniswapV3, VelodromeCL or AerodromeCL
1045
+ * @param {dapp} Platform UniswapV3, VelodromeCL, AerodromeCL or RamesesCL
1042
1046
  * @param {string} assetA First asset
1043
1047
  * @param {string} assetB Second asset
1044
1048
  * @param {BigNumber | string} amountA Amount first asset
@@ -1053,7 +1057,7 @@ export class Pool {
1053
1057
  * @returns {Promise<any>} Transaction
1054
1058
  */
1055
1059
  async addLiquidityUniswapV3(
1056
- dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL,
1060
+ dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.RAMSESCL,
1057
1061
  assetA: string,
1058
1062
  assetB: string,
1059
1063
  amountA: BigNumber | string,
@@ -1121,6 +1125,7 @@ export class Pool {
1121
1125
  let txData;
1122
1126
  switch (dapp) {
1123
1127
  case Dapp.UNISWAPV3:
1128
+ case Dapp.RAMSESCL:
1124
1129
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1125
1130
  break;
1126
1131
  case Dapp.VELODROMECL:
@@ -1178,6 +1183,7 @@ export class Pool {
1178
1183
  let txData;
1179
1184
  switch (dapp) {
1180
1185
  case Dapp.UNISWAPV3:
1186
+ case Dapp.RAMSESCL:
1181
1187
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1182
1188
  break;
1183
1189
  case Dapp.VELODROMECL:
@@ -1239,6 +1245,7 @@ export class Pool {
1239
1245
  );
1240
1246
  switch (dapp) {
1241
1247
  case Dapp.UNISWAPV3:
1248
+ case Dapp.RAMSESCL:
1242
1249
  contractAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1243
1250
  txData = iNonfungiblePositionManager.encodeFunctionData(
1244
1251
  Transaction.COLLECT,
@@ -1288,6 +1295,34 @@ export class Pool {
1288
1295
  return tx;
1289
1296
  }
1290
1297
 
1298
+ /**
1299
+ * Get rewards of an NFT position
1300
+ * @param {Dapp} dapp Platform e.g. Ramses CL
1301
+ * @param {string} tokenId Token Id
1302
+ * @param {string[]} rewards Reward tokens
1303
+ * @param {any} options Transaction option
1304
+ * @param {boolean} estimateGas Simulate/estimate gas
1305
+ * @returns {Promise<any>} Transaction
1306
+ */
1307
+ async getRewards(
1308
+ dapp: Dapp,
1309
+ tokenId: string,
1310
+ rewards: string[],
1311
+ options: any = null,
1312
+ estimateGas = false
1313
+ ): Promise<any> {
1314
+ const tx = await getPoolTxOrGasEstimate(
1315
+ this,
1316
+ [
1317
+ nonfungiblePositionManagerAddress[this.network][dapp],
1318
+ getRewardsTxDta(tokenId, rewards),
1319
+ options
1320
+ ],
1321
+ estimateGas
1322
+ );
1323
+ return tx;
1324
+ }
1325
+
1291
1326
  /**
1292
1327
  * Trade an asset into another asset
1293
1328
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
@@ -1810,4 +1845,31 @@ export class Pool {
1810
1845
  const tx = await cancelOrderViaFlatMoney(this, options, estimateGas);
1811
1846
  return tx;
1812
1847
  }
1848
+
1849
+ /**
1850
+ * Complete a Toros withdrawal to a single asset
1851
+ * @param {string} destinationToken Address of destination asset
1852
+ * @param {number} slippage Slippage tolerance in %
1853
+ * @param {any} options Transaction options
1854
+ * @param {boolean} estimateGas Simulate/estimate gas
1855
+ * @returns {Promise<any>} Transaction
1856
+ */
1857
+ async completeTorosWithdrawal(
1858
+ destinationToken: string,
1859
+ slippage = 0.5,
1860
+ options: any = null,
1861
+ estimateGas = false
1862
+ ): Promise<any> {
1863
+ const txData = await getCompleteWithdrawalTxData(
1864
+ this,
1865
+ destinationToken,
1866
+ slippage
1867
+ );
1868
+ const tx = await getPoolTxOrGasEstimate(
1869
+ this,
1870
+ [routerAddress[this.network].toros, txData, options],
1871
+ estimateGas
1872
+ );
1873
+ return tx;
1874
+ }
1813
1875
  }