@dhedge/v2-sdk 1.1.1 → 1.3.0

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.
Files changed (59) hide show
  1. package/README.md +60 -3
  2. package/dist/config.d.ts +7 -0
  3. package/dist/entities/pool.d.ts +101 -5
  4. package/dist/entities/utils.d.ts +10 -0
  5. package/dist/services/claim-balancer/claim.service.d.ts +17 -0
  6. package/dist/services/claim-balancer/claim.worker.d.ts +4 -0
  7. package/dist/services/claim-balancer/ipfs.service.d.ts +4 -0
  8. package/dist/services/claim-balancer/types.d.ts +54 -0
  9. package/dist/services/uniswap/V3Liquidity.d.ts +9 -0
  10. package/dist/services/uniswap/V3Trade.d.ts +4 -0
  11. package/dist/services/uniswap/types.d.ts +3 -0
  12. package/dist/test/constants.d.ts +12 -0
  13. package/dist/test/txOptions.d.ts +1 -0
  14. package/dist/types.d.ts +20 -6
  15. package/dist/utils/contract.d.ts +14 -0
  16. package/dist/utils/index.d.ts +7 -0
  17. package/dist/utils/merkle.d.ts +22 -0
  18. package/dist/v2-sdk.cjs.development.js +6086 -918
  19. package/dist/v2-sdk.cjs.development.js.map +1 -1
  20. package/dist/v2-sdk.cjs.production.min.js +1 -1
  21. package/dist/v2-sdk.cjs.production.min.js.map +1 -1
  22. package/dist/v2-sdk.esm.js +6090 -922
  23. package/dist/v2-sdk.esm.js.map +1 -1
  24. package/package.json +12 -2
  25. package/src/abi/IAaveIncentivesController.json +50 -0
  26. package/src/abi/IBalancerMerkleOrchard.json +353 -0
  27. package/src/abi/IBalancertV2Vault.json +938 -0
  28. package/src/abi/IERC20.json +15 -1
  29. package/src/abi/INonfungiblePositionManager.json +1221 -0
  30. package/src/abi/ISynthetix.json +139 -0
  31. package/src/abi/IUniswapV3Quoter.json +195 -0
  32. package/src/abi/IUniswapV3Router.json +221 -0
  33. package/src/config.ts +48 -8
  34. package/src/entities/dhedge.ts +4 -2
  35. package/src/entities/pool.ts +398 -27
  36. package/src/entities/utils.ts +147 -0
  37. package/src/services/claim-balancer/MultiTokenClaim.json +115 -0
  38. package/src/services/claim-balancer/claim.service.ts +262 -0
  39. package/src/services/claim-balancer/claim.worker.ts +32 -0
  40. package/src/services/claim-balancer/ipfs.service.ts +12 -0
  41. package/src/services/claim-balancer/types.ts +66 -0
  42. package/src/services/uniswap/V3Liquidity.ts +134 -0
  43. package/src/services/uniswap/V3Trade.ts +47 -0
  44. package/src/services/uniswap/types.ts +16 -0
  45. package/src/test/aave.test.ts +73 -0
  46. package/src/test/balancer.test.ts +109 -0
  47. package/src/test/constants.ts +17 -0
  48. package/src/test/oneInch.test.ts +56 -0
  49. package/src/test/pool.test.ts +6 -250
  50. package/src/test/sushi.test.ts +173 -0
  51. package/src/test/synthetix.test.ts +34 -0
  52. package/src/test/txOptions.ts +15 -0
  53. package/src/test/uniswap.test.ts +127 -0
  54. package/src/test/utils.test.ts +41 -26
  55. package/src/test/wallet.ts +5 -1
  56. package/src/types.ts +17 -3
  57. package/src/utils/contract.ts +95 -0
  58. package/src/utils/index.ts +38 -0
  59. package/src/utils/merkle.ts +172 -0
package/README.md CHANGED
@@ -142,17 +142,17 @@ const tx = await pool.approve(
142
142
 
143
143
  ### Trade pool assets
144
144
 
145
- Trade 1 USDC into DAI on Sushiswap
145
+ Trade 1 USDC into DAI on Sushiswap (other options: QUICKSWAP, BALANCER, or ONEINCH)
146
146
 
147
147
  ```
148
148
  const amountIn = "1000000"
149
- const minAmountOut = "997085"
149
+ const slippage = 0.5
150
150
  const tx = await pool.trade(
151
151
  Dapp.SUSHISWAP,
152
152
  "USDC_TOKEN_ADDRESS",
153
153
  "DAI_TOKEN_ADDRESS",
154
154
  amountIn,
155
- minAmountOut
155
+ slippage
156
156
  )
157
157
  ```
158
158
 
@@ -184,6 +184,28 @@ const tx = await pool.removeLiquidity(
184
184
  )
185
185
  ```
186
186
 
187
+ Add 0.00002 WBTC, 1 USDC and 0.0002 WETH to a WBTC/USDC/WETH Balancer pool
188
+
189
+ ```
190
+ const balancerPoolId = "0x03cd191f589d12b0582a99808cf19851e468e6b500010000000000000000000a"
191
+ const assets = [WBTC_TOKEN_ADDRESS, USDC_TOKEN_ADDRESS, WETH_TOKEN_ADDRESS];
192
+ const amounts = ["2000", "1000000", "200000000000000"];
193
+ const tx = await pool.joinBalancerPool(balancerPoolId, assets, amounts)
194
+ ```
195
+
196
+ Remove all tokens from WBTC/USDC/WETH Balancer pool
197
+
198
+ ```
199
+ const amount = await dhedge.utils.getBalance(BALANCER_LP_TOKEN_ADDRESS, pool.address)
200
+ const tx = await pool.exitBalancerPool(balancerPoolId, assets, amount)
201
+ ```
202
+
203
+ Harvest rewards from Balancer
204
+
205
+ ```
206
+ const tx = await pool.harvestBalancerRewards()
207
+ ```
208
+
187
209
  ### Staking
188
210
 
189
211
  Approve unlimited amound of SLP USDC-DAI token for staking on Sushiswap
@@ -226,3 +248,38 @@ const tx = await pool.harvestRewards(
226
248
  "SLP_USDC_DAI_TOKEN_ADDRESS"
227
249
  )
228
250
  ```
251
+
252
+ ### Lending/Borrowing Aave
253
+
254
+ Deposit 1 USDC into Aave lending pool
255
+
256
+ ```
257
+ const tx = await pool.lend(Dapp.AAVE, USDC_TOKEN_ADDRESS, "1000000")
258
+ ```
259
+
260
+ Withdraw 1 USDC from Aave lending pool
261
+
262
+ ```
263
+ const tx = await pool.withdrawDeposit(Dapp.AAVE, USDC_TOKEN_ADDRESS, "1000000")
264
+ ```
265
+
266
+ Borrow 0.0001 WETH from Aave lending pool
267
+
268
+ ```
269
+ const tx = await pool.borrow(Dapp.AAVE, WETH_TOKEN_ADDRESS, "100000000000000");
270
+ ```
271
+
272
+ Repay 0.0001 WETH to Aave lending pool
273
+
274
+ ```
275
+ const tx = await pool.repay(Dapp.AAVE, WETH_TOKEN_ADDRESS, "100000000000000");
276
+ ```
277
+
278
+ Harvest rewards from Aave
279
+
280
+ ```
281
+ const tx = await pool.harvestAaveRewards([
282
+ AAVE_USDC_ADDRESS,
283
+ AAVE_WETH_DEBT_ADDRESS
284
+ ]);
285
+ ```
package/dist/config.d.ts CHANGED
@@ -4,4 +4,11 @@ export declare const factoryAddress: AddressNetworkMap;
4
4
  export declare const routerAddress: AddressDappNetworkMap;
5
5
  export declare const dappFactoryAddress: AddressDappNetworkMap;
6
6
  export declare const stakingAddress: AddressDappNetworkMap;
7
+ export declare const nonfungiblePositionManagerAddress: AddressNetworkMap;
7
8
  export declare const networkChainIdMap: NetworkChainIdMap;
9
+ export declare const balancerSubgraph: AddressNetworkMap;
10
+ export declare const multiCallAddress: AddressNetworkMap;
11
+ export declare const deadline: number;
12
+ export declare const MaxUint128 = "0xffffffffffffffffffffffffffffffff";
13
+ export declare const UNISWAPV3_QUOTER_ADDRESS = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
14
+ export declare const SYNTHETIX_TRACKING_CODE = "0x4448454447450000000000000000000000000000000000000000000000000000";
@@ -1,14 +1,16 @@
1
1
  import { Contract, Wallet, BigNumber } from "ethers";
2
2
  import { Dapp, FundComposition, AssetEnabled, Network } from "../types";
3
3
  import { Utils } from "./utils";
4
+ import { FeeAmount } from "@uniswap/v3-sdk";
4
5
  export declare class Pool {
5
6
  readonly poolLogic: Contract;
6
7
  readonly managerLogic: Contract;
8
+ readonly factory: Contract;
7
9
  readonly signer: Wallet;
8
10
  readonly address: string;
9
11
  readonly utils: Utils;
10
12
  readonly network: Network;
11
- constructor(network: Network, signer: Wallet, poolLogic: Contract, mangerLogic: Contract, utils: Utils);
13
+ constructor(network: Network, signer: Wallet, poolLogic: Contract, mangerLogic: Contract, utils: Utils, factory: Contract);
12
14
  /**
13
15
  * Return the assets with balances and deposit info of a pool
14
16
  * @returns {Promise<FundComposition[]>} Composition of assets with balance, deposit info
@@ -55,13 +57,22 @@ export declare class Pool {
55
57
  * @returns {Promise<any>} Transaction
56
58
  */
57
59
  approveStaking(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any): Promise<any>;
60
+ /**
61
+ * Approve the liquidity pool token for staking
62
+ * @param {Dapp} dapp Platform like Sushiswap or Uniswap
63
+ * @param {string} asset Address of liquidity pool token
64
+ * @param {BigNumber | string} amount Aamount to be approved
65
+ * @param {any} options Transaction options
66
+ * @returns {Promise<any>} Transaction
67
+ */
68
+ approveUniswapV3Liquidity(asset: string, amount: BigNumber | string, options?: any): Promise<any>;
58
69
  /**
59
70
  * Trade an asset into another asset
60
71
  * @param {Dapp} dapp Platform like Sushiswap or Uniswap
61
72
  * @param {string} assetFrom Asset to trade from
62
73
  * @param {string} assetTo Asset to trade into
63
74
  * @param {BigNumber | string} amountIn Amount
64
- * @param {BigNumber | string} minAmountOut Minumum amount to receive
75
+ * @param {number} slippage Slippage tolerance in %
65
76
  * @param {any} options Transaction options
66
77
  * @returns {Promise<any>} Transaction
67
78
  */
@@ -109,11 +120,12 @@ export declare class Pool {
109
120
  * Lend asset to a lending pool
110
121
  * @param {Dapp} dapp Platform like Aave
111
122
  * @param {string} asset Asset
112
- * @param {BigNumber | string} amount Amount of asset to lend
123
+ * @param {BigNumber | string} amount Amount of asset to lend
124
+ * @param {number} referrralCode Code from Aave referral program
113
125
  * @param {any} options Transaction options
114
126
  * @returns {Promise<any>} Transaction
115
127
  */
116
- lend(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any): Promise<any>;
128
+ lend(dapp: Dapp, asset: string, amount: BigNumber | string, referrralCode?: number, options?: any): Promise<any>;
117
129
  /**
118
130
  * Witdraw asset from a lending pool
119
131
  * @param {Dapp} dapp Platform like Aave
@@ -128,10 +140,11 @@ export declare class Pool {
128
140
  * @param {Dapp} dapp Platform like Aave
129
141
  * @param {string} asset Asset
130
142
  * @param {BigNumber | string} amount Amount of asset to lend
143
+ * @param {number} referrralCode Code from Aave referral program
131
144
  * @param {any} options Transaction options
132
145
  * @returns {Promise<any>} Transaction
133
146
  */
134
- borrow(dapp: Dapp, asset: string, amount: BigNumber | string, options?: any): Promise<any>;
147
+ borrow(dapp: Dapp, asset: string, amount: BigNumber | string, referrralCode?: number, options?: any): Promise<any>;
135
148
  /**
136
149
  * Repays borrowed asset to a lending pool
137
150
  * @param {Dapp} dapp Platform like Aave
@@ -163,4 +176,87 @@ export declare class Pool {
163
176
  * @returns {Promise<any>} Transaction
164
177
  */
165
178
  setTrader(trader: string, options?: any): Promise<any>;
179
+ /**
180
+ * Invest into a Balancer pool
181
+ * @param {string} poolId Balancer pool id
182
+ * @param {string[] | } assetsIn Array of balancer pool assets
183
+ * @param {BigNumber[] | string[]} amountsIn Array of maximum amounts to provide to pool
184
+ * @param {any} options Transaction options
185
+ * @returns {Promise<any>} Transaction
186
+ */
187
+ joinBalancerPool(poolId: string, assets: string[], amountsIn: string[] | BigNumber[], options?: any): Promise<any>;
188
+ /**
189
+ * Invest into a Balancer pool
190
+ * @param {string} poolId Balancer pool id
191
+ * @param {string[] | } assets Array of balancer pool assets
192
+ * @param {BigNumber | string } amount Amount of pool tokens to withdraw
193
+ * @param {any} options Transaction options
194
+ * @returns {Promise<any>} Transaction
195
+ */
196
+ exitBalancerPool(poolId: string, assets: string[], amount: string | BigNumber, options?: any): Promise<any>;
197
+ /**
198
+ * Claim rewards from Balancer pools
199
+ * @param {string[]} assets Array of tokens being claimed
200
+ * @param {any} options Transaction options
201
+ * @returns {Promise<any>} Transaction
202
+ */
203
+ harvestBalancerRewards(options?: any): Promise<any>;
204
+ /**
205
+ * Claim rewards from Aave platform
206
+ * @param {string[]} assets Aave tokens (deposit/debt) hold by pool
207
+ * @param {any} options Transaction options
208
+ * @returns {Promise<any>} Transaction
209
+ */
210
+ harvestAaveRewards(assets: string[], options?: any): Promise<any>;
211
+ /**
212
+ * Create UniswapV3 liquidity pool
213
+ * @param {string} assetA First asset
214
+ * @param {string} assetB Second asset
215
+ * @param {BigNumber | string} amountA Amount first asset
216
+ * @param {BigNumber | string} amountB Amount second asset
217
+ * @param { number } minPrice Lower price range (assetB per assetA)
218
+ * @param { number } maxPrice Upper price range (assetB per assetA)
219
+ * @param { number } minTick Lower tick range
220
+ * @param { number } maxTick Upper tick range
221
+ * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
222
+ * @param {any} options Transaction options
223
+ * @returns {Promise<any>} Transaction
224
+ */
225
+ addLiquidityUniswapV3(assetA: string, assetB: string, amountA: BigNumber | string, amountB: BigNumber | string, minPrice: number | null, maxPrice: number | null, minTick: number | null, maxTick: number | null, feeAmount: FeeAmount, options?: any): Promise<any>;
226
+ /**
227
+ * Remove liquidity from an UniswapV3 liquidity pool
228
+ * @param {string} tokenId Token Id of UniswapV3 position
229
+ * @param {number} amount Amount in percent of assets to be removed
230
+ * @param {any} options Transaction options
231
+ * @returns {Promise<any>} Transaction
232
+ */
233
+ removeLiquidityUniswapV3(tokenId: string, amount?: number, options?: any): Promise<any>;
234
+ /**
235
+ * Increase liquidity of an UniswapV3 liquidity pool
236
+ * @param {string} tokenId Token Id of UniswapV3 position
237
+ * @param {BigNumber | string} amountA Amount first asset
238
+ * @param {BigNumber | string} amountB Amount second asset
239
+ * @param {any} options Transaction options
240
+ * @returns {Promise<any>} Transaction
241
+ */
242
+ increaseLiquidityUniswapV3(tokenId: string, amountA: BigNumber | string, amountB: BigNumber | string, options?: any): Promise<any>;
243
+ /**
244
+ * Claim fees of an UniswapV3 liquidity pool
245
+ * @param {string} tokenId Token Id of UniswapV3 position
246
+ * @param {any} options Transaction options
247
+ * @returns {Promise<any>} Transaction
248
+ */
249
+ claimFeesUniswapV3(tokenId: string, options?: any): Promise<any>;
250
+ /**
251
+ * Trade an asset into another asset
252
+ * @param {Dapp} dapp Platform like Sushiswap or Uniswap
253
+ * @param {string} assetFrom Asset to trade from
254
+ * @param {string} assetTo Asset to trade into
255
+ * @param {BigNumber | string} amountIn Amount
256
+ * @param { FeeAmount } feeAmount Fee tier (Low 0.05%, Medium 0.3%, High 1%)
257
+ * @param {number} slippage Slippage tolerance in %
258
+ * @param {any} options Transaction options
259
+ * @returns {Promise<any>} Transaction
260
+ */
261
+ tradeUniswapV3(assetFrom: string, assetTo: string, amountIn: BigNumber | string, feeAmount: FeeAmount, slippage?: number, options?: any): Promise<any>;
166
262
  }
@@ -1,5 +1,6 @@
1
1
  import { ethers, Wallet } from "ethers";
2
2
  import { Dapp, Network, Reserves } from "../types";
3
+ import { Pool } from ".";
3
4
  export declare class Utils {
4
5
  network: Network;
5
6
  signer: Wallet;
@@ -29,6 +30,12 @@ export declare class Utils {
29
30
  * @returns { BigNumber } Balance of asset
30
31
  */
31
32
  getBalance(asset: string, owner: string): Promise<ethers.BigNumber>;
33
+ /**
34
+ * Returns the decimals of an asset (ERC20) token
35
+ * @param {string} asset string token address
36
+ * @returns { number } Balance of asset
37
+ */
38
+ getDecimals(asset: string): Promise<number>;
32
39
  /**
33
40
  * Return the minimum amount out for a trade between two assets
34
41
  * given the trade amount and slippage
@@ -40,4 +47,7 @@ export declare class Utils {
40
47
  * @returns {Promise<ethers.BigNumber>} Reserves of the assets in BigNumber
41
48
  */
42
49
  getMinAmountOut(dapp: Dapp, assetFrom: string, assetTo: string, amountIn: string | ethers.BigNumber, slippage: number): Promise<ethers.BigNumber>;
50
+ getBalancerSwapTx(pool: Pool, assetFrom: string, assetTo: string, amountIn: ethers.BigNumber | string, slippage: number): Promise<any>;
51
+ getBalancerJoinPoolTx(pool: Pool, balancerPoolId: string, assets: string[], amountsIn: string[] | ethers.BigNumber[]): Promise<any>;
52
+ getBalancerExitPoolTx(pool: Pool, balancerPoolId: string, assets: string[], amount: string | ethers.BigNumber): Promise<any>;
43
53
  }
@@ -0,0 +1,17 @@
1
+ import { ethers, Wallet } from "ethers";
2
+ import { MultiTokenPendingClaims, TokenClaimInfo } from "./types";
3
+ import { Network } from "../../types";
4
+ export declare class ClaimService {
5
+ network: Network;
6
+ signer: ethers.Wallet;
7
+ constructor(network: Network, signer: Wallet);
8
+ getMultiTokensPendingClaims(account: string): Promise<MultiTokenPendingClaims[]>;
9
+ getTokenPendingClaims(tokenClaimInfo: TokenClaimInfo, account: string): Promise<MultiTokenPendingClaims>;
10
+ multiTokenClaimRewards(account: string, multiTokenPendingClaims: MultiTokenPendingClaims[]): Promise<any>;
11
+ private computeClaimProofs;
12
+ private computeClaimProof;
13
+ private getTokenClaimsInfo;
14
+ private getSnapshot;
15
+ private getClaimStatus;
16
+ private getReports;
17
+ }
@@ -0,0 +1,4 @@
1
+ import { ComputeClaimProofPayload } from "./types";
2
+ export declare class ClaimWorker {
3
+ calcClaimProof(payload: ComputeClaimProofPayload): any;
4
+ }
@@ -0,0 +1,4 @@
1
+ export default class IpfsService {
2
+ get<T>(hash: string, protocol?: string): Promise<T>;
3
+ }
4
+ export declare const ipfsService: IpfsService;
@@ -0,0 +1,54 @@
1
+ export interface Claim {
2
+ id: string;
3
+ amount: string;
4
+ }
5
+ export declare type Snapshot = Record<number, string>;
6
+ export declare type TokenClaimInfo = {
7
+ label: string;
8
+ distributor: string;
9
+ token: string;
10
+ decimals: number;
11
+ manifest: string;
12
+ weekStart: number;
13
+ };
14
+ export declare type MultiTokenPendingClaims = {
15
+ claims: Claim[];
16
+ reports: Report;
17
+ tokenClaimInfo: TokenClaimInfo;
18
+ availableToClaim: string;
19
+ };
20
+ export declare type ClaimStatus = boolean;
21
+ export declare type Report = Record<string, any>;
22
+ export declare type MultiTokenCurrentRewardsEstimateResponse = {
23
+ success: boolean;
24
+ result: {
25
+ current_timestamp: string;
26
+ "liquidity-providers": Array<{
27
+ snapshot_timestamp: string;
28
+ address: string;
29
+ token_address: string;
30
+ chain_id: number;
31
+ current_estimate: string;
32
+ velocity: string;
33
+ week: number;
34
+ }>;
35
+ };
36
+ };
37
+ export declare type MultiTokenCurrentRewardsEstimate = {
38
+ rewards: string;
39
+ velocity: string;
40
+ token: string;
41
+ };
42
+ export declare type ClaimProofTuple = [number, string, string, number, string[]];
43
+ export declare type ComputeClaimProofPayload = {
44
+ report: Report;
45
+ account: string;
46
+ claim: Claim;
47
+ distributor: string;
48
+ tokenIndex: number;
49
+ decimals: number;
50
+ };
51
+ export declare type ClaimWorkerMessage<P = any> = {
52
+ type: "computeClaimProof";
53
+ payload: P;
54
+ };
@@ -0,0 +1,9 @@
1
+ import { Price, Token } from "@uniswap/sdk-core";
2
+ import { FeeAmount } from "@uniswap/v3-sdk";
3
+ import { ethers } from "ethers";
4
+ import { Pool } from "../..";
5
+ import { UniswapV3MintParams } from "./types";
6
+ export declare function tryParsePrice(baseToken: Token, quoteToken: Token, value: string): Price<Token, Token>;
7
+ export declare function tryParseTick(baseToken: Token, quoteToken: Token, feeAmount: FeeAmount, value: string): number;
8
+ export declare function getUniswapV3MintParams(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, feeAmount: FeeAmount): Promise<UniswapV3MintParams>;
9
+ export declare function getUniswapV3Liquidity(tokenId: string, pool: Pool): Promise<ethers.BigNumber>;
@@ -0,0 +1,4 @@
1
+ import { FeeAmount } from "@uniswap/v3-sdk";
2
+ import { ethers } from "ethers";
3
+ import { Pool } from "../..";
4
+ export declare function getUniswapV3SwapTxData(pool: Pool, assetA: string, assetB: string, amountIn: string | ethers.BigNumber, slippage: number, feeAmount: FeeAmount): Promise<any>;
@@ -0,0 +1,3 @@
1
+ import { FeeAmount } from "@uniswap/v3-sdk";
2
+ import { ethers } from "ethers";
3
+ export declare type UniswapV3MintParams = [string, string, FeeAmount, number, number, ethers.BigNumber | string, ethers.BigNumber | string, ethers.BigNumber | string, ethers.BigNumber | string, string, number];
@@ -0,0 +1,12 @@
1
+ export declare const USDC = "0x7F5c764cBc14f9669B88837ca1490cCa17c31607";
2
+ export declare const USDT = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F";
3
+ export declare const DAI = "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063";
4
+ export declare const TUSD = "0x2e1ad108ff1d8c782fcbbb89aad783ac49586756";
5
+ export declare const WETH = "0x4200000000000000000000000000000000000006";
6
+ export declare const WBTC = "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6";
7
+ export declare const SUSHI = "0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a";
8
+ export declare const WMATIC = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270";
9
+ export declare const BAL = "0x9a71012B13CA4d3D0Cdc72A177DF3ef03b0E76A3";
10
+ export declare const AMUSDC = "0x1a13f4ca1d028320a707d99520abfefca3998b7f";
11
+ export declare const VDEBTWETH = "0xede17e9d79fc6f9ff9250d9eefbdb88cc18038b5";
12
+ export declare const TEST_POOL = "0xf36f550907872faaa02477f791df3ce33fe38854";
@@ -0,0 +1 @@
1
+ export declare const getTxOptions: () => Promise<any>;
package/dist/types.d.ts CHANGED
@@ -1,24 +1,35 @@
1
- import { ChainId } from "@sushiswap/sdk";
2
1
  import { BigNumber } from "ethers";
3
2
  export declare enum Network {
4
- POLYGON = "polygon"
3
+ POLYGON = "polygon",
4
+ OPTIMISM = "optimism"
5
5
  }
6
6
  export declare enum Dapp {
7
7
  SUSHISWAP = "sushiswap",
8
8
  AAVE = "aave",
9
9
  ONEINCH = "1inch",
10
- QUICKSWAP = "quickswap"
10
+ QUICKSWAP = "quickswap",
11
+ BALANCER = "balancer",
12
+ UNISWAPV3 = "uniswapV3",
13
+ SYNTHETIX = "synthetix"
11
14
  }
12
15
  export declare enum Transaction {
13
16
  SWAP = "swapExactTokensForTokens",
14
17
  ADD_LIQUIDITY = "addLiquidity",
15
18
  DEPOSIT = "deposit",
16
19
  HARVEST = "harvest",
17
- UNSTAKE = "withdrawAndHarvest",
20
+ CLAIM_DISTRIBIUTIONS = "claimDistributions",
21
+ CLAIM_REWARDS = "claimRewards",
18
22
  REMOVE_LIQUIDITY = "removeLiquidity",
23
+ DECREASE_LIQUIDITY = "decreaseLiquidity",
24
+ INCREASE_LIQUIDITY = "increaseLiquidity",
25
+ COLLECT = "collect",
26
+ MULTI_CALL = "multicall",
19
27
  BORROW = "borrow",
20
28
  REPAY = "repay",
21
- WITHDRAW = "withdraw"
29
+ WITHDRAW = "withdraw",
30
+ MINT = "mint",
31
+ BURN = "burn",
32
+ SWAP_SYNTHS = "exchangeWithTracking"
22
33
  }
23
34
  export declare type AddressNetworkMap = Readonly<Record<Network, string>>;
24
35
  export declare type AddressDappMap = {
@@ -26,6 +37,9 @@ export declare type AddressDappMap = {
26
37
  [Dapp.AAVE]?: string;
27
38
  [Dapp.ONEINCH]?: string;
28
39
  [Dapp.QUICKSWAP]?: string;
40
+ [Dapp.BALANCER]?: string;
41
+ [Dapp.UNISWAPV3]?: string;
42
+ [Dapp.SYNTHETIX]?: string;
29
43
  };
30
44
  export declare type AddressDappNetworkMap = Readonly<Record<Network, AddressDappMap>>;
31
45
  export declare type SupportedAsset = [string, boolean];
@@ -43,4 +57,4 @@ export declare type Reserves = {
43
57
  assetA: BigNumber;
44
58
  assetB: BigNumber;
45
59
  };
46
- export declare type NetworkChainIdMap = Readonly<Record<Network, ChainId>>;
60
+ export declare type NetworkChainIdMap = Readonly<Record<Network, number>>;
@@ -0,0 +1,14 @@
1
+ import { ethers, Network } from "..";
2
+ export declare function call(provider: ethers.Signer, abi: any[], call: any[], options?: any): Promise<any>;
3
+ export declare function multicall<T>(network: Network, provider: ethers.Signer, abi: any[], calls: any[], options?: any, requireSuccess?: boolean): Promise<(T | null)[]>;
4
+ export declare class Multicaller {
5
+ network: Network;
6
+ provider: ethers.Signer;
7
+ abi: any[];
8
+ options: any;
9
+ calls: any[];
10
+ paths: any[];
11
+ constructor(network: Network, provider: ethers.Signer, abi: any[]);
12
+ call(path: any, address: any, fn: any, params?: any): Multicaller;
13
+ execute(from?: any): Promise<any>;
14
+ }
@@ -0,0 +1,7 @@
1
+ import BigNumber from "bignumber.js";
2
+ import { MerkleTree } from "./merkle";
3
+ export declare function scale(input: BigNumber | string, decimalPlaces: number): BigNumber;
4
+ export declare function loadTree(balances: {
5
+ [x: string]: string | BigNumber;
6
+ }, decimals?: number): MerkleTree;
7
+ export declare function bnum(val: string | number | BigNumber): BigNumber;
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" />
2
+ import BigNumber from "bignumber.js";
3
+ export declare class MerkleTree {
4
+ elements: any;
5
+ layers: any;
6
+ constructor(elements: any[]);
7
+ getLayers(elements: string | any[]): (string | any[])[];
8
+ getNextLayer(elements: any[]): any[];
9
+ combinedHash(first: any, second: any): any;
10
+ getRoot(): any;
11
+ getHexRoot(): string;
12
+ getProof(el: any): any;
13
+ getHexProof(_el: any): string[];
14
+ getPairElement(idx: number, layer: string | any[]): any;
15
+ bufIndexOf(el: string | any[], arr: string | any[]): number;
16
+ bufDedup(elements: any[]): any[];
17
+ bufArrToHexArr(arr: any[]): string[];
18
+ sortAndConcat(...args: any[]): Buffer;
19
+ }
20
+ export declare function loadTree(balances: {
21
+ [x: string]: string | BigNumber;
22
+ }, decimals?: number): MerkleTree;