@dhedge/v2-sdk 1.9.9 → 1.10.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/dist/config.d.ts +1 -1
- package/dist/entities/pool.d.ts +17 -7
- package/dist/services/uniswap/V3Liquidity.d.ts +8 -7
- package/dist/services/uniswap/V3Trade.d.ts +1 -2
- package/dist/services/velodrome/liquidity.d.ts +7 -3
- package/dist/services/velodrome/staking.d.ts +1 -0
- package/dist/test/constants.d.ts +14 -0
- package/dist/test/utils/testingHelper.d.ts +6 -0
- package/dist/types.d.ts +1 -0
- package/dist/v2-sdk.cjs.development.js +2673 -1368
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +2686 -1381
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/abi/IERC721.json +217 -0
- package/src/abi/IVelodromeCLGauge.json +165 -0
- package/src/abi/IVelodromeNonfungiblePositionManager.json +408 -0
- package/src/config.ts +14 -6
- package/src/entities/pool.ts +141 -82
- package/src/services/lyra/trade.ts +1 -1
- package/src/services/uniswap/V3Liquidity.ts +141 -18
- package/src/services/uniswap/V3Trade.ts +1 -2
- package/src/services/velodrome/liquidity.ts +77 -5
- package/src/services/velodrome/staking.ts +6 -0
- package/src/test/constants.ts +22 -6
- package/src/test/uniswap.test.ts +24 -15
- package/src/test/utils/testingHelper.ts +25 -1
- package/src/test/velodromeCL.test.ts +223 -0
- package/src/types.ts +1 -0
- package/dist/services/uniswap/types.d.ts +0 -3
- package/src/services/uniswap/types.ts +0 -16
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
{ "abi": [
|
|
2
|
+
{
|
|
3
|
+
"inputs": [
|
|
4
|
+
{
|
|
5
|
+
"internalType": "uint256",
|
|
6
|
+
"name": "tokenId",
|
|
7
|
+
"type": "uint256"
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"name": "burn",
|
|
11
|
+
"outputs": [],
|
|
12
|
+
"stateMutability": "payable",
|
|
13
|
+
"type": "function"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"inputs": [
|
|
17
|
+
{
|
|
18
|
+
"components": [
|
|
19
|
+
{
|
|
20
|
+
"internalType": "uint256",
|
|
21
|
+
"name": "tokenId",
|
|
22
|
+
"type": "uint256"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"internalType": "address",
|
|
26
|
+
"name": "recipient",
|
|
27
|
+
"type": "address"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"internalType": "uint128",
|
|
31
|
+
"name": "amount0Max",
|
|
32
|
+
"type": "uint128"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"internalType": "uint128",
|
|
36
|
+
"name": "amount1Max",
|
|
37
|
+
"type": "uint128"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"internalType": "struct IVelodromeNonfungiblePositionManager.CollectParams",
|
|
41
|
+
"name": "params",
|
|
42
|
+
"type": "tuple"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "collect",
|
|
46
|
+
"outputs": [
|
|
47
|
+
{
|
|
48
|
+
"internalType": "uint256",
|
|
49
|
+
"name": "amount0",
|
|
50
|
+
"type": "uint256"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"internalType": "uint256",
|
|
54
|
+
"name": "amount1",
|
|
55
|
+
"type": "uint256"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"stateMutability": "payable",
|
|
59
|
+
"type": "function"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"inputs": [
|
|
63
|
+
{
|
|
64
|
+
"components": [
|
|
65
|
+
{
|
|
66
|
+
"internalType": "uint256",
|
|
67
|
+
"name": "tokenId",
|
|
68
|
+
"type": "uint256"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"internalType": "uint128",
|
|
72
|
+
"name": "liquidity",
|
|
73
|
+
"type": "uint128"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"internalType": "uint256",
|
|
77
|
+
"name": "amount0Min",
|
|
78
|
+
"type": "uint256"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"internalType": "uint256",
|
|
82
|
+
"name": "amount1Min",
|
|
83
|
+
"type": "uint256"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"internalType": "uint256",
|
|
87
|
+
"name": "deadline",
|
|
88
|
+
"type": "uint256"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"internalType": "struct IVelodromeNonfungiblePositionManager.DecreaseLiquidityParams",
|
|
92
|
+
"name": "params",
|
|
93
|
+
"type": "tuple"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"name": "decreaseLiquidity",
|
|
97
|
+
"outputs": [
|
|
98
|
+
{
|
|
99
|
+
"internalType": "uint256",
|
|
100
|
+
"name": "amount0",
|
|
101
|
+
"type": "uint256"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"internalType": "uint256",
|
|
105
|
+
"name": "amount1",
|
|
106
|
+
"type": "uint256"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"stateMutability": "payable",
|
|
110
|
+
"type": "function"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"inputs": [],
|
|
114
|
+
"name": "factory",
|
|
115
|
+
"outputs": [
|
|
116
|
+
{
|
|
117
|
+
"internalType": "address",
|
|
118
|
+
"name": "",
|
|
119
|
+
"type": "address"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"stateMutability": "view",
|
|
123
|
+
"type": "function"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"inputs": [
|
|
127
|
+
{
|
|
128
|
+
"components": [
|
|
129
|
+
{
|
|
130
|
+
"internalType": "uint256",
|
|
131
|
+
"name": "tokenId",
|
|
132
|
+
"type": "uint256"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"internalType": "uint256",
|
|
136
|
+
"name": "amount0Desired",
|
|
137
|
+
"type": "uint256"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"internalType": "uint256",
|
|
141
|
+
"name": "amount1Desired",
|
|
142
|
+
"type": "uint256"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"internalType": "uint256",
|
|
146
|
+
"name": "amount0Min",
|
|
147
|
+
"type": "uint256"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"internalType": "uint256",
|
|
151
|
+
"name": "amount1Min",
|
|
152
|
+
"type": "uint256"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"internalType": "uint256",
|
|
156
|
+
"name": "deadline",
|
|
157
|
+
"type": "uint256"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"internalType": "struct IVelodromeNonfungiblePositionManager.IncreaseLiquidityParams",
|
|
161
|
+
"name": "params",
|
|
162
|
+
"type": "tuple"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"name": "increaseLiquidity",
|
|
166
|
+
"outputs": [
|
|
167
|
+
{
|
|
168
|
+
"internalType": "uint128",
|
|
169
|
+
"name": "liquidity",
|
|
170
|
+
"type": "uint128"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"internalType": "uint256",
|
|
174
|
+
"name": "amount0",
|
|
175
|
+
"type": "uint256"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"internalType": "uint256",
|
|
179
|
+
"name": "amount1",
|
|
180
|
+
"type": "uint256"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"stateMutability": "payable",
|
|
184
|
+
"type": "function"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"inputs": [
|
|
188
|
+
{
|
|
189
|
+
"components": [
|
|
190
|
+
{
|
|
191
|
+
"internalType": "address",
|
|
192
|
+
"name": "token0",
|
|
193
|
+
"type": "address"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"internalType": "address",
|
|
197
|
+
"name": "token1",
|
|
198
|
+
"type": "address"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"internalType": "int24",
|
|
202
|
+
"name": "tickSpacing",
|
|
203
|
+
"type": "int24"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"internalType": "int24",
|
|
207
|
+
"name": "tickLower",
|
|
208
|
+
"type": "int24"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"internalType": "int24",
|
|
212
|
+
"name": "tickUpper",
|
|
213
|
+
"type": "int24"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"internalType": "uint256",
|
|
217
|
+
"name": "amount0Desired",
|
|
218
|
+
"type": "uint256"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"internalType": "uint256",
|
|
222
|
+
"name": "amount1Desired",
|
|
223
|
+
"type": "uint256"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"internalType": "uint256",
|
|
227
|
+
"name": "amount0Min",
|
|
228
|
+
"type": "uint256"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"internalType": "uint256",
|
|
232
|
+
"name": "amount1Min",
|
|
233
|
+
"type": "uint256"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"internalType": "address",
|
|
237
|
+
"name": "recipient",
|
|
238
|
+
"type": "address"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"internalType": "uint256",
|
|
242
|
+
"name": "deadline",
|
|
243
|
+
"type": "uint256"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"internalType": "uint160",
|
|
247
|
+
"name": "sqrtPriceX96",
|
|
248
|
+
"type": "uint160"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"internalType": "struct IVelodromeNonfungiblePositionManager.MintParams",
|
|
252
|
+
"name": "params",
|
|
253
|
+
"type": "tuple"
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"name": "mint",
|
|
257
|
+
"outputs": [
|
|
258
|
+
{
|
|
259
|
+
"internalType": "uint256",
|
|
260
|
+
"name": "tokenId",
|
|
261
|
+
"type": "uint256"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"internalType": "uint128",
|
|
265
|
+
"name": "liquidity",
|
|
266
|
+
"type": "uint128"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"internalType": "uint256",
|
|
270
|
+
"name": "amount0",
|
|
271
|
+
"type": "uint256"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"internalType": "uint256",
|
|
275
|
+
"name": "amount1",
|
|
276
|
+
"type": "uint256"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
"stateMutability": "payable",
|
|
280
|
+
"type": "function"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"inputs": [],
|
|
284
|
+
"name": "owner",
|
|
285
|
+
"outputs": [
|
|
286
|
+
{
|
|
287
|
+
"internalType": "address",
|
|
288
|
+
"name": "",
|
|
289
|
+
"type": "address"
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"stateMutability": "view",
|
|
293
|
+
"type": "function"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"inputs": [
|
|
297
|
+
{
|
|
298
|
+
"internalType": "uint256",
|
|
299
|
+
"name": "tokenId",
|
|
300
|
+
"type": "uint256"
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"name": "positions",
|
|
304
|
+
"outputs": [
|
|
305
|
+
{
|
|
306
|
+
"internalType": "uint96",
|
|
307
|
+
"name": "nonce",
|
|
308
|
+
"type": "uint96"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"internalType": "address",
|
|
312
|
+
"name": "operator",
|
|
313
|
+
"type": "address"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"internalType": "address",
|
|
317
|
+
"name": "token0",
|
|
318
|
+
"type": "address"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"internalType": "address",
|
|
322
|
+
"name": "token1",
|
|
323
|
+
"type": "address"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"internalType": "int24",
|
|
327
|
+
"name": "tickSpacing",
|
|
328
|
+
"type": "int24"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"internalType": "int24",
|
|
332
|
+
"name": "tickLower",
|
|
333
|
+
"type": "int24"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"internalType": "int24",
|
|
337
|
+
"name": "tickUpper",
|
|
338
|
+
"type": "int24"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"internalType": "uint128",
|
|
342
|
+
"name": "liquidity",
|
|
343
|
+
"type": "uint128"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"internalType": "uint256",
|
|
347
|
+
"name": "feeGrowthInside0LastX128",
|
|
348
|
+
"type": "uint256"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"internalType": "uint256",
|
|
352
|
+
"name": "feeGrowthInside1LastX128",
|
|
353
|
+
"type": "uint256"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"internalType": "uint128",
|
|
357
|
+
"name": "tokensOwed0",
|
|
358
|
+
"type": "uint128"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"internalType": "uint128",
|
|
362
|
+
"name": "tokensOwed1",
|
|
363
|
+
"type": "uint128"
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
"stateMutability": "view",
|
|
367
|
+
"type": "function"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"inputs": [
|
|
371
|
+
{
|
|
372
|
+
"internalType": "address",
|
|
373
|
+
"name": "_owner",
|
|
374
|
+
"type": "address"
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
"name": "setOwner",
|
|
378
|
+
"outputs": [],
|
|
379
|
+
"stateMutability": "nonpayable",
|
|
380
|
+
"type": "function"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"inputs": [
|
|
384
|
+
{
|
|
385
|
+
"internalType": "address",
|
|
386
|
+
"name": "_tokenDescriptor",
|
|
387
|
+
"type": "address"
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
"name": "setTokenDescriptor",
|
|
391
|
+
"outputs": [],
|
|
392
|
+
"stateMutability": "nonpayable",
|
|
393
|
+
"type": "function"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"inputs": [],
|
|
397
|
+
"name": "tokenDescriptor",
|
|
398
|
+
"outputs": [
|
|
399
|
+
{
|
|
400
|
+
"internalType": "address",
|
|
401
|
+
"name": "",
|
|
402
|
+
"type": "address"
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
"stateMutability": "view",
|
|
406
|
+
"type": "function"
|
|
407
|
+
}
|
|
408
|
+
]}
|
package/src/config.ts
CHANGED
|
@@ -98,12 +98,20 @@ export const aaveAddressProvider: AddressDappNetworkMap = {
|
|
|
98
98
|
[Dapp.AAVEV3]: "0xe20fCBdBfFC4Dd138cE8b2E6FBb6CB49777ad64D"
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
export const nonfungiblePositionManagerAddress:
|
|
102
|
-
[Network.POLYGON]:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
export const nonfungiblePositionManagerAddress: AddressDappNetworkMap = {
|
|
102
|
+
[Network.POLYGON]: {
|
|
103
|
+
[Dapp.UNISWAPV3]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
|
|
104
|
+
},
|
|
105
|
+
[Network.OPTIMISM]: {
|
|
106
|
+
[Dapp.UNISWAPV3]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
|
|
107
|
+
[Dapp.VELODROMECL]: "0xbb5dfe1380333cee4c2eebd7202c80de2256adf4"
|
|
108
|
+
},
|
|
109
|
+
[Network.ARBITRUM]: {
|
|
110
|
+
[Dapp.UNISWAPV3]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
|
|
111
|
+
},
|
|
112
|
+
[Network.BASE]: {
|
|
113
|
+
[Dapp.UNISWAPV3]: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1"
|
|
114
|
+
}
|
|
107
115
|
};
|
|
108
116
|
|
|
109
117
|
export const networkChainIdMap: NetworkChainIdMap = {
|