@dhedge/v2-sdk 1.10.3 → 1.10.5
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 +9 -0
- package/dist/entities/pool.d.ts +32 -2
- package/dist/services/compound/lending.d.ts +3 -0
- package/dist/services/ramses/vesting.d.ts +1 -0
- package/dist/services/uniswap/V3Liquidity.d.ts +2 -2
- package/dist/test/constants.d.ts +4 -0
- package/dist/types.d.ts +2 -1
- package/dist/v2-sdk.cjs.development.js +1158 -447
- 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 +1158 -447
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/IRamsesNonfungiblePositionManager.json +486 -0
- package/src/abi/compound/ICompoundV3Comet.json +51 -0
- package/src/config.ts +2 -1
- package/src/entities/pool.ts +93 -3
- package/src/services/compound/lending.ts +20 -0
- package/src/services/ramses/vesting.ts +11 -0
- package/src/services/uniswap/V3Liquidity.ts +14 -4
- package/src/test/compoundV3.test.ts +90 -0
- package/src/test/constants.ts +9 -5
- package/src/test/ramsesCL.test.ts +155 -0
- package/src/types.ts +2 -1
package/README.md
CHANGED
|
@@ -361,6 +361,9 @@ const tx = await pool.decreaseLiquidity(
|
|
|
361
361
|
);
|
|
362
362
|
```
|
|
363
363
|
|
|
364
|
+
Removing 100% will burn the NFT position.
|
|
365
|
+
Burning a Ramses CL NFT position won't claim rewards, so `getRewards` needs to be called before.
|
|
366
|
+
|
|
364
367
|
3. Increase liquidity in the existing WETH/USDC pool
|
|
365
368
|
|
|
366
369
|
```ts
|
|
@@ -378,6 +381,12 @@ const result = await pool.increaseLiquidity(
|
|
|
378
381
|
const tx = await pool.claimFees(Dapp.UNISWAPV3, tokenId);
|
|
379
382
|
```
|
|
380
383
|
|
|
384
|
+
4. Claim rewards (e.g. for Ramses CL)
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
const tx = await pool.getRewards(Dapp.RAMSESCL, tokenId, [RAM_ADDRESS]);
|
|
388
|
+
```
|
|
389
|
+
|
|
381
390
|
#### VelodromeV2 / Ramses / Aerodrome
|
|
382
391
|
|
|
383
392
|
For VelodromeV2 / Ramses / Aerodrome , we use `addLiquidityV2`, `stakeInGauge`, `unstakeFromGauge`, `removeLiquidityV2`, and `claimFees`.
|
package/dist/entities/pool.d.ts
CHANGED
|
@@ -176,6 +176,16 @@ export declare class Pool {
|
|
|
176
176
|
* @returns {Promise<any>} Transaction
|
|
177
177
|
*/
|
|
178
178
|
lend(dapp: Dapp, asset: string, amount: BigNumber | string, referralCode?: number, options?: any, estimateGas?: boolean): Promise<any>;
|
|
179
|
+
/**
|
|
180
|
+
* Lend asset to a Compound V3 style lending pool
|
|
181
|
+
* @param {string} market Address of market e.g cUSDCv3 address
|
|
182
|
+
* @param {string} asset Asset
|
|
183
|
+
* @param {BigNumber | string} amount Amount of asset to lend
|
|
184
|
+
* @param {any} options Transaction options
|
|
185
|
+
* @param {boolean} estimateGas Simulate/estimate gas
|
|
186
|
+
* @returns {Promise<any>} Transaction
|
|
187
|
+
*/
|
|
188
|
+
lendCompoundV3(market: string, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
179
189
|
/**
|
|
180
190
|
* Witdraw asset from a lending pool
|
|
181
191
|
* @param {Dapp} dapp Platform like Aave
|
|
@@ -186,6 +196,16 @@ export declare class Pool {
|
|
|
186
196
|
* @returns {Promise<any>} Transaction
|
|
187
197
|
*/
|
|
188
198
|
withdrawDeposit(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
199
|
+
/**
|
|
200
|
+
* Witdraw asset from a COmpound V3 style lending pool
|
|
201
|
+
* @param {string} market Address of market e.g cUSDCv3 address
|
|
202
|
+
* @param {string} asset Asset
|
|
203
|
+
* @param {BigNumber | string} amount Amount of asset to withdraw
|
|
204
|
+
* @param {any} options Transaction options
|
|
205
|
+
* @param {boolean} estimateGas Simulate/estimate gas
|
|
206
|
+
* @returns {Promise<any>} Transaction
|
|
207
|
+
*/
|
|
208
|
+
withdrawCompoundV3(market: string, asset: string, amount: BigNumber | string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
189
209
|
/**
|
|
190
210
|
* Borrow asset from a lending pool
|
|
191
211
|
* @param {Dapp} dapp Platform like Aave
|
|
@@ -272,7 +292,7 @@ export declare class Pool {
|
|
|
272
292
|
harvestAaveV3Rewards(assets: string[], rewardAsset: string, options?: any, estimateGas?: boolean): Promise<any>;
|
|
273
293
|
/**
|
|
274
294
|
* Create UniswapV3 liquidity pool
|
|
275
|
-
* @param {dapp} Platform UniswapV3, VelodromeCL or
|
|
295
|
+
* @param {dapp} Platform UniswapV3, VelodromeCL, AerodromeCL or RamesesCL
|
|
276
296
|
* @param {string} assetA First asset
|
|
277
297
|
* @param {string} assetB Second asset
|
|
278
298
|
* @param {BigNumber | string} amountA Amount first asset
|
|
@@ -286,7 +306,7 @@ export declare class Pool {
|
|
|
286
306
|
* @param {boolean} estimateGas Simulate/estimate gas
|
|
287
307
|
* @returns {Promise<any>} Transaction
|
|
288
308
|
*/
|
|
289
|
-
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>;
|
|
290
310
|
/**
|
|
291
311
|
* Remove liquidity from an UniswapV3 or Arrakis liquidity pool
|
|
292
312
|
* @param {Dapp} dapp Platform either UniswapV3 or Arrakis
|
|
@@ -317,6 +337,16 @@ export declare class Pool {
|
|
|
317
337
|
* @returns {Promise<any>} Transaction
|
|
318
338
|
*/
|
|
319
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>;
|
|
320
350
|
/**
|
|
321
351
|
* Trade an asset into another asset
|
|
322
352
|
* @param {Dapp} dapp Platform like Sushiswap or Uniswap
|
|
@@ -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;
|
|
@@ -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
|
@@ -34,6 +34,7 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
34
34
|
};
|
|
35
35
|
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
36
36
|
VELO: string;
|
|
37
|
+
COMPOUNDV3_WETH: string;
|
|
37
38
|
};
|
|
38
39
|
optimism: {
|
|
39
40
|
USDC: string;
|
|
@@ -51,6 +52,7 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
51
52
|
ARRAKIS_USDC_WETH_LP: string;
|
|
52
53
|
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
53
54
|
VELO: string;
|
|
55
|
+
COMPOUNDV3_WETH: string;
|
|
54
56
|
};
|
|
55
57
|
arbitrum: {
|
|
56
58
|
USDC: string;
|
|
@@ -69,6 +71,7 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
69
71
|
WMATIC: string;
|
|
70
72
|
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
71
73
|
VELO: string;
|
|
74
|
+
COMPOUNDV3_WETH: string;
|
|
72
75
|
};
|
|
73
76
|
base: {
|
|
74
77
|
USDC: string;
|
|
@@ -84,6 +87,7 @@ export declare const CONTRACT_ADDRESS: {
|
|
|
84
87
|
WMATIC: string;
|
|
85
88
|
VELODROME_CL_USDC_WETH_GAUGE: string;
|
|
86
89
|
VELO: string;
|
|
90
|
+
COMPOUNDV3_WETH: string;
|
|
87
91
|
};
|
|
88
92
|
};
|
|
89
93
|
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",
|