@dhedge/v2-sdk 1.10.4 → 1.10.6
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/README.md +29 -0
- package/dist/entities/pool.d.ts +21 -2
- package/dist/services/oneInch/index.d.ts +4 -1
- package/dist/services/ramses/vesting.d.ts +1 -0
- package/dist/services/toros/easySwapper.d.ts +2 -1
- package/dist/services/uniswap/V3Liquidity.d.ts +2 -2
- package/dist/test/constants.d.ts +7 -0
- package/dist/test/utils/testingHelper.d.ts +0 -1
- package/dist/types.d.ts +2 -1
- package/dist/v2-sdk.cjs.development.js +1748 -1988
- 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 +1748 -1988
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/IDhedgeEasySwapper.json +184 -303
- package/src/abi/IRamsesNonfungiblePositionManager.json +486 -0
- package/src/config.ts +8 -5
- package/src/entities/pool.ts +68 -6
- package/src/services/oneInch/index.ts +9 -6
- package/src/services/ramses/vesting.ts +11 -0
- package/src/services/toros/easySwapper.ts +64 -22
- package/src/services/uniswap/V3Liquidity.ts +14 -4
- package/src/test/constants.ts +12 -5
- package/src/test/ramsesCL.test.ts +155 -0
- package/src/test/toros.test.ts +81 -53
- package/src/test/utils/testingHelper.ts +3 -2
- package/src/types.ts +2 -1
package/README.md
CHANGED
|
@@ -216,6 +216,26 @@ const tx = await pool.trade(
|
|
|
216
216
|
)
|
|
217
217
|
```
|
|
218
218
|
|
|
219
|
+
#### 🚨 Important Update
|
|
220
|
+
Due to the upgrade of our contract, trading out of a Toros token now involves a second step. Please follow the updated process below:
|
|
221
|
+
1. Step:
|
|
222
|
+
```ts
|
|
223
|
+
const tx = await pool.trade(
|
|
224
|
+
Dapp.TOROS,
|
|
225
|
+
"TOROS_TOKEN_ADDRESS",
|
|
226
|
+
"USDC_TOKEN_ADDRESS",
|
|
227
|
+
'100000000',
|
|
228
|
+
slippage
|
|
229
|
+
)
|
|
230
|
+
```
|
|
231
|
+
2. Step:
|
|
232
|
+
```ts
|
|
233
|
+
const tx = await pool.completeTorosWithdrawal(
|
|
234
|
+
"USDC_TOKEN_ADDRESS",
|
|
235
|
+
slippage
|
|
236
|
+
)
|
|
237
|
+
```
|
|
238
|
+
|
|
219
239
|
### Liquidity
|
|
220
240
|
|
|
221
241
|
---
|
|
@@ -361,6 +381,9 @@ const tx = await pool.decreaseLiquidity(
|
|
|
361
381
|
);
|
|
362
382
|
```
|
|
363
383
|
|
|
384
|
+
Removing 100% will burn the NFT position.
|
|
385
|
+
Burning a Ramses CL NFT position won't claim rewards, so `getRewards` needs to be called before.
|
|
386
|
+
|
|
364
387
|
3. Increase liquidity in the existing WETH/USDC pool
|
|
365
388
|
|
|
366
389
|
```ts
|
|
@@ -378,6 +401,12 @@ const result = await pool.increaseLiquidity(
|
|
|
378
401
|
const tx = await pool.claimFees(Dapp.UNISWAPV3, tokenId);
|
|
379
402
|
```
|
|
380
403
|
|
|
404
|
+
4. Claim rewards (e.g. for Ramses CL)
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
const tx = await pool.getRewards(Dapp.RAMSESCL, tokenId, [RAM_ADDRESS]);
|
|
408
|
+
```
|
|
409
|
+
|
|
381
410
|
#### VelodromeV2 / Ramses / Aerodrome
|
|
382
411
|
|
|
383
412
|
For VelodromeV2 / Ramses / Aerodrome , we use `addLiquidityV2`, `stakeInGauge`, `unstakeFromGauge`, `removeLiquidityV2`, and `claimFees`.
|
package/dist/entities/pool.d.ts
CHANGED
|
@@ -292,7 +292,7 @@ export declare class Pool {
|
|
|
292
292
|
harvestAaveV3Rewards(assets: string[], rewardAsset: string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
293
293
|
/**
|
|
294
294
|
* Create UniswapV3 liquidity pool
|
|
295
|
-
* @param {dapp} Platform UniswapV3, VelodromeCL or
|
|
295
|
+
* @param {dapp} Platform UniswapV3, VelodromeCL, AerodromeCL or RamesesCL
|
|
296
296
|
* @param {string} assetA First asset
|
|
297
297
|
* @param {string} assetB Second asset
|
|
298
298
|
* @param {BigNumber | string} amountA Amount first asset
|
|
@@ -306,7 +306,7 @@ export declare class Pool {
|
|
|
306
306
|
* @param {boolean} estimateGas Simulate/estimate gas
|
|
307
307
|
* @returns {Promise<any>} Transaction
|
|
308
308
|
*/
|
|
309
|
-
addLiquidityUniswapV3(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL, 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>;
|
|
309
|
+
addLiquidityUniswapV3(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.RAMSESCL, 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>;
|
|
310
310
|
/**
|
|
311
311
|
* Remove liquidity from an UniswapV3 or Arrakis liquidity pool
|
|
312
312
|
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
@@ -337,6 +337,16 @@ export declare class Pool {
|
|
|
337
337
|
* @returns {Promise<any>} Transaction
|
|
338
338
|
*/
|
|
339
339
|
claimFees(dapp: Dapp, tokenId: string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
340
|
+
/**
|
|
341
|
+
* Get rewards of an NFT position
|
|
342
|
+
* @param {Dapp} dapp Platform e.g. Ramses CL
|
|
343
|
+
* @param {string} tokenId Token Id
|
|
344
|
+
* @param {string[]} rewards Reward tokens
|
|
345
|
+
* @param {any} options Transaction option
|
|
346
|
+
* @param {boolean} estimateGas Simulate/estimate gas
|
|
347
|
+
* @returns {Promise<any>} Transaction
|
|
348
|
+
*/
|
|
349
|
+
getRewards(dapp: Dapp, tokenId: string, rewards: string[], options?: any, estimateGas?: boolean): Promise<any>;
|
|
340
350
|
/**
|
|
341
351
|
* Trade an asset into another asset
|
|
342
352
|
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
@@ -519,4 +529,13 @@ export declare class Pool {
|
|
|
519
529
|
*/
|
|
520
530
|
redeemUnitViaFlatMoney(withdrawAmount: ethers.BigNumber | string, slippage: number | undefined, maxKeeperFeeInUsd: number | null, options?: any, estimateGas?: boolean): Promise<any>;
|
|
521
531
|
cancelOrderViaFlatMoney(options?: any, estimateGas?: boolean): Promise<any>;
|
|
532
|
+
/**
|
|
533
|
+
* Complete a Toros withdrawal to a single asset
|
|
534
|
+
* @param {string} destinationToken Address of destination asset
|
|
535
|
+
* @param {number} slippage Slippage tolerance in %
|
|
536
|
+
* @param {any} options Transaction options
|
|
537
|
+
* @param {boolean} estimateGas Simulate/estimate gas
|
|
538
|
+
* @returns {Promise<any>} Transaction
|
|
539
|
+
*/
|
|
540
|
+
completeTorosWithdrawal(destinationToken: string, slippage?: number, options?: any, estimateGas?: boolean): Promise<any>;
|
|
522
541
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { ethers } from "../..";
|
|
2
2
|
import { Pool } from "../../entities";
|
|
3
|
-
export declare function getOneInchSwapTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number): Promise<
|
|
3
|
+
export declare function getOneInchSwapTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number, forEasySwapper?: boolean): Promise<{
|
|
4
|
+
swapTxData: string;
|
|
5
|
+
dstAmount: string;
|
|
6
|
+
}>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
2
|
export declare function getCreateVestTxData(amount: BigNumber | string): string;
|
|
3
3
|
export declare function getExitVestTxData(vestId: number): string;
|
|
4
|
+
export declare function getRewardsTxDta(tokenId: string, rewards: string[]): string;
|
|
@@ -2,6 +2,7 @@ import { ethers } from "ethers";
|
|
|
2
2
|
import { Pool } from "../..";
|
|
3
3
|
export declare function getPoolDepositAsset(pool: Pool, poolAddress: string, investAsset: string): Promise<string | undefined>;
|
|
4
4
|
export declare function getTorosPoolTokenPrice(pool: Pool, poolAddress: string): Promise<ethers.BigNumber>;
|
|
5
|
-
export declare function getEasySwapperDepositQuote(pool: Pool, torosAsset: string, investAsset: string,
|
|
5
|
+
export declare function getEasySwapperDepositQuote(pool: Pool, torosAsset: string, investAsset: string, amountIn: ethers.BigNumber): Promise<ethers.BigNumber>;
|
|
6
6
|
export declare function getEasySwapperWithdrawalQuote(pool: Pool, torosAsset: string, investAsset: string, amountIn: ethers.BigNumber): Promise<ethers.BigNumber>;
|
|
7
7
|
export declare function getEasySwapperTxData(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber, slippage: number): Promise<any>;
|
|
8
|
+
export declare function getCompleteWithdrawalTxData(pool: Pool, destToken: string, slippage: number): Promise<string>;
|
|
@@ -4,7 +4,7 @@ import { Dapp, Pool } from "../..";
|
|
|
4
4
|
import BigNumber from "bignumber.js";
|
|
5
5
|
export declare function tryParsePrice(baseToken: Token, quoteToken: Token, value: string): Price<Token, Token>;
|
|
6
6
|
export declare function tryParseTick(baseToken: Token, quoteToken: Token, feeAmount: number, value: string): number;
|
|
7
|
-
export declare function getUniswapV3MintTxData(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL, 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 | Dapp.AERODROMECL, tokenId: string, pool: Pool): Promise<BigNumber>;
|
|
7
|
+
export declare function getUniswapV3MintTxData(dapp: Dapp.UNISWAPV3 | Dapp.VELODROMECL | Dapp.AERODROMECL | Dapp.RAMSESCL, 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 | Dapp.AERODROMECL | Dapp.RAMSESCL, tokenId: string, pool: Pool): Promise<BigNumber>;
|
|
9
9
|
export declare function getIncreaseLiquidityTxData(pool: Pool, dapp: Dapp, tokenId: string, amountA: ethers.BigNumber | string, amountB: ethers.BigNumber | string): Promise<any>;
|
|
10
10
|
export declare function getDecreaseLiquidityTxData(pool: Pool, dapp: Dapp, tokenId: string, amount?: number): Promise<any>;
|
package/dist/test/constants.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
23
23
|
polygon: {
|
|
24
24
|
USDC: string;
|
|
25
25
|
USDT: string;
|
|
26
|
+
SUSD: string;
|
|
26
27
|
SWETH: string;
|
|
27
28
|
WETH: string;
|
|
28
29
|
WBTC: string;
|
|
@@ -35,6 +36,7 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
35
36
|
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
36
37
|
VELO: string;
|
|
37
38
|
COMPOUNDV3_WETH: string;
|
|
39
|
+
TOROS: string;
|
|
38
40
|
};
|
|
39
41
|
optimism: {
|
|
40
42
|
USDC: string;
|
|
@@ -53,10 +55,12 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
53
55
|
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
54
56
|
VELO: string;
|
|
55
57
|
COMPOUNDV3_WETH: string;
|
|
58
|
+
TOROS: string;
|
|
56
59
|
};
|
|
57
60
|
arbitrum: {
|
|
58
61
|
USDC: string;
|
|
59
62
|
USDT: string;
|
|
63
|
+
SUSD: string;
|
|
60
64
|
SWETH: string;
|
|
61
65
|
WETH: string;
|
|
62
66
|
WBTC: string;
|
|
@@ -72,10 +76,12 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
72
76
|
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
73
77
|
VELO: string;
|
|
74
78
|
COMPOUNDV3_WETH: string;
|
|
79
|
+
TOROS: string;
|
|
75
80
|
};
|
|
76
81
|
base: {
|
|
77
82
|
USDC: string;
|
|
78
83
|
USDT: string;
|
|
84
|
+
SUSD: string;
|
|
79
85
|
WETH: string;
|
|
80
86
|
WBTC: string;
|
|
81
87
|
SWETH: string;
|
|
@@ -88,6 +94,7 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
88
94
|
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
89
95
|
VELO: string;
|
|
90
96
|
COMPOUNDV3_WETH: string;
|
|
97
|
+
TOROS: string;
|
|
91
98
|
};
|
|
92
99
|
};
|
|
93
100
|
export declare const MAX_AMOUNT: ethers.BigNumber;
|
package/dist/types.d.ts
CHANGED
|
@@ -24,7 +24,8 @@ export declare enum Dapp {
|
|
|
24
24
|
ZEROEX = "0x",
|
|
25
25
|
RAMSES = "ramses",
|
|
26
26
|
AERODROME = "aerodrome",
|
|
27
|
-
AERODROMECL = "aerodromeCL"
|
|
27
|
+
AERODROMECL = "aerodromeCL",
|
|
28
|
+
RAMSESCL = "ramsesCL"
|
|
28
29
|
}
|
|
29
30
|
export declare enum Transaction {
|
|
30
31
|
SWAP = "swapExactTokensForTokens",
|