@defisaver/positions-sdk 0.0.135 → 0.0.138

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 (63) hide show
  1. package/.vscode/launch.json +17 -0
  2. package/.vscode/settings.json +22 -0
  3. package/README.md +63 -63
  4. package/cjs/markets/compound/marketsAssets.js +3 -3
  5. package/esm/markets/compound/marketsAssets.js +3 -3
  6. package/package.json +41 -41
  7. package/src/aaveV2/index.ts +227 -227
  8. package/src/aaveV3/index.ts +578 -578
  9. package/src/assets/index.ts +60 -60
  10. package/src/chickenBonds/index.ts +123 -123
  11. package/src/compoundV2/index.ts +219 -219
  12. package/src/compoundV3/index.ts +281 -281
  13. package/src/config/contracts.js +1018 -1018
  14. package/src/constants/index.ts +6 -6
  15. package/src/contracts.ts +128 -128
  16. package/src/curveUsd/index.ts +229 -229
  17. package/src/exchange/index.ts +17 -17
  18. package/src/helpers/aaveHelpers/index.ts +193 -193
  19. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  20. package/src/helpers/compoundHelpers/index.ts +246 -246
  21. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  22. package/src/helpers/index.ts +7 -7
  23. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  24. package/src/helpers/makerHelpers/index.ts +94 -94
  25. package/src/helpers/morphoBlueHelpers/index.ts +115 -115
  26. package/src/helpers/sparkHelpers/index.ts +150 -150
  27. package/src/index.ts +46 -46
  28. package/src/liquity/index.ts +116 -116
  29. package/src/llamaLend/index.ts +275 -275
  30. package/src/maker/index.ts +117 -117
  31. package/src/markets/aave/index.ts +150 -150
  32. package/src/markets/aave/marketAssets.ts +48 -48
  33. package/src/markets/compound/index.ts +173 -173
  34. package/src/markets/compound/marketsAssets.ts +64 -64
  35. package/src/markets/curveUsd/index.ts +69 -69
  36. package/src/markets/index.ts +21 -21
  37. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  38. package/src/markets/llamaLend/index.ts +235 -235
  39. package/src/markets/morphoBlue/index.ts +691 -691
  40. package/src/markets/spark/index.ts +29 -29
  41. package/src/markets/spark/marketAssets.ts +10 -10
  42. package/src/moneymarket/moneymarketCommonService.ts +76 -76
  43. package/src/morphoAaveV2/index.ts +256 -256
  44. package/src/morphoAaveV3/index.ts +615 -615
  45. package/src/morphoBlue/index.ts +171 -171
  46. package/src/multicall/index.ts +22 -22
  47. package/src/services/dsrService.ts +15 -15
  48. package/src/services/priceService.ts +21 -21
  49. package/src/services/utils.ts +51 -51
  50. package/src/setup.ts +8 -8
  51. package/src/spark/index.ts +424 -424
  52. package/src/staking/staking.ts +189 -189
  53. package/src/types/aave.ts +260 -260
  54. package/src/types/chickenBonds.ts +45 -45
  55. package/src/types/common.ts +84 -84
  56. package/src/types/compound.ts +129 -129
  57. package/src/types/curveUsd.ts +118 -118
  58. package/src/types/index.ts +8 -8
  59. package/src/types/liquity.ts +30 -30
  60. package/src/types/llamaLend.ts +155 -155
  61. package/src/types/maker.ts +50 -50
  62. package/src/types/morphoBlue.ts +144 -144
  63. package/src/types/spark.ts +106 -106
@@ -0,0 +1,17 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Attach by Process ID",
9
+ "processId": "${command:PickProcess}",
10
+ "request": "attach",
11
+ "skipFiles": [
12
+ "<node_internals>/**"
13
+ ],
14
+ "type": "node"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "workbench.colorCustomizations": {
3
+ "activityBar.activeBackground": "#f2255a",
4
+ "activityBar.background": "#f2255a",
5
+ "activityBar.foreground": "#e7e7e7",
6
+ "activityBar.inactiveForeground": "#e7e7e799",
7
+ "activityBarBadge.background": "#40d30d",
8
+ "activityBarBadge.foreground": "#15202b",
9
+ "commandCenter.border": "#e7e7e799",
10
+ "sash.hoverBorder": "#f2255a",
11
+ "statusBar.background": "#d70d41",
12
+ "statusBar.foreground": "#e7e7e7",
13
+ "statusBarItem.hoverBackground": "#f2255a",
14
+ "statusBarItem.remoteBackground": "#d70d41",
15
+ "statusBarItem.remoteForeground": "#e7e7e7",
16
+ "titleBar.activeBackground": "#d70d41",
17
+ "titleBar.activeForeground": "#e7e7e7",
18
+ "titleBar.inactiveBackground": "#d70d4199",
19
+ "titleBar.inactiveForeground": "#e7e7e799"
20
+ },
21
+ "peacock.color": "#d70d41"
22
+ }
package/README.md CHANGED
@@ -1,63 +1,63 @@
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)
@@ -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'];
10
+ exports.v3USDCCollAssetsEth = ['COMP', 'WBTC', 'ETH', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'rswETH'];
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,8 +26,8 @@ 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'];
30
- exports.v3ETHCollAssetsBase = ['cbETH', 'ezETH', 'USDC', 'wrsETH', 'wstETH', 'weETH'];
29
+ exports.v3ETHCollAssetsEth = ['cbETH', 'wstETH', 'rETH', 'rsETH', 'weETH', 'osETH', 'WBTC', 'ezETH', 'cbBTC'];
30
+ exports.v3ETHCollAssetsBase = ['cbETH', 'ezETH', 'USDC', 'wrsETH', 'wstETH', 'weETH', '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'];
33
33
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
@@ -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'];
7
+ export const v3USDCCollAssetsEth = ['COMP', 'WBTC', 'ETH', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'rswETH'];
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,8 +23,8 @@ 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'];
27
- export const v3ETHCollAssetsBase = ['cbETH', 'ezETH', 'USDC', 'wrsETH', 'wstETH', 'weETH'];
26
+ export const v3ETHCollAssetsEth = ['cbETH', 'wstETH', 'rETH', 'rsETH', 'weETH', 'osETH', 'WBTC', 'ezETH', 'cbBTC'];
27
+ export const v3ETHCollAssetsBase = ['cbETH', 'ezETH', 'USDC', 'wrsETH', 'wstETH', 'weETH', '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'];
30
30
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "@defisaver/positions-sdk",
3
- "version": "0.0.135",
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.json",
10
- "build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.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/*",
16
- "test:debugger": "mocha --inspect-brk tests/*",
17
- "build-test": "npm run build && mocha tests/*"
18
- },
19
- "keywords": [],
20
- "author": "",
21
- "license": "ISC",
22
- "dependencies": {
23
- "@defisaver/tokens": "^1.5.33",
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
- "typechain": "^8.3.1",
35
- "typechain-target-web3-v1-3mihai3": "^6.0.2",
36
- "typescript": "^5.2.2"
37
- },
38
- "peerDependencies": {
39
- "web3": "^1.10.2"
40
- }
41
- }
1
+ {
2
+ "name": "@defisaver/positions-sdk",
3
+ "version": "0.0.138",
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.json",
10
+ "build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.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/*",
16
+ "test:debugger": "mocha --inspect-brk tests/*",
17
+ "build-test": "npm run build && mocha tests/*"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "dependencies": {
23
+ "@defisaver/tokens": "^1.5.35",
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
+ "typechain": "^8.3.1",
35
+ "typechain-target-web3-v1-3mihai3": "^6.0.2",
36
+ "typescript": "^5.2.2"
37
+ },
38
+ "peerDependencies": {
39
+ "web3": "^1.10.2"
40
+ }
41
+ }