@dhedge/v2-sdk 1.3.0 → 1.4.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/v2-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.2",
4
4
  "license": "MIT",
5
5
  "description": "🛠 An SDK for building applications on top of dHEDGE V2",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,107 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "inputs": [
5
+ {
6
+ "internalType": "address",
7
+ "name": "gauge",
8
+ "type": "address"
9
+ },
10
+ {
11
+ "internalType": "uint256",
12
+ "name": "amount0Max",
13
+ "type": "uint256"
14
+ },
15
+ {
16
+ "internalType": "uint256",
17
+ "name": "amount1Max",
18
+ "type": "uint256"
19
+ },
20
+ {
21
+ "internalType": "uint256",
22
+ "name": "amount0Min",
23
+ "type": "uint256"
24
+ },
25
+ {
26
+ "internalType": "uint256",
27
+ "name": "amount1Min",
28
+ "type": "uint256"
29
+ },
30
+ {
31
+ "internalType": "address",
32
+ "name": "receiver",
33
+ "type": "address"
34
+ }
35
+ ],
36
+ "name": "addLiquidityAndStake",
37
+ "outputs": [
38
+ {
39
+ "internalType": "uint256",
40
+ "name": "amount0",
41
+ "type": "uint256"
42
+ },
43
+ {
44
+ "internalType": "uint256",
45
+ "name": "amount1",
46
+ "type": "uint256"
47
+ },
48
+ {
49
+ "internalType": "uint256",
50
+ "name": "mintAmount",
51
+ "type": "uint256"
52
+ }
53
+ ],
54
+ "stateMutability": "nonpayable",
55
+ "type": "function"
56
+ },
57
+ {
58
+ "inputs": [
59
+ {
60
+ "internalType": "address",
61
+ "name": "gauge",
62
+ "type": "address"
63
+ },
64
+ {
65
+ "internalType": "uint256",
66
+ "name": "burnAmount",
67
+ "type": "uint256"
68
+ },
69
+ {
70
+ "internalType": "uint256",
71
+ "name": "amount0Min",
72
+ "type": "uint256"
73
+ },
74
+ {
75
+ "internalType": "uint256",
76
+ "name": "amount1Min",
77
+ "type": "uint256"
78
+ },
79
+ {
80
+ "internalType": "address",
81
+ "name": "receiver",
82
+ "type": "address"
83
+ }
84
+ ],
85
+ "name": "removeLiquidityAndUnstake",
86
+ "outputs": [
87
+ {
88
+ "internalType": "uint256",
89
+ "name": "amount0",
90
+ "type": "uint256"
91
+ },
92
+ {
93
+ "internalType": "uint256",
94
+ "name": "amount1",
95
+ "type": "uint256"
96
+ },
97
+ {
98
+ "internalType": "uint128",
99
+ "name": "liquidityBurned",
100
+ "type": "uint128"
101
+ }
102
+ ],
103
+ "stateMutability": "nonpayable",
104
+ "type": "function"
105
+ }
106
+ ]
107
+ }
@@ -0,0 +1,239 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "inputs": [
5
+ {
6
+ "internalType": "address",
7
+ "name": "user",
8
+ "type": "address"
9
+ }
10
+ ],
11
+ "name": "balanceOf",
12
+ "outputs": [
13
+ {
14
+ "internalType": "uint256",
15
+ "name": "",
16
+ "type": "uint256"
17
+ }
18
+ ],
19
+ "stateMutability": "view",
20
+ "type": "function"
21
+ },
22
+ {
23
+ "inputs": [
24
+ {
25
+ "internalType": "address",
26
+ "name": "user",
27
+ "type": "address"
28
+ }
29
+ ],
30
+ "name": "claim_rewards",
31
+ "outputs": [],
32
+ "stateMutability": "nonpayable",
33
+ "type": "function"
34
+ },
35
+ {
36
+ "inputs": [
37
+ {
38
+ "internalType": "address",
39
+ "name": "user",
40
+ "type": "address"
41
+ },
42
+ {
43
+ "internalType": "address",
44
+ "name": "receiver",
45
+ "type": "address"
46
+ }
47
+ ],
48
+ "name": "claim_rewards",
49
+ "outputs": [],
50
+ "stateMutability": "nonpayable",
51
+ "type": "function"
52
+ },
53
+ {
54
+ "inputs": [],
55
+ "name": "claim_rewards",
56
+ "outputs": [],
57
+ "stateMutability": "nonpayable",
58
+ "type": "function"
59
+ },
60
+ {
61
+ "inputs": [
62
+ {
63
+ "internalType": "address",
64
+ "name": "user",
65
+ "type": "address"
66
+ },
67
+ {
68
+ "internalType": "address",
69
+ "name": "rewardToken",
70
+ "type": "address"
71
+ }
72
+ ],
73
+ "name": "claimable_reward",
74
+ "outputs": [
75
+ {
76
+ "internalType": "uint256",
77
+ "name": "",
78
+ "type": "uint256"
79
+ }
80
+ ],
81
+ "stateMutability": "view",
82
+ "type": "function"
83
+ },
84
+ {
85
+ "inputs": [
86
+ {
87
+ "internalType": "address",
88
+ "name": "user",
89
+ "type": "address"
90
+ },
91
+ {
92
+ "internalType": "address",
93
+ "name": "rewardToken",
94
+ "type": "address"
95
+ }
96
+ ],
97
+ "name": "claimable_reward_write",
98
+ "outputs": [
99
+ {
100
+ "internalType": "uint256",
101
+ "name": "",
102
+ "type": "uint256"
103
+ }
104
+ ],
105
+ "stateMutability": "nonpayable",
106
+ "type": "function"
107
+ },
108
+ {
109
+ "inputs": [
110
+ {
111
+ "internalType": "uint256",
112
+ "name": "amount",
113
+ "type": "uint256"
114
+ },
115
+ {
116
+ "internalType": "address",
117
+ "name": "user",
118
+ "type": "address"
119
+ }
120
+ ],
121
+ "name": "deposit",
122
+ "outputs": [],
123
+ "stateMutability": "nonpayable",
124
+ "type": "function"
125
+ },
126
+ {
127
+ "inputs": [
128
+ {
129
+ "internalType": "uint256",
130
+ "name": "amount",
131
+ "type": "uint256"
132
+ },
133
+ {
134
+ "internalType": "address",
135
+ "name": "onBehalf",
136
+ "type": "address"
137
+ },
138
+ {
139
+ "internalType": "bool",
140
+ "name": "isClaimRewards",
141
+ "type": "bool"
142
+ }
143
+ ],
144
+ "name": "deposit",
145
+ "outputs": [],
146
+ "stateMutability": "nonpayable",
147
+ "type": "function"
148
+ },
149
+ {
150
+ "inputs": [
151
+ {
152
+ "internalType": "uint256",
153
+ "name": "amount",
154
+ "type": "uint256"
155
+ }
156
+ ],
157
+ "name": "deposit",
158
+ "outputs": [],
159
+ "stateMutability": "nonpayable",
160
+ "type": "function"
161
+ },
162
+ {
163
+ "inputs": [],
164
+ "name": "lp_token",
165
+ "outputs": [
166
+ {
167
+ "internalType": "address",
168
+ "name": "",
169
+ "type": "address"
170
+ }
171
+ ],
172
+ "stateMutability": "view",
173
+ "type": "function"
174
+ },
175
+ {
176
+ "inputs": [],
177
+ "name": "reward_contract",
178
+ "outputs": [
179
+ {
180
+ "internalType": "address",
181
+ "name": "",
182
+ "type": "address"
183
+ }
184
+ ],
185
+ "stateMutability": "view",
186
+ "type": "function"
187
+ },
188
+ {
189
+ "inputs": [
190
+ {
191
+ "internalType": "uint256",
192
+ "name": "index",
193
+ "type": "uint256"
194
+ }
195
+ ],
196
+ "name": "reward_tokens",
197
+ "outputs": [
198
+ {
199
+ "internalType": "address",
200
+ "name": "",
201
+ "type": "address"
202
+ }
203
+ ],
204
+ "stateMutability": "view",
205
+ "type": "function"
206
+ },
207
+ {
208
+ "inputs": [
209
+ {
210
+ "internalType": "uint256",
211
+ "name": "amount",
212
+ "type": "uint256"
213
+ }
214
+ ],
215
+ "name": "withdraw",
216
+ "outputs": [],
217
+ "stateMutability": "nonpayable",
218
+ "type": "function"
219
+ },
220
+ {
221
+ "inputs": [
222
+ {
223
+ "internalType": "uint256",
224
+ "name": "amount",
225
+ "type": "uint256"
226
+ },
227
+ {
228
+ "internalType": "bool",
229
+ "name": "isClaimRewards",
230
+ "type": "bool"
231
+ }
232
+ ],
233
+ "name": "withdraw",
234
+ "outputs": [],
235
+ "stateMutability": "nonpayable",
236
+ "type": "function"
237
+ }
238
+ ]
239
+ }
@@ -0,0 +1,153 @@
1
+ { "abi": [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "user",
7
+ "type": "address"
8
+ }
9
+ ],
10
+ "name": "claim_rewards",
11
+ "outputs": [],
12
+ "stateMutability": "nonpayable",
13
+ "type": "function"
14
+ },
15
+ {
16
+ "inputs": [
17
+ {
18
+ "internalType": "address",
19
+ "name": "user",
20
+ "type": "address"
21
+ },
22
+ {
23
+ "internalType": "address",
24
+ "name": "receiver",
25
+ "type": "address"
26
+ }
27
+ ],
28
+ "name": "claim_rewards",
29
+ "outputs": [],
30
+ "stateMutability": "nonpayable",
31
+ "type": "function"
32
+ },
33
+ {
34
+ "inputs": [],
35
+ "name": "claim_rewards",
36
+ "outputs": [],
37
+ "stateMutability": "nonpayable",
38
+ "type": "function"
39
+ },
40
+ {
41
+ "inputs": [
42
+ {
43
+ "internalType": "address",
44
+ "name": "user",
45
+ "type": "address"
46
+ },
47
+ {
48
+ "internalType": "address",
49
+ "name": "rewardToken",
50
+ "type": "address"
51
+ }
52
+ ],
53
+ "name": "claimable_reward",
54
+ "outputs": [
55
+ {
56
+ "internalType": "uint256",
57
+ "name": "",
58
+ "type": "uint256"
59
+ }
60
+ ],
61
+ "stateMutability": "view",
62
+ "type": "function"
63
+ },
64
+ {
65
+ "inputs": [],
66
+ "name": "reward_count",
67
+ "outputs": [
68
+ {
69
+ "internalType": "uint256",
70
+ "name": "",
71
+ "type": "uint256"
72
+ }
73
+ ],
74
+ "stateMutability": "view",
75
+ "type": "function"
76
+ },
77
+ {
78
+ "inputs": [
79
+ {
80
+ "internalType": "address",
81
+ "name": "token",
82
+ "type": "address"
83
+ }
84
+ ],
85
+ "name": "reward_data",
86
+ "outputs": [
87
+ {
88
+ "internalType": "address",
89
+ "name": "",
90
+ "type": "address"
91
+ },
92
+ {
93
+ "internalType": "address",
94
+ "name": "",
95
+ "type": "address"
96
+ },
97
+ {
98
+ "internalType": "uint256",
99
+ "name": "",
100
+ "type": "uint256"
101
+ },
102
+ {
103
+ "internalType": "uint256",
104
+ "name": "",
105
+ "type": "uint256"
106
+ },
107
+ {
108
+ "internalType": "uint256",
109
+ "name": "",
110
+ "type": "uint256"
111
+ },
112
+ {
113
+ "internalType": "uint256",
114
+ "name": "",
115
+ "type": "uint256"
116
+ }
117
+ ],
118
+ "stateMutability": "view",
119
+ "type": "function"
120
+ },
121
+ {
122
+ "inputs": [
123
+ {
124
+ "internalType": "uint256",
125
+ "name": "index",
126
+ "type": "uint256"
127
+ }
128
+ ],
129
+ "name": "reward_tokens",
130
+ "outputs": [
131
+ {
132
+ "internalType": "address",
133
+ "name": "",
134
+ "type": "address"
135
+ }
136
+ ],
137
+ "stateMutability": "view",
138
+ "type": "function"
139
+ },
140
+ {
141
+ "inputs": [],
142
+ "name": "staking_token",
143
+ "outputs": [
144
+ {
145
+ "internalType": "address",
146
+ "name": "",
147
+ "type": "address"
148
+ }
149
+ ],
150
+ "stateMutability": "view",
151
+ "type": "function"
152
+ }
153
+ ]}
package/src/config.ts CHANGED
@@ -20,14 +20,18 @@ export const routerAddress: AddressDappNetworkMap = {
20
20
  [Network.POLYGON]: {
21
21
  [Dapp.SUSHISWAP]: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
22
22
  [Dapp.AAVE]: "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf",
23
+ [Dapp.AAVEV3]: "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
23
24
  [Dapp.ONEINCH]: "0x1111111254fb6c44bac0bed2854e76f90643097d",
24
25
  [Dapp.QUICKSWAP]: "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
25
26
  [Dapp.BALANCER]: "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
26
- [Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"
27
+ [Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
28
+ [Dapp.ARRAKIS]: "0xbc91a120cCD8F80b819EAF32F0996daC3Fa76a6C"
27
29
  },
28
30
  [Network.OPTIMISM]: {
29
31
  [Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
30
- [Dapp.SYNTHETIX]: "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4"
32
+ [Dapp.SYNTHETIX]: "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4",
33
+ [Dapp.AAVEV3]: "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
34
+ [Dapp.ONEINCH]: "0x1111111254760F7ab3F16433eea9304126DCd199"
31
35
  }
32
36
  };
33
37
 
@@ -88,7 +88,6 @@ export class Dhedge {
88
88
  * @returns {Pool} Loaded Pool
89
89
  */
90
90
  public async loadPool(address: string): Promise<Pool> {
91
- this.validatePool(address);
92
91
  const poolLogic = new Contract(address, PoolLogic.abi, this.signer);
93
92
  const managerLogicAddress = await poolLogic.poolManagerLogic();
94
93
  const managerLogic = new Contract(
@@ -106,14 +105,4 @@ export class Dhedge {
106
105
  this.factory
107
106
  );
108
107
  }
109
-
110
- /**
111
- * Check if pool address is valid
112
- * @param {string} address Pool address
113
- * @returns {boolean} Is valid pool address
114
- */
115
- private async validatePool(address: string): Promise<void> {
116
- const isPool = await this.factory.isPool(address);
117
- if (!isPool) throw new Error("Given address not a pool");
118
- }
119
108
  }