@dhedge/v2-sdk 1.7.2 → 1.8.1
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 +0 -1
- package/dist/entities/pool.d.ts +16 -7
- package/dist/services/futures/constants.d.ts +3 -0
- package/dist/services/futures/index.d.ts +2 -0
- package/dist/services/futures/margin.d.ts +2 -0
- package/dist/services/futures/trade.d.ts +2 -0
- package/dist/services/velodrome/liquidity.d.ts +2 -2
- package/dist/test/constants.d.ts +24 -2
- package/dist/test/utils/token.d.ts +3 -0
- package/dist/utils/deadline.d.ts +2 -0
- package/dist/v2-sdk.cjs.development.js +4540 -5103
- 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 +7341 -7904
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +5 -2
- package/src/abi/IDhedgeEasySwapper.json +99 -239
- package/src/abi/ISynthetiXFuturesMarketV2.json +531 -0
- package/src/config.ts +4 -5
- package/src/entities/pool.ts +68 -44
- package/src/services/futures/constants.ts +4 -0
- package/src/services/futures/index.ts +2 -0
- package/src/services/futures/margin.ts +10 -0
- package/src/services/futures/trade.ts +15 -0
- package/src/services/oneInch/protocols.ts +3 -4
- package/src/services/toros/easySwapper.ts +3 -2
- package/src/services/uniswap/V3Liquidity.ts +2 -3
- package/src/services/velodrome/liquidity.ts +7 -7
- package/src/test/constants.ts +27 -2
- package/src/test/futures.test.ts +48 -0
- package/src/test/oneInch.test.ts +32 -36
- package/src/test/pool.test.ts +42 -85
- package/src/test/toros.test.ts +50 -98
- package/src/test/uniswap.test.ts +65 -30
- package/src/test/utils/token.ts +31 -0
- package/src/test/velodrome.test.ts +74 -101
- package/src/test/wallet.ts +5 -3
- package/src/utils/deadline.ts +6 -0
- package/dist/services/claim-balancer/claim.service.d.ts +0 -17
- package/dist/services/claim-balancer/claim.worker.d.ts +0 -4
- package/dist/services/claim-balancer/ipfs.service.d.ts +0 -4
- package/dist/services/claim-balancer/types.d.ts +0 -54
- package/src/services/claim-balancer/MultiTokenClaim.json +0 -115
- package/src/services/claim-balancer/claim.service.ts +0 -262
- package/src/services/claim-balancer/claim.worker.ts +0 -32
- package/src/services/claim-balancer/ipfs.service.ts +0 -12
- package/src/services/claim-balancer/types.ts +0 -66
- package/src/test/1inch.test.ts +0 -54
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhedge/v2-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "🛠 An SDK for building applications on top of dHEDGE V2",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"lint": "tsdx lint",
|
|
20
20
|
"prepare": "tsdx build",
|
|
21
21
|
"size": "size-limit",
|
|
22
|
-
"analyze": "size-limit --why"
|
|
22
|
+
"analyze": "size-limit --why",
|
|
23
|
+
"fork:polygon": "hardhat node --fork $(grep POLYGON_URL .env | cut -d '=' -f2)",
|
|
24
|
+
"fork:optimism": "hardhat node --fork $(grep OPTIMISM_URL .env | cut -d '=' -f2)"
|
|
23
25
|
},
|
|
24
26
|
"husky": {
|
|
25
27
|
"hooks": {
|
|
@@ -30,6 +32,7 @@
|
|
|
30
32
|
"@size-limit/preset-small-lib": "^5.0.1",
|
|
31
33
|
"@types/jest": "^28.1.7",
|
|
32
34
|
"@types/lodash": "^4.14.178",
|
|
35
|
+
"hardhat": "^2.12.6",
|
|
33
36
|
"husky": "^7.0.1",
|
|
34
37
|
"jest": "^28.1.3",
|
|
35
38
|
"size-limit": "^5.0.1",
|
|
@@ -3,142 +3,98 @@
|
|
|
3
3
|
{
|
|
4
4
|
"inputs": [
|
|
5
5
|
{
|
|
6
|
-
"internalType": "address
|
|
7
|
-
"name": "
|
|
6
|
+
"internalType": "address",
|
|
7
|
+
"name": "",
|
|
8
8
|
"type": "address"
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"name": "allowedPools",
|
|
12
|
+
"outputs": [
|
|
10
13
|
{
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"name": "swapRouter",
|
|
15
|
-
"type": "address"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"internalType": "contract IUniswapV2Router",
|
|
19
|
-
"name": "assetType2Router",
|
|
20
|
-
"type": "address"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"internalType": "contract IUniswapV2Router",
|
|
24
|
-
"name": "assetType5Router",
|
|
25
|
-
"type": "address"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"components": [
|
|
29
|
-
{
|
|
30
|
-
"internalType": "contract ISynthetix",
|
|
31
|
-
"name": "snxProxy",
|
|
32
|
-
"type": "address"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"internalType": "contract IERC20",
|
|
36
|
-
"name": "swapSUSDToAsset",
|
|
37
|
-
"type": "address"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"internalType": "contract ISynthAddressProxy",
|
|
41
|
-
"name": "sUSDProxy",
|
|
42
|
-
"type": "address"
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"internalType": "struct EasySwapperStructs.SynthetixProps",
|
|
46
|
-
"name": "synthetixProps",
|
|
47
|
-
"type": "tuple"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"internalType": "contract IERC20",
|
|
51
|
-
"name": "weth",
|
|
52
|
-
"type": "address"
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
"internalType": "struct EasySwapperStructs.WithdrawProps",
|
|
56
|
-
"name": "_withdrawProps",
|
|
57
|
-
"type": "tuple"
|
|
14
|
+
"internalType": "bool",
|
|
15
|
+
"name": "",
|
|
16
|
+
"type": "bool"
|
|
58
17
|
}
|
|
59
18
|
],
|
|
60
|
-
"stateMutability": "
|
|
61
|
-
"type": "
|
|
19
|
+
"stateMutability": "view",
|
|
20
|
+
"type": "function"
|
|
62
21
|
},
|
|
63
22
|
{
|
|
64
|
-
"anonymous": false,
|
|
65
23
|
"inputs": [
|
|
66
24
|
{
|
|
67
|
-
"indexed": false,
|
|
68
25
|
"internalType": "address",
|
|
69
26
|
"name": "pool",
|
|
70
27
|
"type": "address"
|
|
71
28
|
},
|
|
72
29
|
{
|
|
73
|
-
"
|
|
74
|
-
"internalType": "address",
|
|
75
|
-
"name": "depositor",
|
|
76
|
-
"type": "address"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"indexed": false,
|
|
80
|
-
"internalType": "address",
|
|
30
|
+
"internalType": "contract IERC20Extended",
|
|
81
31
|
"name": "depositAsset",
|
|
82
32
|
"type": "address"
|
|
83
33
|
},
|
|
84
34
|
{
|
|
85
|
-
"indexed": false,
|
|
86
35
|
"internalType": "uint256",
|
|
87
36
|
"name": "amount",
|
|
88
37
|
"type": "uint256"
|
|
89
38
|
},
|
|
90
39
|
{
|
|
91
|
-
"
|
|
92
|
-
"internalType": "address",
|
|
40
|
+
"internalType": "contract IERC20Extended",
|
|
93
41
|
"name": "poolDepositAsset",
|
|
94
42
|
"type": "address"
|
|
95
43
|
},
|
|
96
44
|
{
|
|
97
|
-
"
|
|
45
|
+
"internalType": "uint256",
|
|
46
|
+
"name": "expectedLiquidityMinted",
|
|
47
|
+
"type": "uint256"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"name": "deposit",
|
|
51
|
+
"outputs": [
|
|
52
|
+
{
|
|
98
53
|
"internalType": "uint256",
|
|
99
54
|
"name": "liquidityMinted",
|
|
100
55
|
"type": "uint256"
|
|
101
56
|
}
|
|
102
57
|
],
|
|
103
|
-
"
|
|
104
|
-
"type": "
|
|
58
|
+
"stateMutability": "nonpayable",
|
|
59
|
+
"type": "function"
|
|
105
60
|
},
|
|
106
61
|
{
|
|
107
|
-
"anonymous": false,
|
|
108
62
|
"inputs": [
|
|
109
63
|
{
|
|
110
|
-
"indexed": true,
|
|
111
64
|
"internalType": "address",
|
|
112
|
-
"name": "
|
|
65
|
+
"name": "pool",
|
|
113
66
|
"type": "address"
|
|
114
67
|
},
|
|
115
68
|
{
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"name": "newOwner",
|
|
69
|
+
"internalType": "contract IERC20Extended",
|
|
70
|
+
"name": "depositAsset",
|
|
119
71
|
"type": "address"
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
"name": "OwnershipTransferred",
|
|
123
|
-
"type": "event"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
"inputs": [
|
|
72
|
+
},
|
|
127
73
|
{
|
|
128
|
-
"internalType": "
|
|
129
|
-
"name": "",
|
|
74
|
+
"internalType": "uint256",
|
|
75
|
+
"name": "amount",
|
|
76
|
+
"type": "uint256"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"internalType": "contract IERC20Extended",
|
|
80
|
+
"name": "poolDepositAsset",
|
|
130
81
|
"type": "address"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"internalType": "uint256",
|
|
85
|
+
"name": "expectedLiquidityMinted",
|
|
86
|
+
"type": "uint256"
|
|
131
87
|
}
|
|
132
88
|
],
|
|
133
|
-
"name": "
|
|
89
|
+
"name": "depositWithCustomCooldown",
|
|
134
90
|
"outputs": [
|
|
135
91
|
{
|
|
136
|
-
"internalType": "
|
|
137
|
-
"name": "",
|
|
138
|
-
"type": "
|
|
92
|
+
"internalType": "uint256",
|
|
93
|
+
"name": "liquidityMinted",
|
|
94
|
+
"type": "uint256"
|
|
139
95
|
}
|
|
140
96
|
],
|
|
141
|
-
"stateMutability": "
|
|
97
|
+
"stateMutability": "nonpayable",
|
|
142
98
|
"type": "function"
|
|
143
99
|
},
|
|
144
100
|
{
|
|
@@ -149,17 +105,36 @@
|
|
|
149
105
|
"type": "address"
|
|
150
106
|
},
|
|
151
107
|
{
|
|
152
|
-
"internalType": "contract
|
|
153
|
-
"name": "
|
|
108
|
+
"internalType": "contract IERC20Extended",
|
|
109
|
+
"name": "poolDepositAsset",
|
|
154
110
|
"type": "address"
|
|
155
111
|
},
|
|
156
112
|
{
|
|
157
113
|
"internalType": "uint256",
|
|
158
|
-
"name": "
|
|
114
|
+
"name": "expectedLiquidityMinted",
|
|
115
|
+
"type": "uint256"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"name": "depositNative",
|
|
119
|
+
"outputs": [
|
|
120
|
+
{
|
|
121
|
+
"internalType": "uint256",
|
|
122
|
+
"name": "liquidityMinted",
|
|
159
123
|
"type": "uint256"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"stateMutability": "payable",
|
|
127
|
+
"type": "function"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"inputs": [
|
|
131
|
+
{
|
|
132
|
+
"internalType": "address",
|
|
133
|
+
"name": "pool",
|
|
134
|
+
"type": "address"
|
|
160
135
|
},
|
|
161
136
|
{
|
|
162
|
-
"internalType": "contract
|
|
137
|
+
"internalType": "contract IERC20Extended",
|
|
163
138
|
"name": "poolDepositAsset",
|
|
164
139
|
"type": "address"
|
|
165
140
|
},
|
|
@@ -169,7 +144,7 @@
|
|
|
169
144
|
"type": "uint256"
|
|
170
145
|
}
|
|
171
146
|
],
|
|
172
|
-
"name": "
|
|
147
|
+
"name": "depositNativeWithCustomCooldown",
|
|
173
148
|
"outputs": [
|
|
174
149
|
{
|
|
175
150
|
"internalType": "uint256",
|
|
@@ -177,7 +152,7 @@
|
|
|
177
152
|
"type": "uint256"
|
|
178
153
|
}
|
|
179
154
|
],
|
|
180
|
-
"stateMutability": "
|
|
155
|
+
"stateMutability": "payable",
|
|
181
156
|
"type": "function"
|
|
182
157
|
},
|
|
183
158
|
{
|
|
@@ -188,7 +163,7 @@
|
|
|
188
163
|
"type": "address"
|
|
189
164
|
},
|
|
190
165
|
{
|
|
191
|
-
"internalType": "contract
|
|
166
|
+
"internalType": "contract IERC20Extended",
|
|
192
167
|
"name": "depositAsset",
|
|
193
168
|
"type": "address"
|
|
194
169
|
},
|
|
@@ -198,9 +173,14 @@
|
|
|
198
173
|
"type": "uint256"
|
|
199
174
|
},
|
|
200
175
|
{
|
|
201
|
-
"internalType": "contract
|
|
176
|
+
"internalType": "contract IERC20Extended",
|
|
202
177
|
"name": "poolDepositAsset",
|
|
203
178
|
"type": "address"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"internalType": "bool",
|
|
182
|
+
"name": "customCooldown",
|
|
183
|
+
"type": "bool"
|
|
204
184
|
}
|
|
205
185
|
],
|
|
206
186
|
"name": "depositQuote",
|
|
@@ -241,65 +221,29 @@
|
|
|
241
221
|
"type": "function"
|
|
242
222
|
},
|
|
243
223
|
{
|
|
244
|
-
"inputs": [
|
|
245
|
-
"name": "feeSink",
|
|
246
|
-
"outputs": [
|
|
247
|
-
{
|
|
248
|
-
"internalType": "address payable",
|
|
249
|
-
"name": "",
|
|
250
|
-
"type": "address"
|
|
251
|
-
}
|
|
252
|
-
],
|
|
253
|
-
"stateMutability": "view",
|
|
254
|
-
"type": "function"
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
"inputs": [],
|
|
258
|
-
"name": "owner",
|
|
259
|
-
"outputs": [
|
|
224
|
+
"inputs": [
|
|
260
225
|
{
|
|
261
226
|
"internalType": "address",
|
|
262
|
-
"name": "",
|
|
227
|
+
"name": "pool",
|
|
263
228
|
"type": "address"
|
|
264
|
-
}
|
|
265
|
-
],
|
|
266
|
-
"stateMutability": "view",
|
|
267
|
-
"type": "function"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
"inputs": [],
|
|
271
|
-
"name": "renounceOwnership",
|
|
272
|
-
"outputs": [],
|
|
273
|
-
"stateMutability": "nonpayable",
|
|
274
|
-
"type": "function"
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
"inputs": [
|
|
229
|
+
},
|
|
278
230
|
{
|
|
279
231
|
"internalType": "uint256",
|
|
280
|
-
"name": "
|
|
232
|
+
"name": "fundTokenAmount",
|
|
281
233
|
"type": "uint256"
|
|
282
234
|
},
|
|
235
|
+
{
|
|
236
|
+
"internalType": "contract IERC20Extended",
|
|
237
|
+
"name": "withdrawalAsset",
|
|
238
|
+
"type": "address"
|
|
239
|
+
},
|
|
283
240
|
{
|
|
284
241
|
"internalType": "uint256",
|
|
285
|
-
"name": "
|
|
242
|
+
"name": "expectedAmountOut",
|
|
286
243
|
"type": "uint256"
|
|
287
244
|
}
|
|
288
245
|
],
|
|
289
|
-
"name": "
|
|
290
|
-
"outputs": [],
|
|
291
|
-
"stateMutability": "nonpayable",
|
|
292
|
-
"type": "function"
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
"inputs": [
|
|
296
|
-
{
|
|
297
|
-
"internalType": "address payable",
|
|
298
|
-
"name": "sink",
|
|
299
|
-
"type": "address"
|
|
300
|
-
}
|
|
301
|
-
],
|
|
302
|
-
"name": "setFeeSink",
|
|
246
|
+
"name": "withdraw",
|
|
303
247
|
"outputs": [],
|
|
304
248
|
"stateMutability": "nonpayable",
|
|
305
249
|
"type": "function"
|
|
@@ -312,55 +256,21 @@
|
|
|
312
256
|
"type": "address"
|
|
313
257
|
},
|
|
314
258
|
{
|
|
315
|
-
"internalType": "
|
|
316
|
-
"name": "
|
|
317
|
-
"type": "
|
|
318
|
-
}
|
|
319
|
-
],
|
|
320
|
-
"name": "setPoolAllowed",
|
|
321
|
-
"outputs": [],
|
|
322
|
-
"stateMutability": "nonpayable",
|
|
323
|
-
"type": "function"
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"inputs": [
|
|
327
|
-
{
|
|
328
|
-
"internalType": "contract IUniswapV2RouterSwapOnly",
|
|
329
|
-
"name": "_swapRouter",
|
|
330
|
-
"type": "address"
|
|
331
|
-
}
|
|
332
|
-
],
|
|
333
|
-
"name": "setSwapRouter",
|
|
334
|
-
"outputs": [],
|
|
335
|
-
"stateMutability": "nonpayable",
|
|
336
|
-
"type": "function"
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
"inputs": [
|
|
259
|
+
"internalType": "uint256",
|
|
260
|
+
"name": "fundTokenAmount",
|
|
261
|
+
"type": "uint256"
|
|
262
|
+
},
|
|
340
263
|
{
|
|
341
|
-
"internalType": "
|
|
342
|
-
"name": "
|
|
343
|
-
"type": "
|
|
264
|
+
"internalType": "uint256",
|
|
265
|
+
"name": "expectedAmountOut",
|
|
266
|
+
"type": "uint256"
|
|
344
267
|
}
|
|
345
268
|
],
|
|
346
|
-
"name": "
|
|
269
|
+
"name": "withdrawNative",
|
|
347
270
|
"outputs": [],
|
|
348
271
|
"stateMutability": "nonpayable",
|
|
349
272
|
"type": "function"
|
|
350
273
|
},
|
|
351
|
-
{
|
|
352
|
-
"inputs": [],
|
|
353
|
-
"name": "weth",
|
|
354
|
-
"outputs": [
|
|
355
|
-
{
|
|
356
|
-
"internalType": "contract IERC20",
|
|
357
|
-
"name": "",
|
|
358
|
-
"type": "address"
|
|
359
|
-
}
|
|
360
|
-
],
|
|
361
|
-
"stateMutability": "view",
|
|
362
|
-
"type": "function"
|
|
363
|
-
},
|
|
364
274
|
{
|
|
365
275
|
"inputs": [
|
|
366
276
|
{
|
|
@@ -374,70 +284,20 @@
|
|
|
374
284
|
"type": "uint256"
|
|
375
285
|
},
|
|
376
286
|
{
|
|
377
|
-
"internalType": "contract
|
|
378
|
-
"name": "
|
|
287
|
+
"internalType": "contract IERC20Extended",
|
|
288
|
+
"name": "intermediateAsset",
|
|
379
289
|
"type": "address"
|
|
380
290
|
},
|
|
381
291
|
{
|
|
382
292
|
"internalType": "uint256",
|
|
383
|
-
"name": "
|
|
293
|
+
"name": "expectedAmountSUSD",
|
|
384
294
|
"type": "uint256"
|
|
385
295
|
}
|
|
386
296
|
],
|
|
387
|
-
"name": "
|
|
297
|
+
"name": "withdrawSUSD",
|
|
388
298
|
"outputs": [],
|
|
389
299
|
"stateMutability": "nonpayable",
|
|
390
300
|
"type": "function"
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
"inputs": [],
|
|
394
|
-
"name": "withdrawProps",
|
|
395
|
-
"outputs": [
|
|
396
|
-
{
|
|
397
|
-
"internalType": "contract IUniswapV2RouterSwapOnly",
|
|
398
|
-
"name": "swapRouter",
|
|
399
|
-
"type": "address"
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"internalType": "contract IUniswapV2Router",
|
|
403
|
-
"name": "assetType2Router",
|
|
404
|
-
"type": "address"
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
"internalType": "contract IUniswapV2Router",
|
|
408
|
-
"name": "assetType5Router",
|
|
409
|
-
"type": "address"
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
"components": [
|
|
413
|
-
{
|
|
414
|
-
"internalType": "contract ISynthetix",
|
|
415
|
-
"name": "snxProxy",
|
|
416
|
-
"type": "address"
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
"internalType": "contract IERC20",
|
|
420
|
-
"name": "swapSUSDToAsset",
|
|
421
|
-
"type": "address"
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"internalType": "contract ISynthAddressProxy",
|
|
425
|
-
"name": "sUSDProxy",
|
|
426
|
-
"type": "address"
|
|
427
|
-
}
|
|
428
|
-
],
|
|
429
|
-
"internalType": "struct EasySwapperStructs.SynthetixProps",
|
|
430
|
-
"name": "synthetixProps",
|
|
431
|
-
"type": "tuple"
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
"internalType": "contract IERC20",
|
|
435
|
-
"name": "weth",
|
|
436
|
-
"type": "address"
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
"stateMutability": "view",
|
|
440
|
-
"type": "function"
|
|
441
301
|
}
|
|
442
302
|
]
|
|
443
303
|
}
|