@dhedge/v2-sdk 1.9.9 → 1.10.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 +1 -1
- package/dist/entities/pool.d.ts +17 -7
- package/dist/services/uniswap/V3Liquidity.d.ts +8 -7
- package/dist/services/uniswap/V3Trade.d.ts +1 -2
- package/dist/services/velodrome/liquidity.d.ts +7 -3
- package/dist/services/velodrome/staking.d.ts +1 -0
- package/dist/test/constants.d.ts +14 -0
- package/dist/test/utils/testingHelper.d.ts +6 -0
- package/dist/types.d.ts +1 -0
- package/dist/v2-sdk.cjs.development.js +2675 -1370
- 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 +2688 -1383
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/abi/IERC721.json +217 -0
- package/src/abi/IVelodromeCLGauge.json +165 -0
- package/src/abi/IVelodromeNonfungiblePositionManager.json +408 -0
- package/src/config.ts +17 -7
- package/src/entities/pool.ts +141 -82
- package/src/services/lyra/trade.ts +1 -1
- package/src/services/uniswap/V3Liquidity.ts +141 -18
- package/src/services/uniswap/V3Trade.ts +1 -2
- package/src/services/velodrome/liquidity.ts +77 -5
- package/src/services/velodrome/staking.ts +6 -0
- package/src/test/constants.ts +22 -6
- package/src/test/uniswap.test.ts +24 -15
- package/src/test/utils/testingHelper.ts +25 -1
- package/src/test/velodromeCL.test.ts +223 -0
- package/src/types.ts +1 -0
- package/dist/services/uniswap/types.d.ts +0 -3
- package/src/services/uniswap/types.ts +0 -16
package/dist/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const routerAddress: AddressDappNetworkMap;
|
|
|
5
5
|
export declare const dappFactoryAddress: AddressDappNetworkMap;
|
|
6
6
|
export declare const stakingAddress: AddressDappNetworkMap;
|
|
7
7
|
export declare const aaveAddressProvider: AddressDappNetworkMap;
|
|
8
|
-
export declare const nonfungiblePositionManagerAddress:
|
|
8
|
+
export declare const nonfungiblePositionManagerAddress: AddressDappNetworkMap;
|
|
9
9
|
export declare const networkChainIdMap: NetworkChainIdMap;
|
|
10
10
|
export declare const balancerSubgraph: AddressNetworkMap;
|
|
11
11
|
export declare const multiCallAddress: AddressNetworkMap;
|
package/dist/entities/pool.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Contract, ethers, Wallet, BigNumber } from "ethers";
|
|
2
2
|
import { Dapp, FundComposition, AssetEnabled, Network, LyraOptionMarket, LyraOptionType, LyraTradeType, LyraPosition } from "../types";
|
|
3
3
|
import { Utils } from "./utils";
|
|
4
|
-
import { FeeAmount } from "@uniswap/v3-sdk";
|
|
5
4
|
export declare class Pool {
|
|
6
5
|
readonly poolLogic: Contract;
|
|
7
6
|
readonly managerLogic: Contract;
|
|
@@ -82,6 +81,16 @@ export declare class Pool {
|
|
|
82
81
|
* @returns {Promise<any>} Transaction
|
|
83
82
|
*/
|
|
84
83
|
approveSpender(spender: string, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
84
|
+
/**
|
|
85
|
+
* Approve NFT for provided spender address
|
|
86
|
+
* @param {string} spender Spender address
|
|
87
|
+
* @param {string} asset Address of asset
|
|
88
|
+
* @param {string} tokenId NFT id
|
|
89
|
+
* @param {any} options Transaction options
|
|
90
|
+
* @param {boolean} estimateGas Simulate/estimate gas
|
|
91
|
+
* @returns {Promise<any>} Transaction
|
|
92
|
+
*/
|
|
93
|
+
approveSpenderNFT(spender: string, asset: string, tokenId: string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
85
94
|
/**
|
|
86
95
|
* Trade an asset into another asset
|
|
87
96
|
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
@@ -131,7 +140,7 @@ export declare class Pool {
|
|
|
131
140
|
* Stake liquidity pool tokens in gauge contract
|
|
132
141
|
* @param {Dapp} dapp Platform like Balancer or Velodrome
|
|
133
142
|
* @param {string} gauge Gauge contract address
|
|
134
|
-
* @param {BigNumber | string} amount Amount of liquidity pool tokens
|
|
143
|
+
* @param {BigNumber | string} amount Amount of liquidity pool tokens or token ID for Velodrome CL
|
|
135
144
|
* @param {any} options Transaction options
|
|
136
145
|
* @param {boolean} estimateGas Simulate/estimate gas
|
|
137
146
|
* @returns {Promise<any>} Transaction
|
|
@@ -150,7 +159,7 @@ export declare class Pool {
|
|
|
150
159
|
/**
|
|
151
160
|
* Unstake liquidity pool tokens from Velodrome or Balancer gauge
|
|
152
161
|
* @param {string} gauge Gauge contract address
|
|
153
|
-
* @param {BigNumber | string} amount Amount of liquidity pool tokens
|
|
162
|
+
* @param {BigNumber | string} amount Amount of liquidity pool tokens or CL token ID
|
|
154
163
|
* @param {any} options Transaction options
|
|
155
164
|
* @param {boolean} estimateGas Simulate/estimate gas
|
|
156
165
|
* @returns {Promise<any>} Transaction
|
|
@@ -263,6 +272,7 @@ export declare class Pool {
|
|
|
263
272
|
harvestAaveV3Rewards(assets: string[], rewardAsset: string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
264
273
|
/**
|
|
265
274
|
* Create UniswapV3 liquidity pool
|
|
275
|
+
* @param {dapp} Platform either UniswapV3 or VelodromeCL
|
|
266
276
|
* @param {string} assetA First asset
|
|
267
277
|
* @param {string} assetB Second asset
|
|
268
278
|
* @param {BigNumber | string} amountA Amount first asset
|
|
@@ -271,12 +281,12 @@ export declare class Pool {
|
|
|
271
281
|
* @param { number } maxPrice Upper price range (assetB per assetA)
|
|
272
282
|
* @param { number } minTick Lower tick range
|
|
273
283
|
* @param { number } maxTick Upper tick range
|
|
274
|
-
* @param {
|
|
284
|
+
* @param { number } feeAmountOrTickSpacing Fee tier UniswapV3 or tick spacing VelodromeCL
|
|
275
285
|
* @param {any} options Transaction options
|
|
276
286
|
* @param {boolean} estimateGas Simulate/estimate gas
|
|
277
287
|
* @returns {Promise<any>} Transaction
|
|
278
288
|
*/
|
|
279
|
-
addLiquidityUniswapV3(assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, minPrice: number | null, maxPrice: number | null, minTick: number | null, maxTick: number | null,
|
|
289
|
+
addLiquidityUniswapV3(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, minPrice: number | null, maxPrice: number | null, minTick: number | null, maxTick: number | null, feeAmountOrTickSpacing: number, options?: any, estimateGas?: boolean): Promise<any>;
|
|
280
290
|
/**
|
|
281
291
|
* Remove liquidity from an UniswapV3 or Arrakis liquidity pool
|
|
282
292
|
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
@@ -288,7 +298,7 @@ export declare class Pool {
|
|
|
288
298
|
*/
|
|
289
299
|
decreaseLiquidity(dapp: Dapp, tokenId: string, amount?: number, options?: any, estimateGas?: boolean): Promise<any>;
|
|
290
300
|
/**
|
|
291
|
-
* Increase liquidity of an
|
|
301
|
+
* Increase liquidity of an UniswapV, VelodromeCL or Arrakis liquidity pool
|
|
292
302
|
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
293
303
|
* @param {string} tokenId Token Id of UniswapV3 position
|
|
294
304
|
* @param {BigNumber | string} amountA Amount first asset
|
|
@@ -319,7 +329,7 @@ export declare class Pool {
|
|
|
319
329
|
* @param {boolean} estimateGas Simulate/estimate gas
|
|
320
330
|
* @returns {Promise<any>} Transaction
|
|
321
331
|
*/
|
|
322
|
-
tradeUniswapV3(assetFrom: string, assetTo: string, amountIn: BigNumber | string, feeAmount:
|
|
332
|
+
tradeUniswapV3(assetFrom: string, assetTo: string, amountIn: BigNumber | string, feeAmount: number, slippage?: number, options?: any, estimateGas?: boolean): Promise<any>;
|
|
323
333
|
/**
|
|
324
334
|
* Add liquidity to Velodrome pool
|
|
325
335
|
* @param {string} assetA First asset
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FeeAmount } from "@uniswap/v3-sdk";
|
|
1
|
+
import { Token, Price } from "@uniswap/sdk-core";
|
|
3
2
|
import { ethers } from "ethers";
|
|
4
|
-
import { Pool } from "../..";
|
|
5
|
-
import
|
|
3
|
+
import { Dapp, Pool } from "../..";
|
|
4
|
+
import BigNumber from "bignumber.js";
|
|
6
5
|
export declare function tryParsePrice(baseToken: Token, quoteToken: Token, value: string): Price<Token, Token>;
|
|
7
|
-
export declare function tryParseTick(baseToken: Token, quoteToken: Token, feeAmount:
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function getUniswapV3Liquidity(tokenId: string, pool: Pool): Promise<
|
|
6
|
+
export declare function tryParseTick(baseToken: Token, quoteToken: Token, feeAmount: number, value: string): number;
|
|
7
|
+
export declare function getUniswapV3MintTxData(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL, pool: Pool, assetA: string, assetB: string, amountA: string | ethers.BigNumber, amountB: string | ethers.BigNumber, minPrice: number | null, maxPrice: number | null, minTick: number | null, maxTick: number | null, feeAmountOrTickSpacing: number): Promise<any>;
|
|
8
|
+
export declare function getUniswapV3Liquidity(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL, tokenId: string, pool: Pool): Promise<BigNumber>;
|
|
9
|
+
export declare function getIncreaseLiquidityTxData(pool: Pool, dapp: Dapp, tokenId: string, amountA: ethers.BigNumber | string, amountB: ethers.BigNumber | string): Promise<any>;
|
|
10
|
+
export declare function getDecreaseLiquidityTxData(pool: Pool, dapp: Dapp, tokenId: string, amount?: number): Promise<any>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FeeAmount } from "@uniswap/v3-sdk";
|
|
2
1
|
import { ethers } from "ethers";
|
|
3
2
|
import { Pool } from "../..";
|
|
4
|
-
export declare function getUniswapV3SwapTxData(pool: Pool, assetA: string, assetB: string, amountIn: string | ethers.BigNumber, slippage: number, feeAmount:
|
|
3
|
+
export declare function getUniswapV3SwapTxData(pool: Pool, assetA: string, assetB: string, amountIn: string | ethers.BigNumber, slippage: number, feeAmount: number): Promise<any>;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
2
|
import { Pool } from "../../entities";
|
|
3
|
-
export declare function getVelodromeAddLiquidityTxData(pool: Pool, assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, isStable: boolean): Promise<any>;
|
|
4
|
-
export declare function getVelodromeRemoveLiquidityTxData(pool: Pool, assetA: string, assetB: string, amount: BigNumber | string, isStable: boolean): Promise<any>;
|
|
3
|
+
export declare function getVelodromeAddLiquidityTxData(pool: Pool, assetA: string, assetB: string, amountA: ethers.BigNumber | string, amountB: ethers.BigNumber | string, isStable: boolean): Promise<any>;
|
|
4
|
+
export declare function getVelodromeRemoveLiquidityTxData(pool: Pool, assetA: string, assetB: string, amount: ethers.BigNumber | string, isStable: boolean): Promise<any>;
|
|
5
|
+
export declare function getVelodromeCLDecreaseStakedLiquidityTxData(pool: Pool, tokenId: string, amount: number): Promise<any>;
|
|
6
|
+
export declare function getVelodromeCLIncreaseStakedLiquidityTxData(pool: Pool, tokenId: string, amountA: ethers.BigNumber | string, amountB: ethers.BigNumber | string): Promise<any>;
|
|
7
|
+
export declare function getVelodromeCLIncreaseLiquidityTxData(pool: Pool, tokenId: string, amountA: ethers.BigNumber | string, amountB: ethers.BigNumber | string): Promise<any>;
|
|
8
|
+
export declare function getVelodromeClOwner(pool: Pool, tokenId: string): Promise<string>;
|
|
@@ -2,3 +2,4 @@ import { BigNumber } from "ethers";
|
|
|
2
2
|
import { Pool } from "../../entities";
|
|
3
3
|
export declare function getVelodromeStakeTxData(amount: BigNumber | string, v2: boolean): any;
|
|
4
4
|
export declare function getVelodromeClaimTxData(pool: Pool, gauge: string, v2: boolean): Promise<any>;
|
|
5
|
+
export declare function getVelodromeCLClaimTxData(tokenId: string): Promise<any>;
|
package/dist/test/constants.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
31
31
|
uniswapV3: {
|
|
32
32
|
nonfungiblePositionManager: string;
|
|
33
33
|
};
|
|
34
|
+
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
35
|
+
VELO: string;
|
|
34
36
|
};
|
|
35
37
|
optimism: {
|
|
36
38
|
USDC: string;
|
|
@@ -45,6 +47,8 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
45
47
|
WMATIC: string;
|
|
46
48
|
ARRAKIS_USDC_WETH_GAUGE: string;
|
|
47
49
|
ARRAKIS_USDC_WETH_LP: string;
|
|
50
|
+
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
51
|
+
VELO: string;
|
|
48
52
|
};
|
|
49
53
|
arbitrum: {
|
|
50
54
|
USDC: string;
|
|
@@ -60,6 +64,8 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
60
64
|
ARRAKIS_USDC_WETH_GAUGE: string;
|
|
61
65
|
ARRAKIS_USDC_WETH_LP: string;
|
|
62
66
|
WMATIC: string;
|
|
67
|
+
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
68
|
+
VELO: string;
|
|
63
69
|
};
|
|
64
70
|
base: {
|
|
65
71
|
USDC: string;
|
|
@@ -72,6 +78,8 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
72
78
|
ARRAKIS_USDC_WETH_GAUGE: string;
|
|
73
79
|
ARRAKIS_USDC_WETH_LP: string;
|
|
74
80
|
WMATIC: string;
|
|
81
|
+
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
82
|
+
VELO: string;
|
|
75
83
|
};
|
|
76
84
|
};
|
|
77
85
|
export declare const MAX_AMOUNT: ethers.BigNumber;
|
|
@@ -81,3 +89,9 @@ export declare const USDC_BALANCEOF_SLOT: {
|
|
|
81
89
|
polygon: number;
|
|
82
90
|
base: number;
|
|
83
91
|
};
|
|
92
|
+
export declare const WETH_BALANCEOF_SLOT: {
|
|
93
|
+
optimism: number;
|
|
94
|
+
arbitrum: number;
|
|
95
|
+
polygon: number;
|
|
96
|
+
base: number;
|
|
97
|
+
};
|
|
@@ -31,5 +31,11 @@ export declare const setUSDCAmount: ({ provider, userAddress, amount, network }:
|
|
|
31
31
|
provider: ethers.providers.JsonRpcProvider;
|
|
32
32
|
network: Network;
|
|
33
33
|
}) => Promise<void>;
|
|
34
|
+
export declare const setWETHAmount: ({ provider, userAddress, amount, network }: {
|
|
35
|
+
amount: string;
|
|
36
|
+
userAddress: string;
|
|
37
|
+
provider: ethers.providers.JsonRpcProvider;
|
|
38
|
+
network: Network;
|
|
39
|
+
}) => Promise<void>;
|
|
34
40
|
export declare const wait: (seconds: number) => Promise<void>;
|
|
35
41
|
export {};
|