@dhedge/v2-sdk 1.10.1 → 1.10.3

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.10.1",
3
+ "version": "1.10.3",
4
4
  "license": "MIT",
5
5
  "description": "🛠 An SDK for building applications on top of dHEDGE V2",
6
6
  "main": "dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "@size-limit/preset-small-lib": "^5.0.1",
35
35
  "@types/jest": "^28.1.7",
36
36
  "@types/lodash": "^4.14.178",
37
- "hardhat": "^2.12.6",
37
+ "hardhat": "2.19.3",
38
38
  "husky": "^7.0.1",
39
39
  "jest": "^28.1.3",
40
40
  "size-limit": "^5.0.1",
@@ -0,0 +1,286 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "anonymous": false,
5
+ "inputs": [
6
+ {
7
+ "indexed": false,
8
+ "internalType": "address",
9
+ "name": "asset",
10
+ "type": "address"
11
+ },
12
+ {
13
+ "indexed": false,
14
+ "internalType": "uint16",
15
+ "name": "assetType",
16
+ "type": "uint16"
17
+ },
18
+ {
19
+ "indexed": false,
20
+ "internalType": "address",
21
+ "name": "aggregator",
22
+ "type": "address"
23
+ }
24
+ ],
25
+ "name": "AddedAsset",
26
+ "type": "event"
27
+ },
28
+ {
29
+ "anonymous": false,
30
+ "inputs": [
31
+ {
32
+ "indexed": true,
33
+ "internalType": "address",
34
+ "name": "previousOwner",
35
+ "type": "address"
36
+ },
37
+ {
38
+ "indexed": true,
39
+ "internalType": "address",
40
+ "name": "newOwner",
41
+ "type": "address"
42
+ }
43
+ ],
44
+ "name": "OwnershipTransferred",
45
+ "type": "event"
46
+ },
47
+ {
48
+ "anonymous": false,
49
+ "inputs": [
50
+ {
51
+ "indexed": false,
52
+ "internalType": "address",
53
+ "name": "asset",
54
+ "type": "address"
55
+ }
56
+ ],
57
+ "name": "RemovedAsset",
58
+ "type": "event"
59
+ },
60
+ {
61
+ "anonymous": false,
62
+ "inputs": [
63
+ {
64
+ "indexed": false,
65
+ "internalType": "uint256",
66
+ "name": "_chainlinkTimeout",
67
+ "type": "uint256"
68
+ }
69
+ ],
70
+ "name": "SetChainlinkTimeout",
71
+ "type": "event"
72
+ },
73
+ {
74
+ "inputs": [
75
+ {
76
+ "internalType": "address",
77
+ "name": "asset",
78
+ "type": "address"
79
+ },
80
+ {
81
+ "internalType": "uint16",
82
+ "name": "assetType",
83
+ "type": "uint16"
84
+ },
85
+ {
86
+ "internalType": "address",
87
+ "name": "aggregator",
88
+ "type": "address"
89
+ }
90
+ ],
91
+ "name": "addAsset",
92
+ "outputs": [],
93
+ "stateMutability": "nonpayable",
94
+ "type": "function"
95
+ },
96
+ {
97
+ "inputs": [
98
+ {
99
+ "components": [
100
+ {
101
+ "internalType": "address",
102
+ "name": "asset",
103
+ "type": "address"
104
+ },
105
+ {
106
+ "internalType": "uint16",
107
+ "name": "assetType",
108
+ "type": "uint16"
109
+ },
110
+ {
111
+ "internalType": "address",
112
+ "name": "aggregator",
113
+ "type": "address"
114
+ }
115
+ ],
116
+ "internalType": "struct IAssetHandler.Asset[]",
117
+ "name": "assets",
118
+ "type": "tuple[]"
119
+ }
120
+ ],
121
+ "name": "addAssets",
122
+ "outputs": [],
123
+ "stateMutability": "nonpayable",
124
+ "type": "function"
125
+ },
126
+ {
127
+ "inputs": [
128
+ {
129
+ "internalType": "address",
130
+ "name": "",
131
+ "type": "address"
132
+ }
133
+ ],
134
+ "name": "assetTypes",
135
+ "outputs": [
136
+ {
137
+ "internalType": "uint16",
138
+ "name": "",
139
+ "type": "uint16"
140
+ }
141
+ ],
142
+ "stateMutability": "view",
143
+ "type": "function"
144
+ },
145
+ {
146
+ "inputs": [],
147
+ "name": "chainlinkTimeout",
148
+ "outputs": [
149
+ {
150
+ "internalType": "uint256",
151
+ "name": "",
152
+ "type": "uint256"
153
+ }
154
+ ],
155
+ "stateMutability": "view",
156
+ "type": "function"
157
+ },
158
+ {
159
+ "inputs": [
160
+ {
161
+ "internalType": "address",
162
+ "name": "asset",
163
+ "type": "address"
164
+ }
165
+ ],
166
+ "name": "getUSDPrice",
167
+ "outputs": [
168
+ {
169
+ "internalType": "uint256",
170
+ "name": "price",
171
+ "type": "uint256"
172
+ }
173
+ ],
174
+ "stateMutability": "view",
175
+ "type": "function"
176
+ },
177
+ {
178
+ "inputs": [
179
+ {
180
+ "components": [
181
+ {
182
+ "internalType": "address",
183
+ "name": "asset",
184
+ "type": "address"
185
+ },
186
+ {
187
+ "internalType": "uint16",
188
+ "name": "assetType",
189
+ "type": "uint16"
190
+ },
191
+ {
192
+ "internalType": "address",
193
+ "name": "aggregator",
194
+ "type": "address"
195
+ }
196
+ ],
197
+ "internalType": "struct IAssetHandler.Asset[]",
198
+ "name": "assets",
199
+ "type": "tuple[]"
200
+ }
201
+ ],
202
+ "name": "initialize",
203
+ "outputs": [],
204
+ "stateMutability": "nonpayable",
205
+ "type": "function"
206
+ },
207
+ {
208
+ "inputs": [],
209
+ "name": "owner",
210
+ "outputs": [
211
+ {
212
+ "internalType": "address",
213
+ "name": "",
214
+ "type": "address"
215
+ }
216
+ ],
217
+ "stateMutability": "view",
218
+ "type": "function"
219
+ },
220
+ {
221
+ "inputs": [
222
+ {
223
+ "internalType": "address",
224
+ "name": "",
225
+ "type": "address"
226
+ }
227
+ ],
228
+ "name": "priceAggregators",
229
+ "outputs": [
230
+ {
231
+ "internalType": "address",
232
+ "name": "",
233
+ "type": "address"
234
+ }
235
+ ],
236
+ "stateMutability": "view",
237
+ "type": "function"
238
+ },
239
+ {
240
+ "inputs": [
241
+ {
242
+ "internalType": "address",
243
+ "name": "asset",
244
+ "type": "address"
245
+ }
246
+ ],
247
+ "name": "removeAsset",
248
+ "outputs": [],
249
+ "stateMutability": "nonpayable",
250
+ "type": "function"
251
+ },
252
+ {
253
+ "inputs": [],
254
+ "name": "renounceOwnership",
255
+ "outputs": [],
256
+ "stateMutability": "nonpayable",
257
+ "type": "function"
258
+ },
259
+ {
260
+ "inputs": [
261
+ {
262
+ "internalType": "uint256",
263
+ "name": "newTimeoutPeriod",
264
+ "type": "uint256"
265
+ }
266
+ ],
267
+ "name": "setChainlinkTimeout",
268
+ "outputs": [],
269
+ "stateMutability": "nonpayable",
270
+ "type": "function"
271
+ },
272
+ {
273
+ "inputs": [
274
+ {
275
+ "internalType": "address",
276
+ "name": "newOwner",
277
+ "type": "address"
278
+ }
279
+ ],
280
+ "name": "transferOwnership",
281
+ "outputs": [],
282
+ "stateMutability": "nonpayable",
283
+ "type": "function"
284
+ }
285
+ ]
286
+ }
package/src/config.ts CHANGED
@@ -25,7 +25,7 @@ export const routerAddress: AddressDappNetworkMap = {
25
25
  [Dapp.SUSHISWAP]: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506",
26
26
  [Dapp.AAVE]: "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf",
27
27
  [Dapp.AAVEV3]: "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
28
- [Dapp.ONEINCH]: "0x1111111254EEB25477B68fb85Ed929f73A960582",
28
+ [Dapp.ONEINCH]: "0x111111125421ca6dc452d289314280a0f8842a65",
29
29
  [Dapp.QUICKSWAP]: "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
30
30
  [Dapp.BALANCER]: "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
31
31
  [Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
@@ -37,7 +37,7 @@ export const routerAddress: AddressDappNetworkMap = {
37
37
  [Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
38
38
  [Dapp.SYNTHETIX]: "0x8700dAec35aF8Ff88c16BdF0418774CB3D7599B4",
39
39
  [Dapp.AAVEV3]: "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
40
- [Dapp.ONEINCH]: "0x1111111254EEB25477B68fb85Ed929f73A960582",
40
+ [Dapp.ONEINCH]: "0x111111125421ca6dc452d289314280a0f8842a65",
41
41
  [Dapp.TOROS]: "0x3988513793bCE39f0167064A9F7fC3617FaF35AB",
42
42
  [Dapp.VELODROME]: "0x9c12939390052919aF3155f41Bf4160Fd3666A6f",
43
43
  [Dapp.VELODROMEV2]: "0xa062ae8a9c5e11aaa026fc2670b0d65ccc8b2858",
@@ -46,14 +46,15 @@ export const routerAddress: AddressDappNetworkMap = {
46
46
  [Dapp.ZEROEX]: "0xdef1abe32c034e558cdd535791643c58a13acc10"
47
47
  },
48
48
  [Network.ARBITRUM]: {
49
- [Dapp.ONEINCH]: "0x1111111254EEB25477B68fb85Ed929f73A960582",
49
+ [Dapp.ONEINCH]: "0x111111125421ca6dc452d289314280a0f8842a65",
50
50
  [Dapp.UNISWAPV3]: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
51
51
  [Dapp.AAVEV3]: "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
52
52
  [Dapp.BALANCER]: "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
53
- [Dapp.RAMSES]: "0xaaa87963efeb6f7e0a2711f397663105acb1805e"
53
+ [Dapp.RAMSES]: "0xaaa87963efeb6f7e0a2711f397663105acb1805e",
54
+ [Dapp.ZEROEX]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff"
54
55
  },
55
56
  [Network.BASE]: {
56
- [Dapp.ONEINCH]: "0x1111111254EEB25477B68fb85Ed929f73A960582",
57
+ [Dapp.ONEINCH]: "0x111111125421ca6dc452d289314280a0f8842a65",
57
58
  [Dapp.ZEROEX]: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
58
59
  [Dapp.AERODROME]: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
59
60
  [Dapp.AAVEV3]: "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5"
@@ -106,13 +107,14 @@ export const nonfungiblePositionManagerAddress: AddressDappNetworkMap = {
106
107
  },
107
108
  [Network.OPTIMISM]: {
108
109
  [Dapp.UNISWAPV3]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88",
109
- [Dapp.VELODROMECL]: "0xbb5dfe1380333cee4c2eebd7202c80de2256adf4"
110
+ [Dapp.VELODROMECL]: "0x416b433906b1B72FA758e166e239c43d68dC6F29"
110
111
  },
111
112
  [Network.ARBITRUM]: {
112
113
  [Dapp.UNISWAPV3]: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
113
114
  },
114
115
  [Network.BASE]: {
115
- [Dapp.UNISWAPV3]: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1"
116
+ [Dapp.UNISWAPV3]: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1",
117
+ [Dapp.AERODROMECL]: "0x827922686190790b37229fd06084350e74485b72"
116
118
  }
117
119
  };
118
120
 
@@ -44,8 +44,6 @@ import { getEasySwapperTxData } from "../services/toros/easySwapper";
44
44
  import { getAaveV3ClaimTxData } from "../services/aave/incentives";
45
45
  import {
46
46
  getVelodromeAddLiquidityTxData,
47
- getVelodromeCLDecreaseStakedLiquidityTxData,
48
- getVelodromeCLIncreaseStakedLiquidityTxData,
49
47
  getVelodromeClOwner,
50
48
  getVelodromeRemoveLiquidityTxData
51
49
  } from "../services/velodrome/liquidity";
@@ -572,6 +570,7 @@ export class Pool {
572
570
  case Dapp.VELODROMEV2:
573
571
  case Dapp.AERODROME:
574
572
  case Dapp.VELODROMECL:
573
+ case Dapp.AERODROMECL:
575
574
  stakeTxData = getVelodromeStakeTxData(amount, true);
576
575
  break;
577
576
  default:
@@ -981,7 +980,7 @@ export class Pool {
981
980
 
982
981
  /**
983
982
  * Create UniswapV3 liquidity pool
984
- * @param {dapp} Platform either UniswapV3 or VelodromeCL
983
+ * @param {dapp} Platform UniswapV3, VelodromeCL or AerodromeCL
985
984
  * @param {string} assetA First asset
986
985
  * @param {string} assetB Second asset
987
986
  * @param {BigNumber | string} amountA Amount first asset
@@ -996,7 +995,7 @@ export class Pool {
996
995
  * @returns {Promise<any>} Transaction
997
996
  */
998
997
  async addLiquidityUniswapV3(
999
- dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL,
998
+ dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL,
1000
999
  assetA: string,
1001
1000
  assetB: string,
1002
1001
  amountA: BigNumber | string,
@@ -1014,8 +1013,8 @@ export class Pool {
1014
1013
  (minTick === null || maxTick === null)
1015
1014
  )
1016
1015
  throw new Error("Need to provide price or tick range");
1017
- if ((minPrice || maxPrice) && dapp === Dapp.VELODROMECL)
1018
- throw new Error("no price conversion for Velodrome CL");
1016
+ if ((minPrice || maxPrice) && dapp !== Dapp.UNISWAPV3)
1017
+ throw new Error("no price conversion for Aerodrome/Velodrome CL");
1019
1018
 
1020
1019
  const mintTxData = await getUniswapV3MintTxData(
1021
1020
  dapp,
@@ -1067,7 +1066,8 @@ export class Pool {
1067
1066
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1068
1067
  break;
1069
1068
  case Dapp.VELODROMECL:
1070
- const tokenIdOwner = await getVelodromeClOwner(this, tokenId);
1069
+ case Dapp.AERODROMECL:
1070
+ const tokenIdOwner = await getVelodromeClOwner(this, dapp, tokenId);
1071
1071
  if (tokenIdOwner.toLowerCase() === this.address.toLowerCase()) {
1072
1072
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1073
1073
  } else {
@@ -1085,10 +1085,8 @@ export class Pool {
1085
1085
  if (!isStaked) {
1086
1086
  txData = await getDecreaseLiquidityTxData(this, dapp, tokenId, amount);
1087
1087
  } else {
1088
- txData = await getVelodromeCLDecreaseStakedLiquidityTxData(
1089
- this,
1090
- tokenId,
1091
- amount
1088
+ throw new Error(
1089
+ "unsupported decreaseStakedLiquidity: unstake first to decrease lp"
1092
1090
  );
1093
1091
  }
1094
1092
  const tx = await getPoolTxOrGasEstimate(
@@ -1125,7 +1123,8 @@ export class Pool {
1125
1123
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1126
1124
  break;
1127
1125
  case Dapp.VELODROMECL:
1128
- const tokenIdOwner = await getVelodromeClOwner(this, tokenId);
1126
+ case Dapp.AERODROMECL:
1127
+ const tokenIdOwner = await getVelodromeClOwner(this, dapp, tokenId);
1129
1128
  if (tokenIdOwner.toLowerCase() === this.address.toLowerCase()) {
1130
1129
  dappAddress = nonfungiblePositionManagerAddress[this.network][dapp];
1131
1130
  } else {
@@ -1149,11 +1148,8 @@ export class Pool {
1149
1148
  amountB
1150
1149
  );
1151
1150
  } else {
1152
- txData = await getVelodromeCLIncreaseStakedLiquidityTxData(
1153
- this,
1154
- tokenId,
1155
- amountA,
1156
- amountB
1151
+ throw new Error(
1152
+ "unsupported increaseStakedLiquidity: unstake first to increase lp"
1157
1153
  );
1158
1154
  }
1159
1155
  const tx = await getPoolTxOrGasEstimate(
@@ -1208,7 +1204,8 @@ export class Pool {
1208
1204
  txData = getVelodromeClaimTxData(this, tokenId, true);
1209
1205
  break;
1210
1206
  case Dapp.VELODROMECL:
1211
- const tokenIdOwner = await getVelodromeClOwner(this, tokenId);
1207
+ case Dapp.AERODROMECL:
1208
+ const tokenIdOwner = await getVelodromeClOwner(this, dapp, tokenId);
1212
1209
  if (tokenIdOwner.toLowerCase() === this.address.toLowerCase()) {
1213
1210
  contractAddress =
1214
1211
  nonfungiblePositionManagerAddress[this.network][dapp];
@@ -4,7 +4,7 @@ import { ApiError, ethers } from "../..";
4
4
  import { networkChainIdMap } from "../../config";
5
5
  import { Pool } from "../../entities";
6
6
 
7
- const oneInchBaseUrl = "https://api.1inch.dev/swap/v5.2/";
7
+ const oneInchBaseUrl = "https://api.1inch.dev/swap/v6.0/";
8
8
 
9
9
  export async function getOneInchSwapTxData(
10
10
  pool: Pool,
@@ -17,14 +17,23 @@ export async function getOneInchSwapTxData(
17
17
  throw new Error("ONEINCH_API_KEY not configured in .env file");
18
18
 
19
19
  const chainId = networkChainIdMap[pool.network];
20
- const apiUrl = `${oneInchBaseUrl}${chainId}/swap?src=${assetFrom}&dst=${assetTo}&amount=${amountIn.toString()}&from=${
21
- pool.address
22
- }&slippage=${slippage.toString()}&disableEstimate=true`;
20
+ const apiUrl = `${oneInchBaseUrl}${chainId}/swap`;
21
+ const params = {
22
+ src: assetFrom,
23
+ dst: assetTo,
24
+ amount: amountIn.toString(),
25
+ from: pool.address,
26
+ origin: pool.signer.address,
27
+ slippage: slippage,
28
+ disableEstimate: true,
29
+ usePermit2: false
30
+ };
23
31
  try {
24
32
  const response = await axios.get(apiUrl, {
25
33
  headers: {
26
34
  Authorization: `Bearer ${process.env.ONEINCH_API_KEY}`
27
- }
35
+ },
36
+ params
28
37
  });
29
38
  return response.data.tx.data;
30
39
  } catch (e) {
@@ -70,7 +70,7 @@ export function tryParseTick(
70
70
  }
71
71
 
72
72
  export async function getUniswapV3MintTxData(
73
- dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL,
73
+ dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL,
74
74
  pool: Pool,
75
75
  assetA: string,
76
76
  assetB: string,
@@ -147,7 +147,7 @@ export async function getUniswapV3MintTxData(
147
147
  INonfungiblePositionManager.abi
148
148
  );
149
149
 
150
- if (dapp === Dapp.VELODROMECL) {
150
+ if (dapp === Dapp.VELODROMECL || dapp === Dapp.AERODROMECL) {
151
151
  iNonfungiblePositionManager = new ethers.utils.Interface(
152
152
  IVeldodromePositionManager.abi
153
153
  );
@@ -162,7 +162,7 @@ export async function getUniswapV3MintTxData(
162
162
  }
163
163
 
164
164
  export async function getUniswapV3Liquidity(
165
- dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL,
165
+ dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL,
166
166
  tokenId: string,
167
167
  pool: Pool
168
168
  ): Promise<BigNumber> {
@@ -184,7 +184,11 @@ export async function getIncreaseLiquidityTxData(
184
184
  amountB: ethers.BigNumber | string
185
185
  ): Promise<any> {
186
186
  let txData;
187
- if (dapp === Dapp.UNISWAPV3 || dapp === Dapp.VELODROMECL) {
187
+ if (
188
+ dapp === Dapp.UNISWAPV3 ||
189
+ dapp === Dapp.VELODROMECL ||
190
+ dapp === Dapp.AERODROMECL
191
+ ) {
188
192
  const abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
189
193
  txData = abi.encodeFunctionData(Transaction.INCREASE_LIQUIDITY, [
190
194
  [tokenId, amountA, amountB, 0, 0, await getDeadline(pool)]
@@ -214,7 +218,11 @@ export async function getDecreaseLiquidityTxData(
214
218
  amount = 100
215
219
  ): Promise<any> {
216
220
  let txData;
217
- if (dapp === Dapp.UNISWAPV3 || dapp === Dapp.VELODROMECL) {
221
+ if (
222
+ dapp === Dapp.UNISWAPV3 ||
223
+ dapp === Dapp.VELODROMECL ||
224
+ dapp === Dapp.AERODROMECL
225
+ ) {
218
226
  const abi = new ethers.utils.Interface(INonfungiblePositionManager.abi);
219
227
  const liquidity = (await getUniswapV3Liquidity(dapp, tokenId, pool))
220
228
  .times(amount)
@@ -1,11 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import { ethers } from "ethers";
3
3
  import IVelodromeRouter from "../../abi/IVeldodromeRouter.json";
4
- import IVelodromeCLGauge from "../../abi/IVelodromeCLGauge.json";
5
4
  import { Pool } from "../../entities";
6
5
  import { Dapp, Transaction } from "../../types";
7
6
  import { getDeadline } from "../../utils/deadline";
8
- import { getUniswapV3Liquidity } from "../uniswap/V3Liquidity";
9
7
  import { nonfungiblePositionManagerAddress } from "../../config";
10
8
  import INonfungiblePositionManager from "../../abi/INonfungiblePositionManager.json";
11
9
 
@@ -51,68 +49,14 @@ export async function getVelodromeRemoveLiquidityTxData(
51
49
  ]);
52
50
  }
53
51
 
54
- export async function getVelodromeCLDecreaseStakedLiquidityTxData(
55
- pool: Pool,
56
- tokenId: string,
57
- amount: number
58
- ): Promise<any> {
59
- const abi = new ethers.utils.Interface(IVelodromeCLGauge.abi);
60
- const liquidity = (
61
- await getUniswapV3Liquidity(Dapp.VELODROMECL, tokenId, pool)
62
- )
63
- .times(amount)
64
- .div(100);
65
-
66
- return abi.encodeFunctionData("decreaseStakedLiquidity", [
67
- tokenId,
68
- liquidity.toFixed(0),
69
- 0,
70
- 0,
71
- await getDeadline(pool)
72
- ]);
73
- }
74
-
75
- export async function getVelodromeCLIncreaseStakedLiquidityTxData(
76
- pool: Pool,
77
- tokenId: string,
78
- amountA: ethers.BigNumber | string,
79
- amountB: ethers.BigNumber | string
80
- ): Promise<any> {
81
- const abi = new ethers.utils.Interface(IVelodromeCLGauge.abi);
82
- return abi.encodeFunctionData("increaseStakedLiquidity", [
83
- tokenId,
84
- amountA,
85
- amountB,
86
- 0,
87
- 0,
88
- await getDeadline(pool)
89
- ]);
90
- }
91
-
92
- export async function getVelodromeCLIncreaseLiquidityTxData(
93
- pool: Pool,
94
- tokenId: string,
95
- amountA: ethers.BigNumber | string,
96
- amountB: ethers.BigNumber | string
97
- ): Promise<any> {
98
- const abi = new ethers.utils.Interface(IVelodromeCLGauge.abi);
99
- return abi.encodeFunctionData("increaseStakedLiquidity", [
100
- tokenId,
101
- amountA,
102
- amountB,
103
- 0,
104
- 0,
105
- await getDeadline(pool)
106
- ]);
107
- }
108
-
109
52
  export async function getVelodromeClOwner(
110
53
  pool: Pool,
54
+ dapp: Dapp.VELODROMECL | Dapp.AERODROMECL,
111
55
  tokenId: string
112
56
  ): Promise<string> {
113
57
  const iNonfungiblePositionManager = new ethers.Contract(
114
58
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
115
- nonfungiblePositionManagerAddress[pool.network][Dapp.VELODROMECL]!,
59
+ nonfungiblePositionManagerAddress[pool.network][dapp]!,
116
60
  INonfungiblePositionManager.abi,
117
61
  pool.signer
118
62
  );