@dhedge/v2-sdk 1.10.12 → 1.10.13

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/src/config.ts CHANGED
@@ -17,7 +17,8 @@ export const factoryAddress: AddressNetworkMap = {
17
17
  : "0xfdc7b8bFe0DD3513Cc669bB8d601Cb83e2F69cB0",
18
18
  [Network.OPTIMISM]: "0x5e61a079A178f0E5784107a4963baAe0c5a680c6",
19
19
  [Network.ARBITRUM]: "0xfffb5fb14606eb3a548c113026355020ddf27535",
20
- [Network.BASE]: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F"
20
+ [Network.BASE]: "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F",
21
+ [Network.SONIC]: ""
21
22
  };
22
23
 
23
24
  export const routerAddress: AddressDappNetworkMap = {
@@ -60,6 +61,10 @@ export const routerAddress: AddressDappNetworkMap = {
60
61
  [Dapp.AAVEV3]: "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5",
61
62
  [Dapp.TOROS]: "0xf067575Eb60c7587C11e867907AA7284833704d1",
62
63
  [Dapp.ODOS]: "0x19cEeAd7105607Cd444F5ad10dd51356436095a1"
64
+ },
65
+ [Network.SONIC]: {
66
+ [Dapp.AAVEV3]: "0x5362dBb1e601abF3a4c14c22ffEdA64042E5eAA3",
67
+ [Dapp.ODOS]: "0xaC041Df48dF9791B0654f1Dbbf2CC8450C5f2e9D"
63
68
  }
64
69
  };
65
70
 
@@ -70,7 +75,8 @@ export const dappFactoryAddress: AddressDappNetworkMap = {
70
75
  },
71
76
  [Network.OPTIMISM]: {},
72
77
  [Network.ARBITRUM]: {},
73
- [Network.BASE]: {}
78
+ [Network.BASE]: {},
79
+ [Network.SONIC]: {}
74
80
  };
75
81
 
76
82
  export const stakingAddress: AddressDappNetworkMap = {
@@ -90,7 +96,8 @@ export const stakingAddress: AddressDappNetworkMap = {
90
96
  },
91
97
  [Network.BASE]: {
92
98
  [Dapp.PANCAKECL]: "0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3"
93
- }
99
+ },
100
+ [Network.SONIC]: {}
94
101
  };
95
102
 
96
103
  export const aaveAddressProvider: AddressDappNetworkMap = {
@@ -107,6 +114,9 @@ export const aaveAddressProvider: AddressDappNetworkMap = {
107
114
  [Network.BASE]: {
108
115
  // https://docs.aave.com/developers/deployed-contracts/v3-mainnet/base
109
116
  [Dapp.AAVEV3]: "0xe20fCBdBfFC4Dd138cE8b2E6FBb6CB49777ad64D"
117
+ },
118
+ [Network.SONIC]: {
119
+ [Dapp.AAVEV3]: "0x5C2e738F6E27bCE0F7558051Bf90605dD6176900"
110
120
  }
111
121
  };
112
122
  export const nonfungiblePositionManagerAddress: AddressDappNetworkMap = {
@@ -126,6 +136,9 @@ export const nonfungiblePositionManagerAddress: AddressDappNetworkMap = {
126
136
  [Dapp.UNISWAPV3]: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",
127
137
  [Dapp.AERODROMECL]: "0x827922686190790b37229fd06084350e74485b72",
128
138
  [Dapp.PANCAKECL]: "0x46A15B0b27311cedF172AB29E4f4766fbE7F4364"
139
+ },
140
+ [Network.SONIC]: {
141
+ [Dapp.SHADOWCL]: "0x12e66c8f215ddd5d48d150c8f46ad0c6fb0f4406"
129
142
  }
130
143
  };
131
144
 
@@ -133,7 +146,8 @@ export const networkChainIdMap: NetworkChainIdMap = {
133
146
  [Network.POLYGON]: 137,
134
147
  [Network.OPTIMISM]: 10,
135
148
  [Network.ARBITRUM]: 42161,
136
- [Network.BASE]: 8453
149
+ [Network.BASE]: 8453,
150
+ [Network.SONIC]: 146
137
151
  };
138
152
 
139
153
  export const balancerSubgraph: AddressNetworkMap = {
@@ -141,14 +155,16 @@ export const balancerSubgraph: AddressNetworkMap = {
141
155
  "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2",
142
156
  [Network.OPTIMISM]: "",
143
157
  [Network.ARBITRUM]: "",
144
- [Network.BASE]: ""
158
+ [Network.BASE]: "",
159
+ [Network.SONIC]: ""
145
160
  };
146
161
 
147
162
  export const multiCallAddress: AddressNetworkMap = {
148
163
  [Network.POLYGON]: "0x275617327c958bD06b5D6b871E7f491D76113dd8",
149
164
  [Network.OPTIMISM]: "",
150
165
  [Network.ARBITRUM]: "",
151
- [Network.BASE]: ""
166
+ [Network.BASE]: "",
167
+ [Network.SONIC]: ""
152
168
  };
153
169
 
154
170
  export const lyraNetworkMap: LyraNetworkMap = {
@@ -1110,7 +1110,8 @@ export class Pool {
1110
1110
  | Dapp.VELODROMECL
1111
1111
  | Dapp.AERODROMECL
1112
1112
  | Dapp.RAMSESCL
1113
- | Dapp.PANCAKECL,
1113
+ | Dapp.PANCAKECL
1114
+ | Dapp.SHADOWCL,
1114
1115
  assetA: string,
1115
1116
  assetB: string,
1116
1117
  amountA: BigNumber | string,
@@ -1179,6 +1180,7 @@ export class Pool {
1179
1180
  switch (dapp) {
1180
1181
  case Dapp.UNISWAPV3:
1181
1182
  case Dapp.RAMSESCL:
1183
+ case Dapp.SHADOWCL:
1182
1184
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1183
1185
  break;
1184
1186
  case Dapp.VELODROMECL:
@@ -1244,6 +1246,7 @@ export class Pool {
1244
1246
  switch (dapp) {
1245
1247
  case Dapp.UNISWAPV3:
1246
1248
  case Dapp.RAMSESCL:
1249
+ case Dapp.SHADOWCL:
1247
1250
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1248
1251
  break;
1249
1252
  case Dapp.VELODROMECL:
@@ -1308,6 +1311,7 @@ export class Pool {
1308
1311
  switch (dapp) {
1309
1312
  case Dapp.UNISWAPV3:
1310
1313
  case Dapp.RAMSESCL:
1314
+ case Dapp.SHADOWCL:
1311
1315
  contractAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1312
1316
  txData = iNonfungiblePositionManager.encodeFunctionData(
1313
1317
  Transaction.COLLECT,
@@ -19,6 +19,7 @@ import {
19
19
  } from "../../config";
20
20
  import INonfungiblePositionManager from "../../abi/INonfungiblePositionManager.json";
21
21
  import IVeldodromePositionManager from "../../abi/IVelodromeNonfungiblePositionManager.json";
22
+ import IShadowNonfungiblePositionManager from "../../abi/IShadowNonfungiblePositionManager.json";
22
23
  import IRamsesPositionManager from "../../abi/IRamsesNonfungiblePositionManager.json";
23
24
  import IArrakisV1RouterStaking from "../../abi/IArrakisV1RouterStaking.json";
24
25
  import IPancakeMasterChef from "../../abi/IPancakeMasterChefV3.json";
@@ -77,7 +78,8 @@ export async function getUniswapV3MintTxData(
77
78
  | Dapp.VELODROMECL
78
79
  | Dapp.AERODROMECL
79
80
  | Dapp.RAMSESCL
80
- | Dapp.PANCAKECL,
81
+ | Dapp.PANCAKECL
82
+ | Dapp.SHADOWCL,
81
83
  pool: Pool,
82
84
  assetA: string,
83
85
  assetB: string,
@@ -168,6 +170,12 @@ export async function getUniswapV3MintTxData(
168
170
  mintParams.push(0);
169
171
  }
170
172
 
173
+ if (dapp === Dapp.SHADOWCL) {
174
+ iNonfungiblePositionManager = new ethers.utils.Interface(
175
+ IShadowNonfungiblePositionManager
176
+ );
177
+ }
178
+
171
179
  return iNonfungiblePositionManager.encodeFunctionData(Transaction.MINT, [
172
180
  mintParams
173
181
  ]);
@@ -188,7 +196,9 @@ export async function getUniswapV3Liquidity(
188
196
  const iNonfungiblePositionManager = new ethers.Contract(
189
197
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
190
198
  nonfungiblePositionManagerAddress[pool.network][dapp]!,
191
- INonfungiblePositionManager.abi,
199
+ dapp === Dapp.SHADOWCL
200
+ ? IShadowNonfungiblePositionManager
201
+ : INonfungiblePositionManager.abi,
192
202
  pool.signer
193
203
  );
194
204
  const result = await iNonfungiblePositionManager.positions(tokenId);
@@ -208,7 +218,8 @@ export async function getIncreaseLiquidityTxData(
208
218
  dapp === Dapp.VELODROMECL ||
209
219
  dapp === Dapp.AERODROMECL ||
210
220
  dapp === Dapp.RAMSESCL ||
211
- dapp === Dapp.PANCAKECL
221
+ dapp === Dapp.PANCAKECL ||
222
+ dapp === Dapp.SHADOWCL
212
223
  ) {
213
224
  const abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
214
225
  txData = abi.encodeFunctionData(Transaction.INCREASE_LIQUIDITY, [
@@ -245,7 +256,8 @@ export async function getDecreaseLiquidityTxData(
245
256
  dapp === Dapp.VELODROMECL ||
246
257
  dapp === Dapp.AERODROMECL ||
247
258
  dapp === Dapp.RAMSESCL ||
248
- dapp === Dapp.PANCAKECL
259
+ dapp === Dapp.PANCAKECL ||
260
+ dapp === Dapp.SHADOWCL
249
261
  ) {
250
262
  const abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
251
263
  const liquidity = (await getUniswapV3Liquidity(dapp, tokenId, pool))
@@ -133,6 +133,25 @@ export const CONTRACT_ADDRESS = {
133
133
  VELO: "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
134
134
  COMPOUNDV3_WETH: "",
135
135
  TOROS: ""
136
+ },
137
+ [Network.SONIC]: {
138
+ USDC: "0x29219dd400f2bf60e5a23d13be72b486d4038894",
139
+ USDT: "",
140
+ SUSD: "",
141
+ WETH: "0x50c42deacd8fc9773493ed674b675be577f2634b",
142
+ WBTC: "",
143
+ SWETH: "",
144
+ uniswapV3: {
145
+ nonfungiblePositionManager: ""
146
+ },
147
+ //
148
+ ARRAKIS_USDC_WETH_GAUGE: "",
149
+ ARRAKIS_USDC_WETH_LP: "",
150
+ WMATIC: "",
151
+ VELODROME_CL_USDC_WETH_GAUGE: "",
152
+ VELO: "",
153
+ COMPOUNDV3_WETH: "",
154
+ TOROS: ""
136
155
  }
137
156
  };
138
157
 
@@ -142,12 +161,14 @@ export const USDC_BALANCEOF_SLOT = {
142
161
  [Network.OPTIMISM]: 9,
143
162
  [Network.ARBITRUM]: 9,
144
163
  [Network.POLYGON]: 0,
145
- [Network.BASE]: 9
164
+ [Network.BASE]: 9,
165
+ [Network.SONIC]: 9
146
166
  };
147
167
 
148
168
  export const WETH_BALANCEOF_SLOT = {
149
169
  [Network.OPTIMISM]: 3,
150
170
  [Network.ARBITRUM]: 51,
151
171
  [Network.POLYGON]: 0,
152
- [Network.BASE]: 0
172
+ [Network.BASE]: 0,
173
+ [Network.SONIC]: 0
153
174
  };
@@ -7,7 +7,8 @@ export const networkPortMap = {
7
7
  [Network.POLYGON]: 8542,
8
8
  [Network.OPTIMISM]: 8544,
9
9
  [Network.ARBITRUM]: 8540,
10
- [Network.BASE]: 8546
10
+ [Network.BASE]: 8546,
11
+ [Network.SONIC]: 8547
11
12
  };
12
13
 
13
14
  export const getWalletData = (
package/src/types.ts CHANGED
@@ -5,7 +5,8 @@ export enum Network {
5
5
  POLYGON = "polygon",
6
6
  OPTIMISM = "optimism",
7
7
  ARBITRUM = "arbitrum",
8
- BASE = "base"
8
+ BASE = "base",
9
+ SONIC = "sonic"
9
10
  }
10
11
 
11
12
  export enum Dapp {
@@ -29,7 +30,8 @@ export enum Dapp {
29
30
  RAMSESCL = "ramsesCL",
30
31
  PANCAKECL = "pancakeCL",
31
32
  COMPOUNDV3 = "compoundV3",
32
- ODOS = "odos"
33
+ ODOS = "odos",
34
+ SHADOWCL = "shadowCL"
33
35
  }
34
36
 
35
37
  export enum Transaction {