@dhedge/v2-sdk 1.2.1 → 1.3.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 +5 -0
- package/dist/entities/pool.d.ts +64 -2
- package/dist/entities/utils.d.ts +6 -0
- package/dist/services/uniswap/V3Liquidity.d.ts +9 -0
- package/dist/services/uniswap/V3Trade.d.ts +4 -0
- package/dist/services/uniswap/types.d.ts +3 -0
- package/dist/test/constants.d.ts +3 -3
- package/dist/test/txOptions.d.ts +1 -0
- package/dist/types.d.ts +16 -5
- package/dist/v2-sdk.cjs.development.js +3838 -1477
- 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 +3839 -1478
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +4 -1
- package/src/abi/IERC20.json +15 -1
- package/src/abi/INonfungiblePositionManager.json +1221 -0
- package/src/abi/ISynthetix.json +139 -0
- package/src/abi/IUniswapV3Quoter.json +195 -0
- package/src/abi/IUniswapV3Router.json +221 -0
- package/src/config.ts +31 -8
- package/src/entities/dhedge.ts +4 -2
- package/src/entities/pool.ts +254 -26
- package/src/entities/utils.ts +12 -0
- package/src/services/uniswap/V3Liquidity.ts +134 -0
- package/src/services/uniswap/V3Trade.ts +47 -0
- package/src/services/uniswap/types.ts +16 -0
- package/src/test/constants.ts +7 -3
- package/src/test/pool.test.ts +1 -1
- package/src/test/synthetix.test.ts +34 -0
- package/src/test/txOptions.ts +15 -0
- package/src/test/uniswap.test.ts +127 -0
- package/src/test/wallet.ts +5 -1
- package/src/types.ts +16 -5
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
{
|
|
2
|
+
"abi": [
|
|
3
|
+
{
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"internalType": "bytes32",
|
|
7
|
+
"name": "sourceCurrencyKey",
|
|
8
|
+
"type": "bytes32"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"internalType": "uint256",
|
|
12
|
+
"name": "sourceAmount",
|
|
13
|
+
"type": "uint256"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"internalType": "bytes32",
|
|
17
|
+
"name": "destinationCurrencyKey",
|
|
18
|
+
"type": "bytes32"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"name": "exchange",
|
|
22
|
+
"outputs": [
|
|
23
|
+
{
|
|
24
|
+
"internalType": "uint256",
|
|
25
|
+
"name": "amountReceived",
|
|
26
|
+
"type": "uint256"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"stateMutability": "nonpayable",
|
|
30
|
+
"type": "function"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"inputs": [
|
|
34
|
+
{
|
|
35
|
+
"internalType": "bytes32",
|
|
36
|
+
"name": "sourceCurrencyKey",
|
|
37
|
+
"type": "bytes32"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"internalType": "uint256",
|
|
41
|
+
"name": "sourceAmount",
|
|
42
|
+
"type": "uint256"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"internalType": "bytes32",
|
|
46
|
+
"name": "destinationCurrencyKey",
|
|
47
|
+
"type": "bytes32"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"internalType": "address",
|
|
51
|
+
"name": "originator",
|
|
52
|
+
"type": "address"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"internalType": "bytes32",
|
|
56
|
+
"name": "trackingCode",
|
|
57
|
+
"type": "bytes32"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"name": "exchangeWithTracking",
|
|
61
|
+
"outputs": [
|
|
62
|
+
{
|
|
63
|
+
"internalType": "uint256",
|
|
64
|
+
"name": "amountReceived",
|
|
65
|
+
"type": "uint256"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"stateMutability": "nonpayable",
|
|
69
|
+
"type": "function"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"inputs": [
|
|
73
|
+
{
|
|
74
|
+
"internalType": "bytes32",
|
|
75
|
+
"name": "currencyKey",
|
|
76
|
+
"type": "bytes32"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"name": "settle",
|
|
80
|
+
"outputs": [
|
|
81
|
+
{
|
|
82
|
+
"internalType": "uint256",
|
|
83
|
+
"name": "reclaimed",
|
|
84
|
+
"type": "uint256"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"internalType": "uint256",
|
|
88
|
+
"name": "refunded",
|
|
89
|
+
"type": "uint256"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"internalType": "uint256",
|
|
93
|
+
"name": "numEntriesSettled",
|
|
94
|
+
"type": "uint256"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"stateMutability": "nonpayable",
|
|
98
|
+
"type": "function"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"inputs": [
|
|
102
|
+
{
|
|
103
|
+
"internalType": "bytes32",
|
|
104
|
+
"name": "key",
|
|
105
|
+
"type": "bytes32"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"name": "synths",
|
|
109
|
+
"outputs": [
|
|
110
|
+
{
|
|
111
|
+
"internalType": "address",
|
|
112
|
+
"name": "synthTokenAddress",
|
|
113
|
+
"type": "address"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"stateMutability": "view",
|
|
117
|
+
"type": "function"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"inputs": [
|
|
121
|
+
{
|
|
122
|
+
"internalType": "address",
|
|
123
|
+
"name": "asset",
|
|
124
|
+
"type": "address"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"name": "synthsByAddress",
|
|
128
|
+
"outputs": [
|
|
129
|
+
{
|
|
130
|
+
"internalType": "bytes32",
|
|
131
|
+
"name": "key",
|
|
132
|
+
"type": "bytes32"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"stateMutability": "view",
|
|
136
|
+
"type": "function"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
{
|
|
2
|
+
"abi": [
|
|
3
|
+
{
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"internalType": "address",
|
|
7
|
+
"name": "_factory",
|
|
8
|
+
"type": "address"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"internalType": "address",
|
|
12
|
+
"name": "_WETH9",
|
|
13
|
+
"type": "address"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"stateMutability": "nonpayable",
|
|
17
|
+
"type": "constructor"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"inputs": [],
|
|
21
|
+
"name": "WETH9",
|
|
22
|
+
"outputs": [
|
|
23
|
+
{
|
|
24
|
+
"internalType": "address",
|
|
25
|
+
"name": "",
|
|
26
|
+
"type": "address"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"stateMutability": "view",
|
|
30
|
+
"type": "function"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"inputs": [],
|
|
34
|
+
"name": "factory",
|
|
35
|
+
"outputs": [
|
|
36
|
+
{
|
|
37
|
+
"internalType": "address",
|
|
38
|
+
"name": "",
|
|
39
|
+
"type": "address"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"stateMutability": "view",
|
|
43
|
+
"type": "function"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"inputs": [
|
|
47
|
+
{
|
|
48
|
+
"internalType": "bytes",
|
|
49
|
+
"name": "path",
|
|
50
|
+
"type": "bytes"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"internalType": "uint256",
|
|
54
|
+
"name": "amountIn",
|
|
55
|
+
"type": "uint256"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"name": "quoteExactInput",
|
|
59
|
+
"outputs": [
|
|
60
|
+
{
|
|
61
|
+
"internalType": "uint256",
|
|
62
|
+
"name": "amountOut",
|
|
63
|
+
"type": "uint256"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"stateMutability": "nonpayable",
|
|
67
|
+
"type": "function"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"inputs": [
|
|
71
|
+
{
|
|
72
|
+
"internalType": "address",
|
|
73
|
+
"name": "tokenIn",
|
|
74
|
+
"type": "address"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"internalType": "address",
|
|
78
|
+
"name": "tokenOut",
|
|
79
|
+
"type": "address"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"internalType": "uint24",
|
|
83
|
+
"name": "fee",
|
|
84
|
+
"type": "uint24"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"internalType": "uint256",
|
|
88
|
+
"name": "amountIn",
|
|
89
|
+
"type": "uint256"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"internalType": "uint160",
|
|
93
|
+
"name": "sqrtPriceLimitX96",
|
|
94
|
+
"type": "uint160"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"name": "quoteExactInputSingle",
|
|
98
|
+
"outputs": [
|
|
99
|
+
{
|
|
100
|
+
"internalType": "uint256",
|
|
101
|
+
"name": "amountOut",
|
|
102
|
+
"type": "uint256"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"stateMutability": "nonpayable",
|
|
106
|
+
"type": "function"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"inputs": [
|
|
110
|
+
{
|
|
111
|
+
"internalType": "bytes",
|
|
112
|
+
"name": "path",
|
|
113
|
+
"type": "bytes"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"internalType": "uint256",
|
|
117
|
+
"name": "amountOut",
|
|
118
|
+
"type": "uint256"
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"name": "quoteExactOutput",
|
|
122
|
+
"outputs": [
|
|
123
|
+
{
|
|
124
|
+
"internalType": "uint256",
|
|
125
|
+
"name": "amountIn",
|
|
126
|
+
"type": "uint256"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"stateMutability": "nonpayable",
|
|
130
|
+
"type": "function"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"inputs": [
|
|
134
|
+
{
|
|
135
|
+
"internalType": "address",
|
|
136
|
+
"name": "tokenIn",
|
|
137
|
+
"type": "address"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"internalType": "address",
|
|
141
|
+
"name": "tokenOut",
|
|
142
|
+
"type": "address"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"internalType": "uint24",
|
|
146
|
+
"name": "fee",
|
|
147
|
+
"type": "uint24"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"internalType": "uint256",
|
|
151
|
+
"name": "amountOut",
|
|
152
|
+
"type": "uint256"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"internalType": "uint160",
|
|
156
|
+
"name": "sqrtPriceLimitX96",
|
|
157
|
+
"type": "uint160"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"name": "quoteExactOutputSingle",
|
|
161
|
+
"outputs": [
|
|
162
|
+
{
|
|
163
|
+
"internalType": "uint256",
|
|
164
|
+
"name": "amountIn",
|
|
165
|
+
"type": "uint256"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"stateMutability": "nonpayable",
|
|
169
|
+
"type": "function"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"inputs": [
|
|
173
|
+
{
|
|
174
|
+
"internalType": "int256",
|
|
175
|
+
"name": "amount0Delta",
|
|
176
|
+
"type": "int256"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"internalType": "int256",
|
|
180
|
+
"name": "amount1Delta",
|
|
181
|
+
"type": "int256"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"internalType": "bytes",
|
|
185
|
+
"name": "path",
|
|
186
|
+
"type": "bytes"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"name": "uniswapV3SwapCallback",
|
|
190
|
+
"outputs": [],
|
|
191
|
+
"stateMutability": "view",
|
|
192
|
+
"type": "function"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
{
|
|
2
|
+
"abi": [
|
|
3
|
+
{
|
|
4
|
+
"inputs": [
|
|
5
|
+
{
|
|
6
|
+
"components": [
|
|
7
|
+
{
|
|
8
|
+
"internalType": "bytes",
|
|
9
|
+
"name": "path",
|
|
10
|
+
"type": "bytes"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"internalType": "address",
|
|
14
|
+
"name": "recipient",
|
|
15
|
+
"type": "address"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"internalType": "uint256",
|
|
19
|
+
"name": "amountIn",
|
|
20
|
+
"type": "uint256"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"internalType": "uint256",
|
|
24
|
+
"name": "amountOutMinimum",
|
|
25
|
+
"type": "uint256"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"internalType": "struct ISwapRouter.ExactInputParams",
|
|
29
|
+
"name": "params",
|
|
30
|
+
"type": "tuple"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"name": "exactInput",
|
|
34
|
+
"outputs": [
|
|
35
|
+
{
|
|
36
|
+
"internalType": "uint256",
|
|
37
|
+
"name": "amountOut",
|
|
38
|
+
"type": "uint256"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"stateMutability": "payable",
|
|
42
|
+
"type": "function"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"inputs": [
|
|
46
|
+
{
|
|
47
|
+
"components": [
|
|
48
|
+
{
|
|
49
|
+
"internalType": "address",
|
|
50
|
+
"name": "tokenIn",
|
|
51
|
+
"type": "address"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"internalType": "address",
|
|
55
|
+
"name": "tokenOut",
|
|
56
|
+
"type": "address"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"internalType": "uint24",
|
|
60
|
+
"name": "fee",
|
|
61
|
+
"type": "uint24"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"internalType": "address",
|
|
65
|
+
"name": "recipient",
|
|
66
|
+
"type": "address"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"internalType": "uint256",
|
|
70
|
+
"name": "amountIn",
|
|
71
|
+
"type": "uint256"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"internalType": "uint256",
|
|
75
|
+
"name": "amountOutMinimum",
|
|
76
|
+
"type": "uint256"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"internalType": "uint160",
|
|
80
|
+
"name": "sqrtPriceLimitX96",
|
|
81
|
+
"type": "uint160"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"internalType": "struct ISwapRouter.ExactInputSingleParams",
|
|
85
|
+
"name": "params",
|
|
86
|
+
"type": "tuple"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"name": "exactInputSingle",
|
|
90
|
+
"outputs": [
|
|
91
|
+
{
|
|
92
|
+
"internalType": "uint256",
|
|
93
|
+
"name": "amountOut",
|
|
94
|
+
"type": "uint256"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"stateMutability": "payable",
|
|
98
|
+
"type": "function"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"inputs": [
|
|
102
|
+
{
|
|
103
|
+
"components": [
|
|
104
|
+
{
|
|
105
|
+
"internalType": "bytes",
|
|
106
|
+
"name": "path",
|
|
107
|
+
"type": "bytes"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"internalType": "address",
|
|
111
|
+
"name": "recipient",
|
|
112
|
+
"type": "address"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"internalType": "uint256",
|
|
116
|
+
"name": "amountOut",
|
|
117
|
+
"type": "uint256"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"internalType": "uint256",
|
|
121
|
+
"name": "amountInMaximum",
|
|
122
|
+
"type": "uint256"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"internalType": "struct ISwapRouter.ExactOutputParams",
|
|
126
|
+
"name": "params",
|
|
127
|
+
"type": "tuple"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"name": "exactOutput",
|
|
131
|
+
"outputs": [
|
|
132
|
+
{
|
|
133
|
+
"internalType": "uint256",
|
|
134
|
+
"name": "amountIn",
|
|
135
|
+
"type": "uint256"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"stateMutability": "payable",
|
|
139
|
+
"type": "function"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"inputs": [
|
|
143
|
+
{
|
|
144
|
+
"components": [
|
|
145
|
+
{
|
|
146
|
+
"internalType": "address",
|
|
147
|
+
"name": "tokenIn",
|
|
148
|
+
"type": "address"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"internalType": "address",
|
|
152
|
+
"name": "tokenOut",
|
|
153
|
+
"type": "address"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"internalType": "uint24",
|
|
157
|
+
"name": "fee",
|
|
158
|
+
"type": "uint24"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"internalType": "address",
|
|
162
|
+
"name": "recipient",
|
|
163
|
+
"type": "address"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"internalType": "uint256",
|
|
167
|
+
"name": "amountOut",
|
|
168
|
+
"type": "uint256"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"internalType": "uint256",
|
|
172
|
+
"name": "amountInMaximum",
|
|
173
|
+
"type": "uint256"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"internalType": "uint160",
|
|
177
|
+
"name": "sqrtPriceLimitX96",
|
|
178
|
+
"type": "uint160"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"internalType": "struct ISwapRouter.ExactOutputSingleParams",
|
|
182
|
+
"name": "params",
|
|
183
|
+
"type": "tuple"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"name": "exactOutputSingle",
|
|
187
|
+
"outputs": [
|
|
188
|
+
{
|
|
189
|
+
"internalType": "uint256",
|
|
190
|
+
"name": "amountIn",
|
|
191
|
+
"type": "uint256"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"stateMutability": "payable",
|
|
195
|
+
"type": "function"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"inputs": [
|
|
199
|
+
{
|
|
200
|
+
"internalType": "int256",
|
|
201
|
+
"name": "amount0Delta",
|
|
202
|
+
"type": "int256"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"internalType": "int256",
|
|
206
|
+
"name": "amount1Delta",
|
|
207
|
+
"type": "int256"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"internalType": "bytes",
|
|
211
|
+
"name": "data",
|
|
212
|
+
"type": "bytes"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"name": "uniswapV3SwapCallback",
|
|
216
|
+
"outputs": [],
|
|
217
|
+
"stateMutability": "nonpayable",
|
|
218
|
+
"type": "function"
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
Network,
|
|
5
5
|
AddressDappNetworkMap
|
|
6
6
|
} from "./types";
|
|
7
|
-
import { ChainId } from "@sushiswap/sdk";
|
|
8
7
|
import { NetworkChainIdMap } from ".";
|
|
9
8
|
|
|
10
9
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -13,7 +12,8 @@ require("dotenv").config();
|
|
|
13
12
|
export const factoryAddress: AddressNetworkMap = {
|
|
14
13
|
[Network.POLYGON]: process.env.STAGING_CONTRACTS
|
|
15
14
|
? "0xDd87eCdB10cFF7004276AAbAbd30e7a08F69bb53"
|
|
16
|
-
: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0"
|
|
15
|
+
: "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0",
|
|
16
|
+
[Network.OPTIMISM]: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6"
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export const routerAddress: AddressDappNetworkMap = {
|
|
@@ -22,7 +22,12 @@ export const routerAddress: AddressDappNetworkMap = {
|
|
|
22
22
|
[Dapp.AAVE]: "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf",
|
|
23
23
|
[Dapp.ONEINCH]: "0x1111111254fb6c44bac0bed2854e76f90643097d",
|
|
24
24
|
[Dapp.QUICKSWAP]: "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
|
|
25
|
-
[Dapp.BALANCER]: "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
|
|
25
|
+
[Dapp.BALANCER]: "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
|
|
26
|
+
[Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"
|
|
27
|
+
},
|
|
28
|
+
[Network.OPTIMISM]: {
|
|
29
|
+
[Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
|
|
30
|
+
[Dapp.SYNTHETIX]: "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4"
|
|
26
31
|
}
|
|
27
32
|
};
|
|
28
33
|
|
|
@@ -30,7 +35,8 @@ export const dappFactoryAddress: AddressDappNetworkMap = {
|
|
|
30
35
|
[Network.POLYGON]: {
|
|
31
36
|
[Dapp.SUSHISWAP]: "0xc35DADB65012eC5796536bD9864eD8773aBc74C4",
|
|
32
37
|
[Dapp.QUICKSWAP]: "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32"
|
|
33
|
-
}
|
|
38
|
+
},
|
|
39
|
+
[Network.OPTIMISM]: {}
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
export const stakingAddress: AddressDappNetworkMap = {
|
|
@@ -38,18 +44,35 @@ export const stakingAddress: AddressDappNetworkMap = {
|
|
|
38
44
|
[Dapp.SUSHISWAP]: "0x0769fd68dFb93167989C6f7254cd0D766Fb2841F",
|
|
39
45
|
[Dapp.BALANCER]: "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e",
|
|
40
46
|
[Dapp.AAVE]: "0x357D51124f59836DeD84c8a1730D72B749d8BC23"
|
|
41
|
-
}
|
|
47
|
+
},
|
|
48
|
+
[Network.OPTIMISM]: {}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const nonfungiblePositionManagerAddress: AddressNetworkMap = {
|
|
52
|
+
[Network.POLYGON]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
|
|
53
|
+
[Network.OPTIMISM]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
|
|
42
54
|
};
|
|
43
55
|
|
|
44
56
|
export const networkChainIdMap: NetworkChainIdMap = {
|
|
45
|
-
[Network.POLYGON]:
|
|
57
|
+
[Network.POLYGON]: 137,
|
|
58
|
+
[Network.OPTIMISM]: 10
|
|
46
59
|
};
|
|
47
60
|
|
|
48
61
|
export const balancerSubgraph: AddressNetworkMap = {
|
|
49
62
|
[Network.POLYGON]:
|
|
50
|
-
"https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2"
|
|
63
|
+
"https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2",
|
|
64
|
+
[Network.OPTIMISM]: ""
|
|
51
65
|
};
|
|
52
66
|
|
|
53
67
|
export const multiCallAddress: AddressNetworkMap = {
|
|
54
|
-
[Network.POLYGON]: "0x275617327c958bD06b5D6b871E7f491D76113dd8"
|
|
68
|
+
[Network.POLYGON]: "0x275617327c958bD06b5D6b871E7f491D76113dd8",
|
|
69
|
+
[Network.OPTIMISM]: ""
|
|
55
70
|
};
|
|
71
|
+
|
|
72
|
+
export const deadline = Math.floor(Date.now() / 1000) + 60 * 20;
|
|
73
|
+
export const MaxUint128 = "0xffffffffffffffffffffffffffffffff";
|
|
74
|
+
export const UNISWAPV3_QUOTER_ADDRESS =
|
|
75
|
+
"0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
|
|
76
|
+
|
|
77
|
+
export const SYNTHETIX_TRACKING_CODE =
|
|
78
|
+
"0x4448454447450000000000000000000000000000000000000000000000000000";
|
package/src/entities/dhedge.ts
CHANGED
|
@@ -77,7 +77,8 @@ export class Dhedge {
|
|
|
77
77
|
this.signer,
|
|
78
78
|
poolLogic,
|
|
79
79
|
managerLogic,
|
|
80
|
-
this.utils
|
|
80
|
+
this.utils,
|
|
81
|
+
this.factory
|
|
81
82
|
);
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -101,7 +102,8 @@ export class Dhedge {
|
|
|
101
102
|
this.signer,
|
|
102
103
|
poolLogic,
|
|
103
104
|
managerLogic,
|
|
104
|
-
this.utils
|
|
105
|
+
this.utils,
|
|
106
|
+
this.factory
|
|
105
107
|
);
|
|
106
108
|
}
|
|
107
109
|
|