@sonarwatch/portfolio-plugins 0.5.41 → 0.5.43

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 (43) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +5 -2
  3. package/src/index.js +3 -0
  4. package/src/index.js.map +1 -1
  5. package/src/platforms.d.ts +1 -0
  6. package/src/platforms.js +6 -1
  7. package/src/platforms.js.map +1 -1
  8. package/src/plugins/morpho/aaveV3CollateralFetcher.d.ts +3 -0
  9. package/src/plugins/morpho/aaveV3CollateralFetcher.js +101 -0
  10. package/src/plugins/morpho/aaveV3CollateralFetcher.js.map +1 -0
  11. package/src/plugins/morpho/aaveV3Job.d.ts +3 -0
  12. package/src/plugins/morpho/aaveV3Job.js +36 -0
  13. package/src/plugins/morpho/aaveV3Job.js.map +1 -0
  14. package/src/plugins/morpho/aaveV3SupplyOnlyFetcher.d.ts +3 -0
  15. package/src/plugins/morpho/aaveV3SupplyOnlyFetcher.js +58 -0
  16. package/src/plugins/morpho/aaveV3SupplyOnlyFetcher.js.map +1 -0
  17. package/src/plugins/morpho/constants.d.ts +18 -0
  18. package/src/plugins/morpho/constants.js +22 -0
  19. package/src/plugins/morpho/constants.js.map +1 -0
  20. package/src/plugins/morpho/helpers.d.ts +5 -0
  21. package/src/plugins/morpho/helpers.js +112 -0
  22. package/src/plugins/morpho/helpers.js.map +1 -0
  23. package/src/plugins/morpho/index.d.ts +4 -0
  24. package/src/plugins/morpho/index.js +15 -0
  25. package/src/plugins/morpho/index.js.map +1 -0
  26. package/src/plugins/morpho/types.d.ts +20 -0
  27. package/src/plugins/morpho/types.js +3 -0
  28. package/src/plugins/morpho/types.js.map +1 -0
  29. package/src/plugins/morpho/utils/WadRayMath.d.ts +20 -0
  30. package/src/plugins/morpho/utils/WadRayMath.js +59 -0
  31. package/src/plugins/morpho/utils/WadRayMath.js.map +1 -0
  32. package/src/plugins/morpho/utils/abis.d.ts +2330 -0
  33. package/src/plugins/morpho/utils/abis.js +2994 -0
  34. package/src/plugins/morpho/utils/abis.js.map +1 -0
  35. package/src/plugins/native-stake/constants.d.ts +3 -0
  36. package/src/plugins/native-stake/constants.js +4 -1
  37. package/src/plugins/native-stake/constants.js.map +1 -1
  38. package/src/plugins/native-stake/solanaFetcher.js +28 -6
  39. package/src/plugins/native-stake/solanaFetcher.js.map +1 -1
  40. package/src/plugins/top-tokens/getTopAddresses.js +3 -3
  41. package/src/plugins/top-tokens/getTopAddresses.js.map +1 -1
  42. package/src/plugins/top-tokens/topTokensJob.js +3 -2
  43. package/src/plugins/top-tokens/topTokensJob.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.5.43](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.42...plugins-0.5.43) (2023-08-16)
6
+
7
+
8
+
9
+ ## [0.5.42](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.41...plugins-0.5.42) (2023-08-14)
10
+
11
+
12
+
5
13
  ## [0.5.41](https://github.com/sonarwatch/portfolio/compare/plugins-0.5.40...plugins-0.5.41) (2023-08-14)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.5.41",
3
+ "version": "0.5.43",
4
4
  "type": "commonjs",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
7
7
  "@aave/contract-helpers": "^1.18.2",
8
8
  "@aave/math-utils": "^1.18.2",
9
9
  "@ethersproject/address": "^5.7.0",
10
+ "@ethersproject/bignumber": "^5.7.0",
10
11
  "@ethersproject/bytes": "^5.7.0",
12
+ "@ethersproject/constants": "^5.7.0",
11
13
  "@ethersproject/providers": "^5.7.2",
14
+ "@ethersproject/units": "^5.7.0",
12
15
  "@metaplex-foundation/beet": "^0.7.1",
13
16
  "@metaplex-foundation/beet-solana": "^0.4.0",
14
17
  "@metaplex-foundation/js": "^0.19.4",
@@ -27,7 +30,7 @@
27
30
  "web3-v1": "npm:web3@^1.5.0"
28
31
  },
29
32
  "peerDependencies": {
30
- "@sonarwatch/portfolio-core": "0.5.41"
33
+ "@sonarwatch/portfolio-core": "0.5.43"
31
34
  },
32
35
  "main": "./src/index.js",
33
36
  "types": "./src/index.d.ts"
package/src/index.js CHANGED
@@ -43,6 +43,7 @@ const thala_1 = require("./plugins/thala");
43
43
  const tensor_1 = require("./plugins/tensor");
44
44
  const aave_1 = require("./plugins/aave");
45
45
  const staking_aptos_1 = require("./plugins/staking-aptos");
46
+ const morpho_1 = require("./plugins/morpho");
46
47
  const drift_1 = require("./plugins/drift");
47
48
  const mango_1 = require("./plugins/mango");
48
49
  const top_tokens_1 = require("./plugins/top-tokens");
@@ -74,6 +75,7 @@ exports.jobs = [
74
75
  ...auxexchange_1.jobs,
75
76
  ...saber_1.jobs,
76
77
  ...aave_1.jobs,
78
+ ...morpho_1.jobs,
77
79
  ];
78
80
  exports.fetchers = [
79
81
  ...tokens_1.fetchers,
@@ -91,6 +93,7 @@ exports.fetchers = [
91
93
  ...turbos_1.fetchers,
92
94
  ...staking_aptos_1.fetchers,
93
95
  ...aave_1.fetchers,
96
+ ...morpho_1.fetchers,
94
97
  ];
95
98
  exports.fetchersByAddressSystem = (0, getFetchersByAddressSystem_1.getFetchersByAddressSystem)(exports.fetchers);
96
99
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/plugins/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,0DAA4C;AAC5C,6CAG0B;AAC1B,yDAGgC;AAChC,iDAAkE;AAClE,iDAG4B;AAC5B,2CAAoD;AACpD,6CAG0B;AAC1B,+CAG2B;AAC3B,yCAA4E;AAC5E,+CAAwD;AACxD,2CAA+E;AAC/E,6CAG0B;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 export declare const turbosPlatform: Platform;
23
23
  export declare const meeiroPlatform: Platform;
24
24
  export declare const nativeStakePlatform: Platform;
25
25
  export declare const saberPlatform: Platform;
26
+ export declare const morphoPlatform: Platform;
package/src/platforms.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saberPlatform = exports.nativeStakePlatform = exports.meeiroPlatform = exports.turbosPlatform = exports.cetusPlatform = exports.mangoPlatform = exports.driftPlatform = exports.meteoraPlatform = exports.orcaPlatform = exports.solendPlatform = exports.raydiumPlatform = exports.animeswapPlatform = exports.dittoPlatform = exports.liquidswapPlatform = exports.pancakeswapPlatform = exports.auxExchangePlatform = exports.tortugaPlatform = exports.thalaPlatform = exports.tensorPlatform = exports.marginfiPlatform = exports.aavePlatform = exports.marinadePlatform = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
3
+ exports.morphoPlatform = exports.saberPlatform = exports.nativeStakePlatform = exports.meeiroPlatform = exports.turbosPlatform = exports.cetusPlatform = exports.mangoPlatform = exports.driftPlatform = exports.meteoraPlatform = exports.orcaPlatform = exports.solendPlatform = exports.raydiumPlatform = exports.animeswapPlatform = exports.dittoPlatform = exports.liquidswapPlatform = exports.pancakeswapPlatform = exports.auxExchangePlatform = exports.tortugaPlatform = exports.thalaPlatform = exports.tensorPlatform = exports.marginfiPlatform = exports.aavePlatform = exports.marinadePlatform = exports.walletNftsPlatform = exports.walletTokensPlatform = void 0;
4
4
  exports.walletTokensPlatform = {
5
5
  id: 'wallet-tokens',
6
6
  name: 'Tokens',
@@ -121,4 +121,9 @@ exports.saberPlatform = {
121
121
  name: 'Saber',
122
122
  image: 'https://alpha.sonar.watch/img/platforms/saber.png',
123
123
  };
124
+ exports.morphoPlatform = {
125
+ id: 'morpho',
126
+ name: 'Morpho',
127
+ image: 'https://alpha.sonar.watch/img/platforms/morpho.png',
128
+ };
124
129
  //# sourceMappingURL=platforms.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../../../packages/plugins/src/platforms.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAa;IAC5C,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,2DAA2D;CACnE,CAAC;AACW,QAAA,kBAAkB,GAAa;IAC1C,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,yDAAyD;CACjE,CAAC;AACW,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,sDAAsD;CAC9D,CAAC;AACW,QAAA,YAAY,GAAa;IACpC,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,kDAAkD;CAC1D,CAAC;AACW,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,sDAAsD;CAC9D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,qDAAqD;CAC7D,CAAC;AACW,QAAA,mBAAmB,GAAa;IAC3C,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,yDAAyD;CACjE,CAAC;AACW,QAAA,mBAAmB,GAAa;IAC3C,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,yDAAyD;CACjE,CAAC;AACW,QAAA,kBAAkB,GAAa;IAC1C,EAAE,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AAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AACW,QAAA,mBAAmB,GAAa;IAC3C,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,0DAA0D;CAClE,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC"}
1
+ {"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../../../packages/plugins/src/platforms.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAa;IAC5C,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,2DAA2D;CACnE,CAAC;AACW,QAAA,kBAAkB,GAAa;IAC1C,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,yDAAyD;CACjE,CAAC;AACW,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,sDAAsD;CAC9D,CAAC;AACW,QAAA,YAAY,GAAa;IACpC,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,kDAAkD;CAC1D,CAAC;AACW,QAAA,gBAAgB,GAAa;IACxC,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,sDAAsD;CAC9D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,eAAe,GAAa;IACvC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,qDAAq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ACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC;AACW,QAAA,mBAAmB,GAAa;IAC3C,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,0DAA0D;CAClE,CAAC;AACW,QAAA,aAAa,GAAa;IACrC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,mDAAmD;CAC3D,CAAC;AACW,QAAA,cAAc,GAAa;IACtC,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,oDAAoD;CAC5D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const constants_1 = require("./constants");
18
+ const helpers_1 = require("./helpers");
19
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
+ const collateralUnderlyings = [
21
+ constants_1.Underlying.wsteth,
22
+ constants_1.Underlying.dai,
23
+ constants_1.Underlying.usdc,
24
+ constants_1.Underlying.wbtc,
25
+ constants_1.Underlying.reth,
26
+ constants_1.Underlying.cbeth,
27
+ constants_1.Underlying.weth,
28
+ ];
29
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
30
+ const collateralPromises = collateralUnderlyings.map((u) => (0, helpers_1.getCurrentCollateralBalanceInOf)(u, owner));
31
+ const borrowPromises = collateralUnderlyings.map((u) => (0, helpers_1.getCurrentBorrowBalanceInOf)(u, owner));
32
+ const tokenPricesPromise = cache.getTokenPrices(collateralUnderlyings, portfolio_core_1.NetworkId.ethereum);
33
+ const promises = [
34
+ tokenPricesPromise,
35
+ ...collateralPromises,
36
+ ...borrowPromises,
37
+ ];
38
+ yield Promise.all(promises);
39
+ const tokenPrices = yield tokenPricesPromise;
40
+ const suppliedAssets = [];
41
+ const suppliedYields = [];
42
+ const borrowedAssets = [];
43
+ const borrowedYields = [];
44
+ const rewardAssets = [];
45
+ const collateralBalances = yield Promise.all(collateralPromises);
46
+ collateralBalances.forEach((collateralBalance, i) => {
47
+ const tokenPrice = tokenPrices[i];
48
+ if (!tokenPrice)
49
+ return;
50
+ const amount = new bignumber_js_1.default(collateralBalance.toString())
51
+ .div(Math.pow(10, tokenPrice.decimals))
52
+ .toNumber();
53
+ if (amount === 0)
54
+ return;
55
+ suppliedYields.push([]);
56
+ suppliedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.ethereum, tokenPrice));
57
+ });
58
+ const borrowBalances = yield Promise.all(borrowPromises);
59
+ borrowBalances.forEach((borrowBalance, i) => {
60
+ const tokenPrice = tokenPrices[i];
61
+ if (!tokenPrice)
62
+ return;
63
+ const amount = new bignumber_js_1.default(borrowBalance.toString())
64
+ .div(Math.pow(10, tokenPrice.decimals))
65
+ .toNumber();
66
+ if (amount === 0)
67
+ return;
68
+ borrowedYields.push([]);
69
+ borrowedAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPrice.address, amount, portfolio_core_1.NetworkId.ethereum, tokenPrice));
70
+ });
71
+ const { borrowedValue, collateralRatio, suppliedValue, value } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
72
+ if (borrowedValue === 0 && suppliedValue === 0)
73
+ return [];
74
+ const element = {
75
+ type: portfolio_core_1.PortfolioElementType.borrowlend,
76
+ networkId: portfolio_core_1.NetworkId.solana,
77
+ platformId: constants_1.platformId,
78
+ label: 'Lending',
79
+ value,
80
+ name: 'AaveV3',
81
+ data: {
82
+ borrowedAssets,
83
+ borrowedValue,
84
+ borrowedYields,
85
+ suppliedAssets,
86
+ suppliedValue,
87
+ suppliedYields,
88
+ collateralRatio,
89
+ rewardAssets,
90
+ value,
91
+ },
92
+ };
93
+ return [element];
94
+ });
95
+ const fetcher = {
96
+ id: `${constants_1.platformId}-aave-v3-collateral`,
97
+ networkId: portfolio_core_1.NetworkId.ethereum,
98
+ executor,
99
+ };
100
+ exports.default = fetcher;
101
+ //# sourceMappingURL=aaveV3CollateralFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aaveV3CollateralFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/morpho/aaveV3CollateralFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAOoC;AACpC,gEAAqC;AACrC,2CAAqD;AAGrD,uCAGmB;AACnB,qGAA6E;AAE7E,MAAM,qBAAqB,GAAG;IAC5B,sBAAU,CAAC,MAAM;IACjB,sBAAU,CAAC,GAAG;IACd,sBAAU,CAAC,I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GAA+B;QAC1C,IAAI,EAAE,qCAAoB,CAAC,UAAU;QACrC,SAAS,EAAE,0BAAS,CAAC,MAAM;QAC3B,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,cAAc;YACd,aAAa;YACb,cAAc;YACd,cAAc;YACd,aAAa;YACb,cAAc;YACd,eAAe;YACf,YAAY;YACZ,KAAK;SACN;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,qBAAqB;IACtC,SAAS,EAAE,0BAAS,CAAC,QAAQ;IAC7B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Job } from '../../Job';
2
+ declare const job: Job;
3
+ export default job;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
13
+ const viem_1 = require("viem");
14
+ const constants_1 = require("./constants");
15
+ const clients_1 = require("../../utils/clients");
16
+ const abis_1 = require("./utils/abis");
17
+ const helpers_1 = require("./helpers");
18
+ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
19
+ const client = (0, clients_1.getEvmClient)(portfolio_core_1.NetworkId.ethereum);
20
+ const wEthUpdatedIndexes = yield client.readContract({
21
+ abi: abis_1.MorphoAaveV3Abi,
22
+ functionName: 'updatedIndexes',
23
+ args: [(0, viem_1.getAddress)(constants_1.wethAddress)],
24
+ address: (0, viem_1.getAddress)(constants_1.morphoAaveV3Address),
25
+ });
26
+ yield cache.setItem(constants_1.wethAddress, (0, helpers_1.parseUpdatedIndexes)(wEthUpdatedIndexes), {
27
+ networkId: portfolio_core_1.NetworkId.ethereum,
28
+ prefix: constants_1.updatedIndexesPrefix,
29
+ });
30
+ });
31
+ const job = {
32
+ id: `${constants_1.platformId}-aave-v3`,
33
+ executor,
34
+ };
35
+ exports.default = job;
36
+ //# sourceMappingURL=aaveV3Job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aaveV3Job.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/morpho/aaveV3Job.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAuD;AACvD,+BAAkC;AAClC,2CAKqB;AAGrB,iDAAmD;AACnD,uCAA+C;AAC/C,uCAAgD;AAEhD,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,sBAAY,EAAC,0BAAS,CAAC,QAAQ,CAAC,CAAC;IAEhD,MAAM,kBAAkB,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;QACnD,GAAG,EAAE,sBAAe;QACpB,YAAY,EAAE,gBAAgB;QAC9B,IAAI,EAAE,CAAC,IAAA,iBAAU,EAAC,uBAAW,CAAC,CAAC;QAC/B,OAAO,EAAE,IAAA,iBAAU,EAAC,+BAAmB,CAAC;KACzC,CAAC,CAAC;IACH,MAAM,KAAK,CAAC,OAAO,CAAC,uBAAW,EAAE,IAAA,6BAAmB,EAAC,kBAAkB,CAAC,EAAE;QACxE,SAAS,EAAE,0BAAS,CAAC,QAAQ;QAC7B,MAAM,EAAE,gCAAoB;KAC7B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;CACT,CAAC;AACF,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ declare const fetcher: Fetcher;
3
+ export default fetcher;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
16
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
17
+ const constants_1 = require("./constants");
18
+ const helpers_1 = require("./helpers");
19
+ const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
20
+ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const tokenPricePrice = cache.getTokenPrice(constants_1.wethAddress, portfolio_core_1.NetworkId.ethereum);
22
+ const balance = yield (0, helpers_1.getCurrentSupplyBalanceInOf)(constants_1.wethAddress, owner);
23
+ const amount = new bignumber_js_1.default(balance.toString())
24
+ .div(Math.pow(10, constants_1.wethDecimals))
25
+ .toNumber();
26
+ if (amount === 0)
27
+ return [];
28
+ const tokenPrice = yield tokenPricePrice;
29
+ const asset = (0, tokenPriceToAssetToken_1.default)(constants_1.wethAddress, amount, portfolio_core_1.NetworkId.ethereum, tokenPrice);
30
+ const element = {
31
+ type: portfolio_core_1.PortfolioElementType.liquidity,
32
+ networkId: portfolio_core_1.NetworkId.ethereum,
33
+ platformId: constants_1.platformId,
34
+ label: 'Lending',
35
+ value: asset.value,
36
+ name: 'AaveV3',
37
+ data: {
38
+ liquidities: [
39
+ {
40
+ assets: [asset],
41
+ assetsValue: asset.value,
42
+ rewardAssets: [],
43
+ rewardAssetsValue: null,
44
+ value: asset.value,
45
+ yields: [],
46
+ },
47
+ ],
48
+ },
49
+ };
50
+ return [element];
51
+ });
52
+ const fetcher = {
53
+ id: `${constants_1.platformId}-aave-v3-supply-only`,
54
+ networkId: portfolio_core_1.NetworkId.ethereum,
55
+ executor,
56
+ };
57
+ exports.default = fetcher;
58
+ //# sourceMappingURL=aaveV3SupplyOnlyFetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aaveV3SupplyOnlyFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/morpho/aaveV3SupplyOnlyFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAIoC;AACpC,gEAAqC;AACrC,2CAAoE;AAGpE,uCAAwD;AACxD,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAC,uBAAW,EAAE,0BAAS,CAAC,QAAQ,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,MAAM,IAAA,qCAA2B,EAAC,uBAAW,EAAE,KAAK,CAAC,CAAC;IAEtE,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;SAC7C,GAAG,CAAC,SAAA,EAAE,EAAI,wBAAY,CAAA,CAAC;SACvB,QAAQ,EAAE,CAAC;IACd,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE5B,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC;IACzC,MAAM,KAAK,GAAG,IAAA,gCAAsB,EAClC,uBAAW,EACX,MAAM,EACN,0BAAS,CAAC,QAAQ,EAClB,UAAU,CACX,CAAC;IAEF,MAAM,OAAO,GAA8B;QACzC,IAAI,EAAE,qCAAoB,CAAC,SAAS;QACpC,SAAS,EAAE,0BAAS,CAAC,QAAQ;QAC7B,UAAU,EAAV,sBAAU;QACV,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX;oBACE,MAAM,EAAE,CAAC,KAAK,CAAC;oBACf,WAAW,EAAE,KAAK,CAAC,KAAK;oBACxB,YAAY,EAAE,EAAE;oBAChB,iBAAiB,EAAE,IAAI;oBACvB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,MAAM,EAAE,EAAE;iBACX;aACF;SACF;KACF,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,sBAAsB;IACvC,SAAS,EAAE,0BAAS,CAAC,QAAQ;IAC7B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare const platformId = "morpho";
2
+ export declare const updatedIndexesPrefix: string;
3
+ export declare const morphoAaveV3Address = "0x33333aea097c193e66081E930c33020272b33333";
4
+ export declare const morphoTokenAddress = "0x9994E35Db50125E0DF82e4c2dde62496CE330999";
5
+ export declare const Underlying: {
6
+ usdc: string;
7
+ dai: string;
8
+ wbtc: string;
9
+ wsteth: string;
10
+ steth: string;
11
+ uni: string;
12
+ usdt: string;
13
+ weth: string;
14
+ reth: string;
15
+ cbeth: string;
16
+ };
17
+ export declare const wethAddress = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
18
+ export declare const wethDecimals = 18;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wethDecimals = exports.wethAddress = exports.Underlying = exports.morphoTokenAddress = exports.morphoAaveV3Address = exports.updatedIndexesPrefix = exports.platformId = void 0;
4
+ exports.platformId = 'morpho';
5
+ exports.updatedIndexesPrefix = `${exports.platformId}-updated-indexes`;
6
+ exports.morphoAaveV3Address = '0x33333aea097c193e66081E930c33020272b33333';
7
+ exports.morphoTokenAddress = '0x9994E35Db50125E0DF82e4c2dde62496CE330999';
8
+ exports.Underlying = {
9
+ usdc: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
10
+ dai: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
11
+ wbtc: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
12
+ wsteth: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
13
+ steth: '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84',
14
+ uni: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984',
15
+ usdt: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
16
+ weth: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
17
+ reth: '0xae78736Cd615f374D3085123A210448E74Fc6393',
18
+ cbeth: '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704',
19
+ };
20
+ exports.wethAddress = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';
21
+ exports.wethDecimals = 18;
22
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/morpho/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,oBAAoB,GAAG,GAAG,kBAAU,kBAAkB,CAAC;AACvD,QAAA,mBAAmB,GAAG,4CAA4C,CAAC;AACnE,QAAA,kBAAkB,GAAG,4CAA4C,CAAC;AAElE,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,4CAA4C;IAClD,GAAG,EAAE,4CAA4C;IACjD,IAAI,EAAE,4CAA4C;IAClD,MAAM,EAAE,4CAA4C;IACpD,KAAK,EAAE,4CAA4C;IACnD,GAAG,EAAE,4CAA4C;IACjD,IAAI,EAAE,4CAA4C;IAClD,IAAI,EAAE,4CAA4C;IAClD,IAAI,EAAE,4CAA4C;IAClD,KAAK,EAAE,4CAA4C;CACpD,CAAC;AAEW,QAAA,WAAW,GAAG,4CAA4C,CAAC;AAC3D,QAAA,YAAY,GAAG,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ParsedUpdatedIndexes, UpdatedIndexes } from './types';
2
+ export declare function parseUpdatedIndexes(updatedIndexes: UpdatedIndexes): ParsedUpdatedIndexes;
3
+ export declare const getCurrentSupplyBalanceInOf: (underlying: string, owner: string) => Promise<import("ethers").BigNumber>;
4
+ export declare const getCurrentCollateralBalanceInOf: (underlying: string, owner: string) => Promise<bigint>;
5
+ export declare const getCurrentBorrowBalanceInOf: (underlying: string, owner: string) => Promise<import("ethers").BigNumber>;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.getCurrentBorrowBalanceInOf = exports.getCurrentCollateralBalanceInOf = exports.getCurrentSupplyBalanceInOf = exports.parseUpdatedIndexes = void 0;
16
+ const portfolio_core_1 = require("@sonarwatch/portfolio-core");
17
+ const viem_1 = require("viem");
18
+ const clients_1 = require("../../utils/clients");
19
+ const abis_1 = require("./utils/abis");
20
+ const constants_1 = require("./constants");
21
+ const WadRayMath_1 = __importDefault(require("./utils/WadRayMath"));
22
+ function parseUpdatedIndexes(updatedIndexes) {
23
+ return {
24
+ borrow: {
25
+ p2pIndex: updatedIndexes.borrow.p2pIndex.toString(),
26
+ poolIndex: updatedIndexes.borrow.poolIndex.toString(),
27
+ },
28
+ supply: {
29
+ p2pIndex: updatedIndexes.supply.p2pIndex.toString(),
30
+ poolIndex: updatedIndexes.supply.poolIndex.toString(),
31
+ },
32
+ };
33
+ }
34
+ exports.parseUpdatedIndexes = parseUpdatedIndexes;
35
+ const getCurrentSupplyBalanceInOf = (underlying, owner) => __awaiter(void 0, void 0, void 0, function* () {
36
+ const client = (0, clients_1.getEvmClient)(portfolio_core_1.NetworkId.ethereum);
37
+ const promises = [
38
+ client.readContract({
39
+ abi: abis_1.MorphoAaveV3Abi,
40
+ functionName: 'updatedIndexes',
41
+ args: [(0, viem_1.getAddress)(underlying)],
42
+ address: (0, viem_1.getAddress)(constants_1.morphoAaveV3Address),
43
+ }),
44
+ client.readContract({
45
+ abi: abis_1.MorphoAaveV3Abi,
46
+ functionName: 'scaledP2PSupplyBalance',
47
+ args: [(0, viem_1.getAddress)(underlying), (0, viem_1.getAddress)(owner)],
48
+ address: (0, viem_1.getAddress)(constants_1.morphoAaveV3Address),
49
+ }),
50
+ client.readContract({
51
+ abi: abis_1.MorphoAaveV3Abi,
52
+ functionName: 'scaledPoolSupplyBalance',
53
+ args: [(0, viem_1.getAddress)(underlying), (0, viem_1.getAddress)(owner)],
54
+ address: (0, viem_1.getAddress)(constants_1.morphoAaveV3Address),
55
+ }),
56
+ ];
57
+ const results = yield Promise.all(promises);
58
+ const updatedIndexes = results[0];
59
+ const scaledP2PSupplyBalance = results[1];
60
+ const scaledPoolSupplyBalance = results[2];
61
+ const { p2pIndex, poolIndex } = updatedIndexes.supply;
62
+ const balanceInP2P = WadRayMath_1.default.rayMul(scaledP2PSupplyBalance, p2pIndex);
63
+ const balanceOnPool = WadRayMath_1.default.rayMul(scaledPoolSupplyBalance, poolIndex);
64
+ const totalBalance = balanceInP2P.add(balanceOnPool);
65
+ return totalBalance;
66
+ });
67
+ exports.getCurrentSupplyBalanceInOf = getCurrentSupplyBalanceInOf;
68
+ const getCurrentCollateralBalanceInOf = (underlying, owner) => __awaiter(void 0, void 0, void 0, function* () {
69
+ const client = (0, clients_1.getEvmClient)(portfolio_core_1.NetworkId.ethereum);
70
+ const collateralBalance = yield client.readContract({
71
+ abi: abis_1.MorphoAaveV3Abi,
72
+ functionName: 'collateralBalance',
73
+ args: [(0, viem_1.getAddress)(underlying), (0, viem_1.getAddress)(owner)],
74
+ address: (0, viem_1.getAddress)(constants_1.morphoAaveV3Address),
75
+ });
76
+ return collateralBalance;
77
+ });
78
+ exports.getCurrentCollateralBalanceInOf = getCurrentCollateralBalanceInOf;
79
+ const getCurrentBorrowBalanceInOf = (underlying, owner) => __awaiter(void 0, void 0, void 0, function* () {
80
+ const client = (0, clients_1.getEvmClient)(portfolio_core_1.NetworkId.ethereum);
81
+ const promises = [
82
+ client.readContract({
83
+ abi: abis_1.MorphoAaveV3Abi,
84
+ functionName: 'updatedIndexes',
85
+ args: [(0, viem_1.getAddress)(underlying)],
86
+ address: (0, viem_1.getAddress)(constants_1.morphoAaveV3Address),
87
+ }),
88
+ client.readContract({
89
+ abi: abis_1.MorphoAaveV3Abi,
90
+ functionName: 'scaledP2PBorrowBalance',
91
+ args: [(0, viem_1.getAddress)(underlying), (0, viem_1.getAddress)(owner)],
92
+ address: (0, viem_1.getAddress)(constants_1.morphoAaveV3Address),
93
+ }),
94
+ client.readContract({
95
+ abi: abis_1.MorphoAaveV3Abi,
96
+ functionName: 'scaledPoolBorrowBalance',
97
+ args: [(0, viem_1.getAddress)(underlying), (0, viem_1.getAddress)(owner)],
98
+ address: (0, viem_1.getAddress)(constants_1.morphoAaveV3Address),
99
+ }),
100
+ ];
101
+ const results = yield Promise.all(promises);
102
+ const updatedIndexes = results[0];
103
+ const scaledP2PBorrowBalance = results[1];
104
+ const scaledPoolBorrowBalance = results[2];
105
+ const { p2pIndex, poolIndex } = updatedIndexes.supply;
106
+ const balanceInP2P = WadRayMath_1.default.rayMul(scaledP2PBorrowBalance, p2pIndex);
107
+ const balanceOnPool = WadRayMath_1.default.rayMul(scaledPoolBorrowBalance, poolIndex);
108
+ const totalBalance = balanceInP2P.add(balanceOnPool);
109
+ return totalBalance;
110
+ });
111
+ exports.getCurrentBorrowBalanceInOf = getCurrentBorrowBalanceInOf;
112
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/morpho/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,+BAAkC;AAClC,iDAAmD;AACnD,uCAA+C;AAC/C,2CAAkD;AAClD,oEAA4C;AAG5C,SAAgB,mBAAmB,CACjC,cAA8B;IAE9B,OAAO;QACL,MAAM,EAAE;YACN,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACnD,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE;SACtD;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACnD,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE;SACtD;KACF,CAAC;AACJ,CAAC;AAbD,kDAaC;AAEM,MAAM,2BAA2B,GAAG,CACzC,UAAkB,EAClB,KAAa,EACb,EAAE;IACF,MAAM,MAAM,GAAG,IAAA,sBAAY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AAA,iBAAU,EAAC,+BAAmB,CAAC;SACzC,CAAC;QACF,MAAM,CAAC,YAAY,CAAC;YAClB,GAAG,EAAE,sBAAe;YACpB,YAAY,EAAE,yBAAyB;YACvC,IAAI,EAAE,CAAC,IAAA,iBAAU,EAAC,UAAU,CAAC,EAAE,IAAA,iBAAU,EAAC,KAAK,CAAC,CAAC;YACjD,OAAO,EAAE,IAAA,iBAAU,EAAC,+BAAmB,CAAC;SACzC,CAAC;KACM,CAAC;IACX,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE5C,MAAM,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,sBAAsB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,uBAAuB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAE3C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC;IACtD,MAAM,YAAY,GAAG,oBAAU,CAAC,MAAM,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;IACzE,MAAM,aAAa,GAAG,oBAAU,CAAC,MAAM,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;IAC5E,MAAM,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACrD,OAAO,YAAY,CAAC;AACtB,CAAC,CAAA,CAAC;AArCW,QAAA,2BAA2B,+BAqCtC"}
@@ -0,0 +1,4 @@
1
+ import { Fetcher } from '../../Fetcher';
2
+ import { Job } from '../../Job';
3
+ export declare const jobs: Job[];
4
+ export declare const fetchers: Fetcher[];
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fetchers = exports.jobs = void 0;
7
+ const aaveV3CollateralFetcher_1 = __importDefault(require("./aaveV3CollateralFetcher"));
8
+ const aaveV3SupplyOnlyFetcher_1 = __importDefault(require("./aaveV3SupplyOnlyFetcher"));
9
+ const aaveV3Job_1 = __importDefault(require("./aaveV3Job"));
10
+ exports.jobs = [aaveV3Job_1.default];
11
+ exports.fetchers = [
12
+ aaveV3CollateralFetcher_1.default,
13
+ aaveV3SupplyOnlyFetcher_1.default,
14
+ ];
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/morpho/index.ts"],"names":[],"mappings":";;;;;;AAEA,wFAAgE;AAChE,wFAAgE;AAChE,4DAAoC;AAEvB,QAAA,IAAI,GAAU,CAAC,mBAAS,CAAC,CAAC;AAC1B,QAAA,QAAQ,GAAc;IACjC,iCAAuB;IACvB,iCAAuB;CACxB,CAAC"}
@@ -0,0 +1,20 @@
1
+ export type UpdatedIndexes = {
2
+ supply: {
3
+ poolIndex: bigint;
4
+ p2pIndex: bigint;
5
+ };
6
+ borrow: {
7
+ poolIndex: bigint;
8
+ p2pIndex: bigint;
9
+ };
10
+ };
11
+ export type ParsedUpdatedIndexes = {
12
+ supply: {
13
+ poolIndex: string;
14
+ p2pIndex: string;
15
+ };
16
+ borrow: {
17
+ poolIndex: string;
18
+ p2pIndex: string;
19
+ };
20
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/morpho/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { BigNumber, BigNumberish } from '@ethersproject/bignumber';
2
+ declare const WadRayMath: {
3
+ WAD: BigNumber;
4
+ halfWAD: BigNumber;
5
+ RAY: BigNumber;
6
+ halfRAY: BigNumber;
7
+ wadMul: (a: BigNumberish, b: BigNumberish) => BigNumber;
8
+ wadDiv: (a: BigNumberish, b: BigNumberish) => BigNumber;
9
+ rayMul: (a: BigNumberish, b: BigNumberish) => BigNumber;
10
+ rayDiv: (a: BigNumberish, b: BigNumberish) => BigNumber;
11
+ rayToWad: (a: BigNumberish) => BigNumber;
12
+ wadToRay: (a: BigNumberish) => BigNumber;
13
+ formatRay: (a: BigNumberish) => string;
14
+ parseRay: (a: string) => BigNumber;
15
+ parseWad: (a: string) => BigNumber;
16
+ formatWad: (a: string) => string;
17
+ wadDivUp: (a: BigNumberish, b: BigNumberish) => BigNumber;
18
+ rayDivUp: (a: BigNumberish, b: BigNumberish) => BigNumber;
19
+ };
20
+ export default WadRayMath;