@defisaver/positions-sdk 0.0.148 → 0.0.150

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 (67) hide show
  1. package/.mocharc.json +4 -0
  2. package/.nvmrc +1 -0
  3. package/README.md +69 -63
  4. package/cjs/aaveV3/index.js +10 -3
  5. package/cjs/markets/compound/marketsAssets.js +3 -3
  6. package/cjs/moneymarket/moneymarketCommonService.js +5 -1
  7. package/esm/aaveV3/index.js +10 -3
  8. package/esm/markets/compound/marketsAssets.js +3 -3
  9. package/esm/moneymarket/moneymarketCommonService.js +5 -1
  10. package/package.json +44 -42
  11. package/src/aaveV2/index.ts +227 -227
  12. package/src/aaveV3/index.ts +590 -585
  13. package/src/assets/index.ts +60 -60
  14. package/src/chickenBonds/index.ts +123 -123
  15. package/src/compoundV2/index.ts +219 -219
  16. package/src/compoundV3/index.ts +281 -281
  17. package/src/config/contracts.js +1034 -1034
  18. package/src/constants/index.ts +6 -6
  19. package/src/contracts.ts +128 -128
  20. package/src/curveUsd/index.ts +229 -229
  21. package/src/exchange/index.ts +17 -17
  22. package/src/helpers/aaveHelpers/index.ts +194 -194
  23. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  24. package/src/helpers/compoundHelpers/index.ts +246 -246
  25. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  26. package/src/helpers/index.ts +7 -7
  27. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  28. package/src/helpers/makerHelpers/index.ts +94 -94
  29. package/src/helpers/morphoBlueHelpers/index.ts +115 -115
  30. package/src/helpers/sparkHelpers/index.ts +150 -150
  31. package/src/index.ts +46 -46
  32. package/src/liquity/index.ts +116 -116
  33. package/src/llamaLend/index.ts +275 -275
  34. package/src/maker/index.ts +117 -117
  35. package/src/markets/aave/index.ts +152 -152
  36. package/src/markets/aave/marketAssets.ts +46 -46
  37. package/src/markets/compound/index.ts +173 -173
  38. package/src/markets/compound/marketsAssets.ts +64 -64
  39. package/src/markets/curveUsd/index.ts +69 -69
  40. package/src/markets/index.ts +21 -21
  41. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  42. package/src/markets/llamaLend/index.ts +235 -235
  43. package/src/markets/morphoBlue/index.ts +691 -691
  44. package/src/markets/spark/index.ts +29 -29
  45. package/src/markets/spark/marketAssets.ts +10 -10
  46. package/src/moneymarket/moneymarketCommonService.ts +80 -76
  47. package/src/morphoAaveV2/index.ts +256 -256
  48. package/src/morphoAaveV3/index.ts +630 -630
  49. package/src/morphoBlue/index.ts +171 -171
  50. package/src/multicall/index.ts +22 -22
  51. package/src/services/dsrService.ts +15 -15
  52. package/src/services/priceService.ts +21 -21
  53. package/src/services/utils.ts +54 -54
  54. package/src/setup.ts +8 -8
  55. package/src/spark/index.ts +424 -424
  56. package/src/staking/staking.ts +189 -189
  57. package/src/types/aave.ts +262 -262
  58. package/src/types/chickenBonds.ts +45 -45
  59. package/src/types/common.ts +84 -84
  60. package/src/types/compound.ts +129 -129
  61. package/src/types/curveUsd.ts +118 -118
  62. package/src/types/index.ts +8 -8
  63. package/src/types/liquity.ts +30 -30
  64. package/src/types/llamaLend.ts +155 -155
  65. package/src/types/maker.ts +50 -50
  66. package/src/types/morphoBlue.ts +144 -144
  67. package/src/types/spark.ts +127 -127
package/.mocharc.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "require": "ts-node/register",
3
+ "extension": ["ts"]
4
+ }
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v20.17.0
package/README.md CHANGED
@@ -1,63 +1,69 @@
1
- # DeFi Saver Positions SDK
2
-
3
- Supported protocols:
4
- - [Maker](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/maker)
5
- - [Spark](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/spark)
6
- - [CrvUSD](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/curveUsd)
7
- - [Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV2)
8
- - [Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV3)
9
- - [Morpho Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV2)
10
- - [Morpho Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV3)
11
- - [Compound V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV2)
12
- - [Compound V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV3)
13
- - [Liquity](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/liquity)
14
- - [Chicken Bonds](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/chickenBonds)
15
-
16
- ## Setup
17
- Supported Node version is v10.
18
-
19
- - run `npm install` (first time)
20
- - run `npm run build`
21
-
22
- `build` command will generate contracts and build ejs and esm folders
23
-
24
- ## How to use
25
- [All available imports](https://github.com/defisaver/defisaver-positions-sdk/blob/main/src/index.ts)
26
-
27
- This is a Compound V3 example, and every other protocol is similar
28
- ```js
29
- import Web3 from 'web3';
30
- import { compoundV3 } from '@defisaver/positions-sdk';
31
-
32
-
33
- // every protocol has market data and user data getters
34
- const {
35
- getCompoundV3MarketsData,
36
- getCompoundV3AccountData,
37
- } = compoundV3;
38
-
39
- const provider = 'Your RPC provider';
40
- const web3 = new Web3(provider);
41
-
42
- const user = '0x123...';
43
-
44
- const { assetsData } = await getCompoundV3MarketsData(
45
- web3, // rpc for the network you are using (note: can be tenderly or any other testnet rpc)
46
- 1, // network
47
- selectedMarket, // market object like in /src/markets/compound/index.ts
48
- web3, // this must be mainnet rpc - used for getting prices onchain and calculating apys
49
- );
50
-
51
- const userData = await getCompoundV3AccountData(
52
- web3,
53
- 1, // network
54
- userAddress, // EOA or DSProxy
55
- '', // proxy address of the user, or just empty string if checking for EOA
56
- {
57
- selectedMarket, // market object as in /src/markets/compound/index.ts
58
- assetsData,
59
- }
60
- );
61
- ```
62
-
63
- More examples found [here](https://github.com/defisaver/defisaver-positions-sdk/tree/main/tests)
1
+ # DeFi Saver Positions SDK
2
+
3
+ Supported protocols:
4
+ - [Maker](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/maker)
5
+ - [Spark](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/spark)
6
+ - [CrvUSD](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/curveUsd)
7
+ - [Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV2)
8
+ - [Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV3)
9
+ - [Morpho Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV2)
10
+ - [Morpho Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV3)
11
+ - [Compound V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV2)
12
+ - [Compound V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV3)
13
+ - [Liquity](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/liquity)
14
+ - [Chicken Bonds](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/chickenBonds)
15
+
16
+ ## Setup
17
+ Supported Node version is v10.
18
+
19
+ - run `npm install` (first time)
20
+ - run `npm run build`
21
+
22
+ `build` command will generate contracts and build ejs and esm folders
23
+
24
+ ## How to use
25
+ [All available imports](https://github.com/defisaver/defisaver-positions-sdk/blob/main/src/index.ts)
26
+
27
+ This is a Compound V3 example, and every other protocol is similar
28
+ ```js
29
+ import Web3 from 'web3';
30
+ import { compoundV3 } from '@defisaver/positions-sdk';
31
+
32
+
33
+ // every protocol has market data and user data getters
34
+ const {
35
+ getCompoundV3MarketsData,
36
+ getCompoundV3AccountData,
37
+ } = compoundV3;
38
+
39
+ const provider = 'Your RPC provider';
40
+ const web3 = new Web3(provider);
41
+
42
+ const user = '0x123...';
43
+
44
+ const { assetsData } = await getCompoundV3MarketsData(
45
+ web3, // rpc for the network you are using (note: can be tenderly or any other testnet rpc)
46
+ 1, // network
47
+ selectedMarket, // market object like in /src/markets/compound/index.ts
48
+ web3, // this must be mainnet rpc - used for getting prices onchain and calculating apys
49
+ );
50
+
51
+ const userData = await getCompoundV3AccountData(
52
+ web3,
53
+ 1, // network
54
+ userAddress, // EOA or DSProxy
55
+ '', // proxy address of the user, or just empty string if checking for EOA
56
+ {
57
+ selectedMarket, // market object as in /src/markets/compound/index.ts
58
+ assetsData,
59
+ }
60
+ );
61
+ ```
62
+
63
+ More examples found [here](https://github.com/defisaver/defisaver-positions-sdk/tree/main/tests)
64
+
65
+ ## Testing
66
+
67
+ `npm run test` - Run all tests
68
+
69
+ `npm run test-single --name=your_test_name` - Run single test for specified name e.g. for MyTest.js test name is MyTest
@@ -187,7 +187,8 @@ function getAaveV3MarketData(web3, network, market, defaultWeb3) {
187
187
  yield Promise.all(assetsData.map((_market) => __awaiter(this, void 0, void 0, function* () {
188
188
  /* eslint-disable no-param-reassign */
189
189
  const rewardForMarket = rewardInfo === null || rewardInfo === void 0 ? void 0 : rewardInfo[_market.underlyingTokenAddress];
190
- if (staking_1.STAKING_ASSETS.includes(_market.symbol)) {
190
+ const isStakingAsset = staking_1.STAKING_ASSETS.includes(_market.symbol);
191
+ if (isStakingAsset) {
191
192
  _market.incentiveSupplyApy = yield (0, staking_1.getStakingApy)(_market.symbol, defaultWeb3);
192
193
  _market.incentiveSupplyToken = _market.symbol;
193
194
  }
@@ -199,6 +200,8 @@ function getAaveV3MarketData(web3, network, market, defaultWeb3) {
199
200
  return;
200
201
  const supplyRewardData = rewardForMarket.aIncentiveData.rewardsTokenInformation[0];
201
202
  if (supplyRewardData) {
203
+ if (isStakingAsset && _market.incentiveSupplyToken !== supplyRewardData.rewardTokenSymbol)
204
+ return;
202
205
  if (+supplyRewardData.emissionEndTimestamp * 1000 < Date.now())
203
206
  return;
204
207
  _market.incentiveSupplyToken = supplyRewardData.rewardTokenSymbol;
@@ -207,15 +210,18 @@ function getAaveV3MarketData(web3, network, market, defaultWeb3) {
207
210
  _market.incentiveSupplyToken = _market.symbol;
208
211
  const supplyEmissionPerSecond = supplyRewardData.emissionPerSecond;
209
212
  const supplyRewardPrice = new decimal_js_1.default(supplyRewardData.rewardPriceFeed).div(Math.pow(10, +supplyRewardData.priceFeedDecimals)).toString();
210
- _market.incentiveSupplyApy = new decimal_js_1.default(supplyEmissionPerSecond).div((Math.pow(10, +supplyRewardData.rewardTokenDecimals)) / 100)
213
+ const rewardApy = new decimal_js_1.default(supplyEmissionPerSecond).div((Math.pow(10, +supplyRewardData.rewardTokenDecimals)) / 100)
211
214
  .mul(365 * 24 * 3600)
212
215
  .mul(supplyRewardPrice)
213
216
  .div(_market.price)
214
217
  .div(_market.totalSupply)
215
218
  .toString();
219
+ _market.incentiveSupplyApy = new decimal_js_1.default(_market.incentiveSupplyApy || '0').add(rewardApy).toString();
216
220
  }
217
221
  const borrowRewardData = rewardForMarket.vIncentiveData.rewardsTokenInformation[0];
218
222
  if (borrowRewardData) {
223
+ if (isStakingAsset && _market.incentiveSupplyToken !== borrowRewardData.rewardTokenSymbol)
224
+ return;
219
225
  if (+borrowRewardData.emissionEndTimestamp * 1000 < Date.now())
220
226
  return;
221
227
  _market.incentiveBorrowToken = borrowRewardData.rewardTokenSymbol;
@@ -223,12 +229,13 @@ function getAaveV3MarketData(web3, network, market, defaultWeb3) {
223
229
  _market.incentiveBorrowToken = _market.symbol;
224
230
  const supplyEmissionPerSecond = borrowRewardData.emissionPerSecond;
225
231
  const supplyRewardPrice = new decimal_js_1.default(borrowRewardData.rewardPriceFeed).div(Math.pow(10, +borrowRewardData.priceFeedDecimals)).toString();
226
- _market.incentiveBorrowApy = new decimal_js_1.default(supplyEmissionPerSecond).div((Math.pow(10, +borrowRewardData.rewardTokenDecimals)) / 100)
232
+ const rewardApy = new decimal_js_1.default(supplyEmissionPerSecond).div((Math.pow(10, +borrowRewardData.rewardTokenDecimals)) / 100)
227
233
  .mul(365 * 24 * 3600)
228
234
  .mul(supplyRewardPrice)
229
235
  .div(_market.price)
230
236
  .div(_market.totalBorrowVar)
231
237
  .toString();
238
+ _market.incentiveBorrowApy = new decimal_js_1.default(_market.incentiveSupplyApy || '0').add(rewardApy).toString();
232
239
  }
233
240
  /* eslint-enable no-param-reassign */
234
241
  })));
@@ -7,7 +7,7 @@ exports.compoundV2CollateralAssets = [
7
7
  'cETH', 'cDAI', 'cBAT', 'cZRX', 'cUSDC', 'cWBTC Legacy', 'cWBTC', 'cUSDT',
8
8
  'cTUSD', 'cLINK', 'cUSDP', 'cUNI', 'cCOMP', 'cMKR', 'cSUSHI', 'cAAVE', 'cYFI',
9
9
  ].map((symbol) => (0, tokens_1.getAssetInfo)(symbol));
10
- exports.v3USDCCollAssetsEth = ['COMP', 'WBTC', 'ETH', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'rswETH'];
10
+ exports.v3USDCCollAssetsEth = ['COMP', 'WBTC', 'ETH', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC'];
11
11
  exports.v3USDCCollAssetsArb = ['ARB', 'ETH', 'GMX', 'WBTC', 'wstETH', 'ezETH'];
12
12
  exports.v3USDCCollAssetsBase = ['ETH', 'cbETH', 'wstETH', 'cbBTC'];
13
13
  exports.v3USDCCollAssetsOpt = ['ETH', 'OP', 'WBTC', 'wstETH'];
@@ -26,7 +26,7 @@ exports.v3USDCeCollAssets = {
26
26
  [common_1.NetworkNumber.Arb]: exports.v3USDCeCollAssetsArb,
27
27
  [common_1.NetworkNumber.Base]: [],
28
28
  };
29
- exports.v3ETHCollAssetsEth = ['cbETH', 'wstETH', 'rETH', 'rsETH', 'weETH', 'osETH', 'WBTC', 'ezETH', 'cbBTC', 'rswETH'];
29
+ exports.v3ETHCollAssetsEth = ['cbETH', 'wstETH', 'rETH', 'rsETH', 'weETH', 'osETH', 'WBTC', 'ezETH', 'cbBTC', 'rswETH', 'tBTC'];
30
30
  exports.v3ETHCollAssetsBase = ['cbETH', 'ezETH', 'wstETH', 'USDC', 'weETH', 'wrsETH', 'cbBTC'];
31
31
  exports.v3ETHCollAssetsArb = ['weETH', 'rETH', 'wstETH', 'WBTC', 'rsETH', 'ezETH', 'USDC', 'USDT'];
32
32
  exports.v3ETHCollAssetsOpt = ['rETH', 'wstETH', 'WBTC', 'ezETH', 'USDC', 'USDT', 'weETH', 'wrsETH'];
@@ -45,7 +45,7 @@ exports.v3USDbCCollAssets = {
45
45
  [common_1.NetworkNumber.Arb]: [],
46
46
  [common_1.NetworkNumber.Base]: exports.v3USDbCCollAssetsBase,
47
47
  };
48
- exports.v3USDTCollAssetsEth = ['ETH', 'WBTC', 'wstETH', 'COMP', 'UNI', 'LINK', 'cbBTC'];
48
+ exports.v3USDTCollAssetsEth = ['COMP', 'ETH', 'WBTC', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC'];
49
49
  exports.v3USDTCollAssetsArb = ['ETH', 'WBTC', 'wstETH', 'ARB', 'GMX'];
50
50
  exports.v3USDTCollAssetsOpt = ['ETH', 'WBTC', 'OP', 'wstETH'];
51
51
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
@@ -79,5 +79,9 @@ const isLeveragedPos = (usedAssets, dustLimit = 5) => {
79
79
  };
80
80
  };
81
81
  exports.isLeveragedPos = isLeveragedPos;
82
- const aprToApy = (interest, frequency = constants_1.BLOCKS_IN_A_YEAR) => new decimal_js_1.default(interest).div(100).div(frequency).plus(1).pow(frequency).minus(1).times(100).toString();
82
+ const aprToApy = (interest, frequency = constants_1.BLOCKS_IN_A_YEAR) => new decimal_js_1.default(interest).div(100).div(frequency).plus(1)
83
+ .pow(frequency)
84
+ .minus(1)
85
+ .times(100)
86
+ .toString();
83
87
  exports.aprToApy = aprToApy;
@@ -178,7 +178,8 @@ export function getAaveV3MarketData(web3, network, market, defaultWeb3) {
178
178
  yield Promise.all(assetsData.map((_market) => __awaiter(this, void 0, void 0, function* () {
179
179
  /* eslint-disable no-param-reassign */
180
180
  const rewardForMarket = rewardInfo === null || rewardInfo === void 0 ? void 0 : rewardInfo[_market.underlyingTokenAddress];
181
- if (STAKING_ASSETS.includes(_market.symbol)) {
181
+ const isStakingAsset = STAKING_ASSETS.includes(_market.symbol);
182
+ if (isStakingAsset) {
182
183
  _market.incentiveSupplyApy = yield getStakingApy(_market.symbol, defaultWeb3);
183
184
  _market.incentiveSupplyToken = _market.symbol;
184
185
  }
@@ -190,6 +191,8 @@ export function getAaveV3MarketData(web3, network, market, defaultWeb3) {
190
191
  return;
191
192
  const supplyRewardData = rewardForMarket.aIncentiveData.rewardsTokenInformation[0];
192
193
  if (supplyRewardData) {
194
+ if (isStakingAsset && _market.incentiveSupplyToken !== supplyRewardData.rewardTokenSymbol)
195
+ return;
193
196
  if (+supplyRewardData.emissionEndTimestamp * 1000 < Date.now())
194
197
  return;
195
198
  _market.incentiveSupplyToken = supplyRewardData.rewardTokenSymbol;
@@ -198,15 +201,18 @@ export function getAaveV3MarketData(web3, network, market, defaultWeb3) {
198
201
  _market.incentiveSupplyToken = _market.symbol;
199
202
  const supplyEmissionPerSecond = supplyRewardData.emissionPerSecond;
200
203
  const supplyRewardPrice = new Dec(supplyRewardData.rewardPriceFeed).div(Math.pow(10, +supplyRewardData.priceFeedDecimals)).toString();
201
- _market.incentiveSupplyApy = new Dec(supplyEmissionPerSecond).div((Math.pow(10, +supplyRewardData.rewardTokenDecimals)) / 100)
204
+ const rewardApy = new Dec(supplyEmissionPerSecond).div((Math.pow(10, +supplyRewardData.rewardTokenDecimals)) / 100)
202
205
  .mul(365 * 24 * 3600)
203
206
  .mul(supplyRewardPrice)
204
207
  .div(_market.price)
205
208
  .div(_market.totalSupply)
206
209
  .toString();
210
+ _market.incentiveSupplyApy = new Dec(_market.incentiveSupplyApy || '0').add(rewardApy).toString();
207
211
  }
208
212
  const borrowRewardData = rewardForMarket.vIncentiveData.rewardsTokenInformation[0];
209
213
  if (borrowRewardData) {
214
+ if (isStakingAsset && _market.incentiveSupplyToken !== borrowRewardData.rewardTokenSymbol)
215
+ return;
210
216
  if (+borrowRewardData.emissionEndTimestamp * 1000 < Date.now())
211
217
  return;
212
218
  _market.incentiveBorrowToken = borrowRewardData.rewardTokenSymbol;
@@ -214,12 +220,13 @@ export function getAaveV3MarketData(web3, network, market, defaultWeb3) {
214
220
  _market.incentiveBorrowToken = _market.symbol;
215
221
  const supplyEmissionPerSecond = borrowRewardData.emissionPerSecond;
216
222
  const supplyRewardPrice = new Dec(borrowRewardData.rewardPriceFeed).div(Math.pow(10, +borrowRewardData.priceFeedDecimals)).toString();
217
- _market.incentiveBorrowApy = new Dec(supplyEmissionPerSecond).div((Math.pow(10, +borrowRewardData.rewardTokenDecimals)) / 100)
223
+ const rewardApy = new Dec(supplyEmissionPerSecond).div((Math.pow(10, +borrowRewardData.rewardTokenDecimals)) / 100)
218
224
  .mul(365 * 24 * 3600)
219
225
  .mul(supplyRewardPrice)
220
226
  .div(_market.price)
221
227
  .div(_market.totalBorrowVar)
222
228
  .toString();
229
+ _market.incentiveBorrowApy = new Dec(_market.incentiveSupplyApy || '0').add(rewardApy).toString();
223
230
  }
224
231
  /* eslint-enable no-param-reassign */
225
232
  })));
@@ -4,7 +4,7 @@ export const compoundV2CollateralAssets = [
4
4
  'cETH', 'cDAI', 'cBAT', 'cZRX', 'cUSDC', 'cWBTC Legacy', 'cWBTC', 'cUSDT',
5
5
  'cTUSD', 'cLINK', 'cUSDP', 'cUNI', 'cCOMP', 'cMKR', 'cSUSHI', 'cAAVE', 'cYFI',
6
6
  ].map((symbol) => getAssetInfo(symbol));
7
- export const v3USDCCollAssetsEth = ['COMP', 'WBTC', 'ETH', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'rswETH'];
7
+ export const v3USDCCollAssetsEth = ['COMP', 'WBTC', 'ETH', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC'];
8
8
  export const v3USDCCollAssetsArb = ['ARB', 'ETH', 'GMX', 'WBTC', 'wstETH', 'ezETH'];
9
9
  export const v3USDCCollAssetsBase = ['ETH', 'cbETH', 'wstETH', 'cbBTC'];
10
10
  export const v3USDCCollAssetsOpt = ['ETH', 'OP', 'WBTC', 'wstETH'];
@@ -23,7 +23,7 @@ export const v3USDCeCollAssets = {
23
23
  [NetworkNumber.Arb]: v3USDCeCollAssetsArb,
24
24
  [NetworkNumber.Base]: [],
25
25
  };
26
- export const v3ETHCollAssetsEth = ['cbETH', 'wstETH', 'rETH', 'rsETH', 'weETH', 'osETH', 'WBTC', 'ezETH', 'cbBTC', 'rswETH'];
26
+ export const v3ETHCollAssetsEth = ['cbETH', 'wstETH', 'rETH', 'rsETH', 'weETH', 'osETH', 'WBTC', 'ezETH', 'cbBTC', 'rswETH', 'tBTC'];
27
27
  export const v3ETHCollAssetsBase = ['cbETH', 'ezETH', 'wstETH', 'USDC', 'weETH', 'wrsETH', 'cbBTC'];
28
28
  export const v3ETHCollAssetsArb = ['weETH', 'rETH', 'wstETH', 'WBTC', 'rsETH', 'ezETH', 'USDC', 'USDT'];
29
29
  export const v3ETHCollAssetsOpt = ['rETH', 'wstETH', 'WBTC', 'ezETH', 'USDC', 'USDT', 'weETH', 'wrsETH'];
@@ -42,7 +42,7 @@ export const v3USDbCCollAssets = {
42
42
  [NetworkNumber.Arb]: [],
43
43
  [NetworkNumber.Base]: v3USDbCCollAssetsBase,
44
44
  };
45
- export const v3USDTCollAssetsEth = ['ETH', 'WBTC', 'wstETH', 'COMP', 'UNI', 'LINK', 'cbBTC'];
45
+ export const v3USDTCollAssetsEth = ['COMP', 'ETH', 'WBTC', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC'];
46
46
  export const v3USDTCollAssetsArb = ['ETH', 'WBTC', 'wstETH', 'ARB', 'GMX'];
47
47
  export const v3USDTCollAssetsOpt = ['ETH', 'WBTC', 'OP', 'wstETH'];
48
48
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
@@ -67,4 +67,8 @@ export const isLeveragedPos = (usedAssets, dustLimit = 5) => {
67
67
  leveragedAsset: '',
68
68
  };
69
69
  };
70
- export const aprToApy = (interest, frequency = BLOCKS_IN_A_YEAR) => new Dec(interest).div(100).div(frequency).plus(1).pow(frequency).minus(1).times(100).toString();
70
+ export const aprToApy = (interest, frequency = BLOCKS_IN_A_YEAR) => new Dec(interest).div(100).div(frequency).plus(1)
71
+ .pow(frequency)
72
+ .minus(1)
73
+ .times(100)
74
+ .toString();
package/package.json CHANGED
@@ -1,42 +1,44 @@
1
- {
2
- "name": "@defisaver/positions-sdk",
3
- "version": "0.0.148",
4
- "description": "",
5
- "main": "./cjs/index.js",
6
- "module": "./esm/index.js",
7
- "types": "./esm/index.d.ts",
8
- "scripts": {
9
- "build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
10
- "build:cjs": "rm -rf cjs && tsc -p tsconfig.json",
11
- "build": "npm run generate-contracts && npm run build:cjs && npm run build:esm",
12
- "dev": "npm run generate-contracts && tsc -p tsconfig.cjs.json --watch",
13
- "lint": "eslint src/ --fix",
14
- "generate-contracts": "node scripts/generateContracts.js",
15
- "test": "mocha tests/* --require ts-node/register --extension ts",
16
- "test:debugger": "mocha --inspect-brk tests/*",
17
- "build-test": "npm run build && npm run test"
18
- },
19
- "keywords": [],
20
- "author": "",
21
- "license": "ISC",
22
- "dependencies": {
23
- "@defisaver/tokens": "^1.5.37",
24
- "@ethersproject/bignumber": "^5.7.0",
25
- "@morpho-org/morpho-aave-v3-sdk": "^1.5.3",
26
- "decimal.js": "^10.4.3"
27
- },
28
- "devDependencies": {
29
- "@defisaver/eslint-config": "^1.0.1",
30
- "chai": "^4.3.8",
31
- "dotenv": "^16.3.1",
32
- "eslint": "^8.49.0",
33
- "mocha": "^10.2.0",
34
- "ts-node": "^10.9.2",
35
- "typechain": "^8.3.1",
36
- "typechain-target-web3-v1-3mihai3": "^6.0.2",
37
- "typescript": "^5.2.2"
38
- },
39
- "peerDependencies": {
40
- "web3": "^1.10.2"
41
- }
42
- }
1
+ {
2
+ "name": "@defisaver/positions-sdk",
3
+ "version": "0.0.150",
4
+ "description": "",
5
+ "main": "./cjs/index.js",
6
+ "module": "./esm/index.js",
7
+ "types": "./esm/index.d.ts",
8
+ "scripts": {
9
+ "build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
10
+ "build:cjs": "rm -rf cjs && tsc -p tsconfig.json",
11
+ "build": "npm run lint && npm run generate-contracts && npm run build:cjs && npm run build:esm",
12
+ "dev": "npm run generate-contracts && tsc -p tsconfig.json --watch",
13
+ "lint": "eslint src/ --fix",
14
+ "lint-check": "eslint src/",
15
+ "generate-contracts": "node scripts/generateContracts.js",
16
+ "test": "mocha tests/*",
17
+ "test-single": "mocha ./tests/$npm_config_name.js",
18
+ "test:debugger": "mocha --inspect-brk tests/*",
19
+ "build-test": "npm run build && npm run test"
20
+ },
21
+ "keywords": [],
22
+ "author": "",
23
+ "license": "ISC",
24
+ "dependencies": {
25
+ "@defisaver/tokens": "^1.5.37",
26
+ "@ethersproject/bignumber": "^5.7.0",
27
+ "@morpho-org/morpho-aave-v3-sdk": "^1.5.3",
28
+ "decimal.js": "^10.4.3"
29
+ },
30
+ "devDependencies": {
31
+ "@defisaver/eslint-config": "^1.0.1",
32
+ "chai": "^4.3.8",
33
+ "dotenv": "^16.3.1",
34
+ "eslint": "^8.49.0",
35
+ "mocha": "^10.2.0",
36
+ "ts-node": "^10.9.2",
37
+ "typechain": "^8.3.1",
38
+ "typechain-target-web3-v1-3mihai3": "^6.0.2",
39
+ "typescript": "^5.2.2"
40
+ },
41
+ "peerDependencies": {
42
+ "web3": "^1.10.2"
43
+ }
44
+ }