@defisaver/positions-sdk 2.1.23 → 2.1.24-dev-savings-2

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 (159) hide show
  1. package/.mocharc.json +4 -4
  2. package/.nvmrc +1 -1
  3. package/README.md +64 -64
  4. package/cjs/config/contracts.d.ts +173 -0
  5. package/cjs/config/contracts.js +23 -1
  6. package/cjs/contracts.d.ts +1650 -0
  7. package/cjs/contracts.js +22 -1
  8. package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
  9. package/cjs/index.d.ts +2 -1
  10. package/cjs/index.js +3 -1
  11. package/cjs/markets/aave/marketAssets.js +1 -1
  12. package/cjs/savings/index.d.ts +7 -0
  13. package/cjs/savings/index.js +75 -0
  14. package/cjs/savings/makerDSR/index.d.ts +7 -0
  15. package/cjs/savings/makerDSR/index.js +94 -0
  16. package/cjs/savings/makerDSR/options.d.ts +2 -0
  17. package/cjs/savings/makerDSR/options.js +11 -0
  18. package/cjs/savings/morphoVaults/index.d.ts +7 -0
  19. package/cjs/savings/morphoVaults/index.js +118 -0
  20. package/cjs/savings/morphoVaults/options.d.ts +16 -0
  21. package/cjs/savings/morphoVaults/options.js +112 -0
  22. package/cjs/savings/yearnVaults/index.d.ts +9 -0
  23. package/cjs/savings/yearnVaults/index.js +113 -0
  24. package/cjs/savings/yearnVaults/options.d.ts +6 -0
  25. package/cjs/savings/yearnVaults/options.js +29 -0
  26. package/cjs/types/index.d.ts +1 -0
  27. package/cjs/types/index.js +1 -0
  28. package/cjs/types/savings/index.d.ts +15 -0
  29. package/cjs/types/savings/index.js +19 -0
  30. package/cjs/types/savings/makerDsr.d.ts +11 -0
  31. package/cjs/types/savings/makerDsr.js +7 -0
  32. package/cjs/types/savings/morphoVaults.d.ts +23 -0
  33. package/cjs/types/savings/morphoVaults.js +19 -0
  34. package/cjs/types/savings/yearnVaults.d.ts +12 -0
  35. package/cjs/types/savings/yearnVaults.js +9 -0
  36. package/esm/config/contracts.d.ts +173 -0
  37. package/esm/config/contracts.js +22 -0
  38. package/esm/contracts.d.ts +1650 -0
  39. package/esm/contracts.js +18 -0
  40. package/esm/helpers/morphoBlueHelpers/index.js +66 -66
  41. package/esm/index.d.ts +2 -1
  42. package/esm/index.js +2 -1
  43. package/esm/markets/aave/marketAssets.js +1 -1
  44. package/esm/savings/index.d.ts +7 -0
  45. package/esm/savings/index.js +36 -0
  46. package/esm/savings/makerDSR/index.d.ts +7 -0
  47. package/esm/savings/makerDSR/index.js +53 -0
  48. package/esm/savings/makerDSR/options.d.ts +2 -0
  49. package/esm/savings/makerDSR/options.js +8 -0
  50. package/esm/savings/morphoVaults/index.d.ts +7 -0
  51. package/esm/savings/morphoVaults/index.js +77 -0
  52. package/esm/savings/morphoVaults/options.d.ts +16 -0
  53. package/esm/savings/morphoVaults/options.js +108 -0
  54. package/esm/savings/yearnVaults/index.d.ts +9 -0
  55. package/esm/savings/yearnVaults/index.js +70 -0
  56. package/esm/savings/yearnVaults/options.d.ts +6 -0
  57. package/esm/savings/yearnVaults/options.js +25 -0
  58. package/esm/types/index.d.ts +1 -0
  59. package/esm/types/index.js +1 -0
  60. package/esm/types/savings/index.d.ts +15 -0
  61. package/esm/types/savings/index.js +3 -0
  62. package/esm/types/savings/makerDsr.d.ts +11 -0
  63. package/esm/types/savings/makerDsr.js +4 -0
  64. package/esm/types/savings/morphoVaults.d.ts +23 -0
  65. package/esm/types/savings/morphoVaults.js +16 -0
  66. package/esm/types/savings/yearnVaults.d.ts +12 -0
  67. package/esm/types/savings/yearnVaults.js +6 -0
  68. package/package.json +48 -47
  69. package/src/aaveV2/index.ts +240 -240
  70. package/src/aaveV3/index.ts +614 -614
  71. package/src/aaveV3/merit.ts +97 -97
  72. package/src/aaveV3/merkl.ts +74 -74
  73. package/src/claiming/aaveV3.ts +154 -154
  74. package/src/claiming/compV3.ts +22 -22
  75. package/src/claiming/ethena.ts +61 -61
  76. package/src/claiming/index.ts +12 -12
  77. package/src/claiming/king.ts +66 -66
  78. package/src/claiming/morphoBlue.ts +118 -118
  79. package/src/claiming/spark.ts +225 -225
  80. package/src/compoundV2/index.ts +244 -244
  81. package/src/compoundV3/index.ts +274 -274
  82. package/src/config/contracts.ts +1282 -1260
  83. package/src/constants/index.ts +10 -10
  84. package/src/contracts.ts +143 -121
  85. package/src/curveUsd/index.ts +254 -254
  86. package/src/eulerV2/index.ts +324 -324
  87. package/src/exchange/index.ts +25 -25
  88. package/src/fluid/index.ts +1774 -1774
  89. package/src/helpers/aaveHelpers/index.ts +187 -187
  90. package/src/helpers/compoundHelpers/index.ts +283 -283
  91. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  92. package/src/helpers/eulerHelpers/index.ts +222 -222
  93. package/src/helpers/fluidHelpers/index.ts +326 -326
  94. package/src/helpers/index.ts +10 -10
  95. package/src/helpers/liquityV2Helpers/index.ts +82 -82
  96. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  97. package/src/helpers/makerHelpers/index.ts +52 -52
  98. package/src/helpers/morphoBlueHelpers/index.ts +396 -396
  99. package/src/helpers/sparkHelpers/index.ts +158 -158
  100. package/src/index.ts +49 -47
  101. package/src/liquity/index.ts +159 -159
  102. package/src/liquityV2/index.ts +703 -703
  103. package/src/llamaLend/index.ts +305 -305
  104. package/src/maker/index.ts +223 -223
  105. package/src/markets/aave/index.ts +116 -116
  106. package/src/markets/aave/marketAssets.ts +54 -54
  107. package/src/markets/compound/index.ts +238 -238
  108. package/src/markets/compound/marketsAssets.ts +97 -97
  109. package/src/markets/curveUsd/index.ts +69 -69
  110. package/src/markets/euler/index.ts +26 -26
  111. package/src/markets/fluid/index.ts +2900 -2900
  112. package/src/markets/index.ts +25 -25
  113. package/src/markets/liquityV2/index.ts +102 -102
  114. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  115. package/src/markets/llamaLend/index.ts +235 -235
  116. package/src/markets/morphoBlue/index.ts +971 -971
  117. package/src/markets/spark/index.ts +29 -29
  118. package/src/markets/spark/marketAssets.ts +12 -12
  119. package/src/moneymarket/moneymarketCommonService.ts +84 -84
  120. package/src/morphoBlue/index.ts +274 -274
  121. package/src/portfolio/index.ts +598 -598
  122. package/src/savings/index.ts +43 -0
  123. package/src/savings/makerDsr/index.ts +54 -0
  124. package/src/savings/makerDsr/options.ts +9 -0
  125. package/src/savings/morphoVaults/index.ts +81 -0
  126. package/src/savings/morphoVaults/options.ts +123 -0
  127. package/src/savings/yearnVaults/index.ts +74 -0
  128. package/src/savings/yearnVaults/options.ts +30 -0
  129. package/src/services/priceService.ts +278 -278
  130. package/src/services/utils.ts +115 -115
  131. package/src/services/viem.ts +34 -34
  132. package/src/setup.ts +8 -8
  133. package/src/spark/index.ts +456 -456
  134. package/src/staking/eligibility.ts +53 -53
  135. package/src/staking/index.ts +1 -1
  136. package/src/staking/staking.ts +183 -183
  137. package/src/types/aave.ts +189 -189
  138. package/src/types/claiming.ts +114 -114
  139. package/src/types/common.ts +107 -107
  140. package/src/types/compound.ts +136 -136
  141. package/src/types/curveUsd.ts +123 -123
  142. package/src/types/euler.ts +175 -175
  143. package/src/types/fluid.ts +483 -483
  144. package/src/types/index.ts +15 -14
  145. package/src/types/liquity.ts +30 -30
  146. package/src/types/liquityV2.ts +126 -126
  147. package/src/types/llamaLend.ts +159 -159
  148. package/src/types/maker.ts +63 -63
  149. package/src/types/merit.ts +1 -1
  150. package/src/types/merkl.ts +70 -70
  151. package/src/types/morphoBlue.ts +200 -200
  152. package/src/types/portfolio.ts +60 -60
  153. package/src/types/savings/index.ts +18 -0
  154. package/src/types/savings/makerDsr.ts +13 -0
  155. package/src/types/savings/morphoVaults.ts +25 -0
  156. package/src/types/savings/yearnVaults.ts +14 -0
  157. package/src/types/spark.ts +133 -133
  158. package/src/umbrella/index.ts +69 -69
  159. package/src/umbrella/umbrellaUtils.ts +29 -29
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMorphoVault = exports.MORPHO_VAULTS = exports.MORPHO_VAULT_GAUNTLET_RESOLV_USDC = exports.MORPHO_VAULT_GAUNTLET_USDT_PRIME = exports.MORPHO_VAULT_GAUNTLET_USDA_CORE = exports.MORPHO_VAULT_STEAKHOUSE_USDT = exports.MORPHO_VAULT_FLAGSHIP_USDT = exports.MORPHO_VAULT_STEAKHOUSE_PYUSD = exports.MORPHO_VAULT_BOOSTED_USDC = exports.MORPHO_VAULT_GAUNTLET_WETH_PRIME = exports.MORPHO_VAULT_GAUNTLET_WETH_CORE = exports.MORPHO_VAULT_RE7_WETH = exports.MORPHO_VAULT_GAUNTLET_USDC_PRIME = exports.MORPHO_VAULT_GAUNTLET_USDC_CORE = exports.MORPHO_VAULT_FLAGSHIP_ETH = void 0;
4
+ const types_1 = require("../../types");
5
+ exports.MORPHO_VAULT_FLAGSHIP_ETH = {
6
+ type: types_1.MorphoVaultType.MorphoVaultFlagshipEth,
7
+ name: 'Flagship ETH',
8
+ address: '0x38989BBA00BDF8181F4082995b3DEAe96163aC5D',
9
+ asset: 'ETH',
10
+ deploymentBlock: 18927491,
11
+ };
12
+ exports.MORPHO_VAULT_GAUNTLET_USDC_CORE = {
13
+ type: types_1.MorphoVaultType.MorphoVaultGauntletUSDCCore,
14
+ name: 'Gauntlet USDC Core',
15
+ address: '0x8eB67A509616cd6A7c1B3c8C21D48FF57df3d458',
16
+ asset: 'USDC',
17
+ deploymentBlock: 19777569,
18
+ };
19
+ exports.MORPHO_VAULT_GAUNTLET_USDC_PRIME = {
20
+ type: types_1.MorphoVaultType.MorphoVaultGauntletUSDCPrime,
21
+ name: 'Gauntlet USDC Prime',
22
+ address: '0xdd0f28e19C1780eb6396170735D45153D261490d',
23
+ asset: 'USDC',
24
+ deploymentBlock: 19777569,
25
+ };
26
+ exports.MORPHO_VAULT_RE7_WETH = {
27
+ type: types_1.MorphoVaultType.MorphoVaultRe7Weth,
28
+ name: 'RE7 WETH',
29
+ address: '0x78Fc2c2eD1A4cDb5402365934aE5648aDAd094d0',
30
+ asset: 'ETH',
31
+ deploymentBlock: 19121118,
32
+ };
33
+ exports.MORPHO_VAULT_GAUNTLET_WETH_CORE = {
34
+ type: types_1.MorphoVaultType.MorphoVaultGauntletWETHCore,
35
+ name: 'Gauntlet WETH Core',
36
+ address: '0x4881Ef0BF6d2365D3dd6499ccd7532bcdBCE0658',
37
+ asset: 'ETH',
38
+ deploymentBlock: 19541126,
39
+ };
40
+ exports.MORPHO_VAULT_GAUNTLET_WETH_PRIME = {
41
+ type: types_1.MorphoVaultType.MorphoVaultGauntletWETHPrime,
42
+ name: 'Gauntlet WETH Prime',
43
+ address: '0x2371e134e3455e0593363cBF89d3b6cf53740618',
44
+ asset: 'ETH',
45
+ deploymentBlock: 19372149,
46
+ };
47
+ exports.MORPHO_VAULT_BOOSTED_USDC = {
48
+ type: types_1.MorphoVaultType.MorphoVaultBoostedUSDC,
49
+ name: 'Boosted USDC',
50
+ address: '0xd63070114470f685b75B74D60EEc7c1113d33a3D',
51
+ asset: 'USDC',
52
+ deploymentBlock: 20377233,
53
+ };
54
+ exports.MORPHO_VAULT_STEAKHOUSE_PYUSD = {
55
+ type: types_1.MorphoVaultType.MorphoVaultSteakhousePYUSD,
56
+ name: 'Steakhouse PYUSD',
57
+ address: '0xbEEF02e5E13584ab96848af90261f0C8Ee04722a',
58
+ asset: 'PYUSD',
59
+ deploymentBlock: 19043398,
60
+ };
61
+ exports.MORPHO_VAULT_FLAGSHIP_USDT = {
62
+ type: types_1.MorphoVaultType.MorphoVaultFlagshipUSDT,
63
+ name: 'Flagship USDT',
64
+ address: '0x2C25f6C25770fFEC5959D34B94Bf898865e5D6b1',
65
+ asset: 'USDT',
66
+ deploymentBlock: 19127039,
67
+ };
68
+ exports.MORPHO_VAULT_STEAKHOUSE_USDT = {
69
+ type: types_1.MorphoVaultType.MorphoVaultSteakhouseUSDT,
70
+ name: 'Steakhouse USDT',
71
+ address: '0xbEef047a543E45807105E51A8BBEFCc5950fcfBa',
72
+ asset: 'USDT',
73
+ deploymentBlock: 19043398,
74
+ };
75
+ exports.MORPHO_VAULT_GAUNTLET_USDA_CORE = {
76
+ type: types_1.MorphoVaultType.MorphoVaultGauntletUSDACore,
77
+ name: 'Gauntlet USDA Core',
78
+ address: '0x125D41A6e5dbf455cD9Df8F80BCC6fd172D52Cc6',
79
+ asset: 'USDA',
80
+ deploymentBlock: 19633608,
81
+ };
82
+ exports.MORPHO_VAULT_GAUNTLET_USDT_PRIME = {
83
+ type: types_1.MorphoVaultType.MorphoVaultGauntletUSDTPrime,
84
+ name: 'Gauntlet USDT Prime',
85
+ address: '0x8CB3649114051cA5119141a34C200D65dc0Faa73',
86
+ asset: 'USDT',
87
+ deploymentBlock: 19486541,
88
+ };
89
+ exports.MORPHO_VAULT_GAUNTLET_RESOLV_USDC = {
90
+ type: types_1.MorphoVaultType.MorphoVaultGauntletResolvUSDC,
91
+ name: 'Gauntlet Resolv USDC',
92
+ address: '0x132E6C9C33A62D7727cd359b1f51e5B566E485Eb',
93
+ asset: 'USDC',
94
+ deploymentBlock: 21487882,
95
+ };
96
+ exports.MORPHO_VAULTS = {
97
+ [types_1.MorphoVaultType.MorphoVaultFlagshipEth]: exports.MORPHO_VAULT_FLAGSHIP_ETH,
98
+ [types_1.MorphoVaultType.MorphoVaultGauntletUSDCCore]: exports.MORPHO_VAULT_GAUNTLET_USDC_CORE,
99
+ [types_1.MorphoVaultType.MorphoVaultGauntletUSDCPrime]: exports.MORPHO_VAULT_GAUNTLET_USDC_PRIME,
100
+ [types_1.MorphoVaultType.MorphoVaultRe7Weth]: exports.MORPHO_VAULT_RE7_WETH,
101
+ [types_1.MorphoVaultType.MorphoVaultGauntletWETHCore]: exports.MORPHO_VAULT_GAUNTLET_WETH_CORE,
102
+ [types_1.MorphoVaultType.MorphoVaultGauntletWETHPrime]: exports.MORPHO_VAULT_GAUNTLET_WETH_PRIME,
103
+ [types_1.MorphoVaultType.MorphoVaultBoostedUSDC]: exports.MORPHO_VAULT_BOOSTED_USDC,
104
+ [types_1.MorphoVaultType.MorphoVaultSteakhousePYUSD]: exports.MORPHO_VAULT_STEAKHOUSE_PYUSD,
105
+ [types_1.MorphoVaultType.MorphoVaultFlagshipUSDT]: exports.MORPHO_VAULT_FLAGSHIP_USDT,
106
+ [types_1.MorphoVaultType.MorphoVaultSteakhouseUSDT]: exports.MORPHO_VAULT_STEAKHOUSE_USDT,
107
+ [types_1.MorphoVaultType.MorphoVaultGauntletUSDACore]: exports.MORPHO_VAULT_GAUNTLET_USDA_CORE,
108
+ [types_1.MorphoVaultType.MorphoVaultGauntletUSDTPrime]: exports.MORPHO_VAULT_GAUNTLET_USDT_PRIME,
109
+ [types_1.MorphoVaultType.MorphoVaultGauntletResolvUSDC]: exports.MORPHO_VAULT_GAUNTLET_RESOLV_USDC,
110
+ };
111
+ const getMorphoVault = (type) => exports.MORPHO_VAULTS[type];
112
+ exports.getMorphoVault = getMorphoVault;
@@ -0,0 +1,9 @@
1
+ import { Client } from 'viem';
2
+ import { SavingsVaultData, YearnVault } from '../../types';
3
+ import { EthAddress, EthereumProvider, NetworkNumber } from '../../types/common';
4
+ import * as yearnVaultsOptions from './options';
5
+ export { yearnVaultsOptions, };
6
+ export declare const _getYearnVaultData: (provider: Client, network: NetworkNumber, yearnVault: YearnVault, accounts: EthAddress[]) => Promise<SavingsVaultData>;
7
+ export declare function getYearnVaultData(provider: EthereumProvider, network: NetworkNumber, yearnVault: YearnVault, accounts: EthAddress[]): Promise<SavingsVaultData>;
8
+ export declare const _getYearnVaultExchangeRate: (provider: Client, yearnVault: YearnVault) => Promise<string>;
9
+ export declare function getYearnVaultExchangeRate(provider: EthereumProvider, network: NetworkNumber, yearnVault: YearnVault): Promise<string>;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports._getYearnVaultExchangeRate = exports._getYearnVaultData = exports.yearnVaultsOptions = void 0;
49
+ exports.getYearnVaultData = getYearnVaultData;
50
+ exports.getYearnVaultExchangeRate = getYearnVaultExchangeRate;
51
+ const decimal_js_1 = __importDefault(require("decimal.js"));
52
+ const tokens_1 = require("@defisaver/tokens");
53
+ const viem_1 = require("../../services/viem");
54
+ const yearnVaultsOptions = __importStar(require("./options"));
55
+ exports.yearnVaultsOptions = yearnVaultsOptions;
56
+ const contracts_1 = require("../../contracts");
57
+ const _getYearnVaultData = (provider, network, yearnVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
58
+ const yearnVaultContract = (0, contracts_1.getYearnVaultContractViem)(provider, yearnVault.address);
59
+ const viewContract = (0, contracts_1.YearnViewContractViem)(provider, network);
60
+ const yvAmountsWei = {};
61
+ const [tokenSupply, underlyingSupply, poolLiquidity] = yield Promise.all([
62
+ yearnVaultContract.read.totalSupply(),
63
+ yearnVaultContract.read.totalAssets(),
64
+ viewContract.read.getPoolLiquidity([yearnVault.address]),
65
+ ...accounts.map((account) => __awaiter(void 0, void 0, void 0, function* () {
66
+ const yvAmount = yield yearnVaultContract.read.balanceOf([account]);
67
+ yvAmountsWei[account] = yvAmount;
68
+ })),
69
+ ]);
70
+ const exchangeRate = new decimal_js_1.default(underlyingSupply).div(tokenSupply).toString();
71
+ const poolSize = (0, tokens_1.assetAmountInEth)(underlyingSupply.toString(), yearnVault.asset);
72
+ const liquidity = (0, tokens_1.assetAmountInEth)(poolLiquidity.toString(), yearnVault.asset);
73
+ const supplied = {};
74
+ accounts.forEach((account) => {
75
+ const yvAmountWei = yvAmountsWei[account] || BigInt(0);
76
+ const underlyingAmountWei = new decimal_js_1.default(yvAmountWei).mul(exchangeRate).toString();
77
+ supplied[account.toLowerCase()] = (0, tokens_1.assetAmountInEth)(underlyingAmountWei, yearnVault.asset);
78
+ });
79
+ return {
80
+ poolSize,
81
+ liquidity,
82
+ supplied,
83
+ asset: yearnVault.asset,
84
+ optionType: yearnVault.type,
85
+ };
86
+ });
87
+ exports._getYearnVaultData = _getYearnVaultData;
88
+ function getYearnVaultData(provider, network, yearnVault, accounts) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ return (0, exports._getYearnVaultData)((0, viem_1.getViemProvider)(provider, network, {
91
+ batch: {
92
+ multicall: {
93
+ batchSize: 2500000,
94
+ },
95
+ },
96
+ }), network, yearnVault, accounts);
97
+ });
98
+ }
99
+ const _getYearnVaultExchangeRate = (provider, yearnVault) => __awaiter(void 0, void 0, void 0, function* () {
100
+ const yearnVaultContract = (0, contracts_1.getYearnVaultContractViem)(provider, yearnVault.address);
101
+ const [tokenSupply, underlyingSupply] = yield Promise.all([
102
+ yearnVaultContract.read.totalSupply(),
103
+ yearnVaultContract.read.totalAssets(),
104
+ ]);
105
+ const exchangeRate = new decimal_js_1.default(underlyingSupply).div(tokenSupply).toString();
106
+ return exchangeRate;
107
+ });
108
+ exports._getYearnVaultExchangeRate = _getYearnVaultExchangeRate;
109
+ function getYearnVaultExchangeRate(provider, network, yearnVault) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ return (0, exports._getYearnVaultExchangeRate)((0, viem_1.getViemProvider)(provider, network), yearnVault);
112
+ });
113
+ }
@@ -0,0 +1,6 @@
1
+ import { YearnVault, YearnVaultType } from '../../types/savings/yearnVaults';
2
+ export declare const YEARN_VAULT_DAI: YearnVault;
3
+ export declare const YEARN_VAULT_USDC: YearnVault;
4
+ export declare const YEARN_VAULT_USDT: YearnVault;
5
+ export declare const YEARN_VAULTS: Record<YearnVaultType, YearnVault>;
6
+ export declare const getYearnVault: (type: YearnVaultType) => YearnVault;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getYearnVault = exports.YEARN_VAULTS = exports.YEARN_VAULT_USDT = exports.YEARN_VAULT_USDC = exports.YEARN_VAULT_DAI = void 0;
4
+ const yearnVaults_1 = require("../../types/savings/yearnVaults");
5
+ exports.YEARN_VAULT_DAI = {
6
+ type: yearnVaults_1.YearnVaultType.YearnVaultDAI,
7
+ address: '0xdA816459F1AB5631232FE5e97a05BBBb94970c95',
8
+ asset: 'DAI',
9
+ deploymentBlock: 12796965,
10
+ };
11
+ exports.YEARN_VAULT_USDC = {
12
+ type: yearnVaults_1.YearnVaultType.YearnVaultUSDC,
13
+ address: '0xa354F35829Ae975e850e23e9615b11Da1B3dC4DE',
14
+ asset: 'USDC',
15
+ deploymentBlock: 13513457,
16
+ };
17
+ exports.YEARN_VAULT_USDT = {
18
+ type: yearnVaults_1.YearnVaultType.YearnVaultUSDT,
19
+ address: '0x3B27F92C0e212C671EA351827EDF93DB27cc0c65',
20
+ asset: 'USDT',
21
+ deploymentBlock: 14980240,
22
+ };
23
+ exports.YEARN_VAULTS = {
24
+ [yearnVaults_1.YearnVaultType.YearnVaultDAI]: exports.YEARN_VAULT_DAI,
25
+ [yearnVaults_1.YearnVaultType.YearnVaultUSDC]: exports.YEARN_VAULT_USDC,
26
+ [yearnVaults_1.YearnVaultType.YearnVaultUSDT]: exports.YEARN_VAULT_USDT,
27
+ };
28
+ const getYearnVault = (type) => exports.YEARN_VAULTS[type];
29
+ exports.getYearnVault = getYearnVault;
@@ -12,3 +12,4 @@ export * from './fluid';
12
12
  export * from './portfolio';
13
13
  export * from './merit';
14
14
  export * from './merkl';
15
+ export * from './savings';
@@ -28,3 +28,4 @@ __exportStar(require("./fluid"), exports);
28
28
  __exportStar(require("./portfolio"), exports);
29
29
  __exportStar(require("./merit"), exports);
30
30
  __exportStar(require("./merkl"), exports);
31
+ __exportStar(require("./savings"), exports);
@@ -0,0 +1,15 @@
1
+ import { EthAddress } from '../common';
2
+ import { MakerDsrType } from './makerDsr';
3
+ import { MorphoVaultType } from './morphoVaults';
4
+ import { YearnVaultType } from './yearnVaults';
5
+ export * from './morphoVaults';
6
+ export * from './yearnVaults';
7
+ export * from './makerDsr';
8
+ export interface SavingsVaultData {
9
+ poolSize: string;
10
+ liquidity: string;
11
+ supplied: Record<EthAddress, string>;
12
+ asset: string;
13
+ optionType: string;
14
+ }
15
+ export type SavingsData = Partial<Record<MorphoVaultType | YearnVaultType | MakerDsrType, SavingsVaultData>>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./morphoVaults"), exports);
18
+ __exportStar(require("./yearnVaults"), exports);
19
+ __exportStar(require("./makerDsr"), exports);
@@ -0,0 +1,11 @@
1
+ import { EthAddress } from '../common';
2
+ export declare enum MakerDsrType {
3
+ MakerDsrVault = "maker_dsr"
4
+ }
5
+ export interface MakerDsrVault {
6
+ type: MakerDsrType;
7
+ name: string;
8
+ address: EthAddress;
9
+ asset: string;
10
+ deploymentBlock: number;
11
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MakerDsrType = void 0;
4
+ var MakerDsrType;
5
+ (function (MakerDsrType) {
6
+ MakerDsrType["MakerDsrVault"] = "maker_dsr";
7
+ })(MakerDsrType || (exports.MakerDsrType = MakerDsrType = {}));
@@ -0,0 +1,23 @@
1
+ import { EthAddress } from '../common';
2
+ export declare enum MorphoVaultType {
3
+ MorphoVaultFlagshipEth = "morpho_vault_flagship_eth",
4
+ MorphoVaultGauntletUSDCCore = "morpho_vault_gauntlet_usdc_core",
5
+ MorphoVaultGauntletUSDCPrime = "morpho_vault_gauntlet_usdc_prime",
6
+ MorphoVaultRe7Weth = "morpho_vault_re7_weth",
7
+ MorphoVaultGauntletWETHCore = "morpho_vault_gauntlet_weth_core",
8
+ MorphoVaultGauntletWETHPrime = "morpho_vault_gauntlet_weth_prime",
9
+ MorphoVaultBoostedUSDC = "morpho_vault_usual_boosted_usdc",
10
+ MorphoVaultSteakhousePYUSD = "morpho_vault_steakhouse_pyusd",
11
+ MorphoVaultFlagshipUSDT = "morpho_vault_flagship_usdt",
12
+ MorphoVaultSteakhouseUSDT = "morpho_vault_steakhouse_usdt",
13
+ MorphoVaultGauntletUSDACore = "morpho_vault_gauntlet_usda_core",
14
+ MorphoVaultGauntletUSDTPrime = "morpho_vault_gauntlet_usdt_prime",
15
+ MorphoVaultGauntletResolvUSDC = "morpho_vault_gauntlet_resolv_usdc"
16
+ }
17
+ export interface MorphoVault {
18
+ type: MorphoVaultType;
19
+ name: string;
20
+ address: EthAddress;
21
+ asset: string;
22
+ deploymentBlock: number;
23
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MorphoVaultType = void 0;
4
+ var MorphoVaultType;
5
+ (function (MorphoVaultType) {
6
+ MorphoVaultType["MorphoVaultFlagshipEth"] = "morpho_vault_flagship_eth";
7
+ MorphoVaultType["MorphoVaultGauntletUSDCCore"] = "morpho_vault_gauntlet_usdc_core";
8
+ MorphoVaultType["MorphoVaultGauntletUSDCPrime"] = "morpho_vault_gauntlet_usdc_prime";
9
+ MorphoVaultType["MorphoVaultRe7Weth"] = "morpho_vault_re7_weth";
10
+ MorphoVaultType["MorphoVaultGauntletWETHCore"] = "morpho_vault_gauntlet_weth_core";
11
+ MorphoVaultType["MorphoVaultGauntletWETHPrime"] = "morpho_vault_gauntlet_weth_prime";
12
+ MorphoVaultType["MorphoVaultBoostedUSDC"] = "morpho_vault_usual_boosted_usdc";
13
+ MorphoVaultType["MorphoVaultSteakhousePYUSD"] = "morpho_vault_steakhouse_pyusd";
14
+ MorphoVaultType["MorphoVaultFlagshipUSDT"] = "morpho_vault_flagship_usdt";
15
+ MorphoVaultType["MorphoVaultSteakhouseUSDT"] = "morpho_vault_steakhouse_usdt";
16
+ MorphoVaultType["MorphoVaultGauntletUSDACore"] = "morpho_vault_gauntlet_usda_core";
17
+ MorphoVaultType["MorphoVaultGauntletUSDTPrime"] = "morpho_vault_gauntlet_usdt_prime";
18
+ MorphoVaultType["MorphoVaultGauntletResolvUSDC"] = "morpho_vault_gauntlet_resolv_usdc";
19
+ })(MorphoVaultType || (exports.MorphoVaultType = MorphoVaultType = {}));
@@ -0,0 +1,12 @@
1
+ import { EthAddress } from '../common';
2
+ export declare enum YearnVaultType {
3
+ YearnVaultDAI = "yearn_vault_dai",
4
+ YearnVaultUSDC = "yearn_vault_usdc",
5
+ YearnVaultUSDT = "yearn_vault_usdt"
6
+ }
7
+ export interface YearnVault {
8
+ type: YearnVaultType;
9
+ address: EthAddress;
10
+ asset: string;
11
+ deploymentBlock: number;
12
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.YearnVaultType = void 0;
4
+ var YearnVaultType;
5
+ (function (YearnVaultType) {
6
+ YearnVaultType["YearnVaultDAI"] = "yearn_vault_dai";
7
+ YearnVaultType["YearnVaultUSDC"] = "yearn_vault_usdc";
8
+ YearnVaultType["YearnVaultUSDT"] = "yearn_vault_usdt";
9
+ })(YearnVaultType || (exports.YearnVaultType = YearnVaultType = {}));
@@ -85162,3 +85162,176 @@ export declare const StkAAVE: {
85162
85162
  };
85163
85163
  };
85164
85164
  };
85165
+ export declare const MorphoVault: {
85166
+ readonly abi: readonly [{
85167
+ readonly inputs: readonly [];
85168
+ readonly name: "acceptTimelock";
85169
+ readonly outputs: readonly [];
85170
+ readonly stateMutability: "nonpayable";
85171
+ readonly type: "function";
85172
+ }, {
85173
+ readonly inputs: readonly [{
85174
+ readonly internalType: "address";
85175
+ readonly name: "account";
85176
+ readonly type: "address";
85177
+ }];
85178
+ readonly name: "balanceOf";
85179
+ readonly outputs: readonly [{
85180
+ readonly internalType: "uint256";
85181
+ readonly name: "";
85182
+ readonly type: "uint256";
85183
+ }];
85184
+ readonly stateMutability: "view";
85185
+ readonly type: "function";
85186
+ }, {
85187
+ readonly inputs: readonly [{
85188
+ readonly internalType: "uint256";
85189
+ readonly name: "shares";
85190
+ readonly type: "uint256";
85191
+ }];
85192
+ readonly name: "convertToAssets";
85193
+ readonly outputs: readonly [{
85194
+ readonly internalType: "uint256";
85195
+ readonly name: "";
85196
+ readonly type: "uint256";
85197
+ }];
85198
+ readonly stateMutability: "view";
85199
+ readonly type: "function";
85200
+ }, {
85201
+ readonly inputs: readonly [];
85202
+ readonly name: "decimals";
85203
+ readonly outputs: readonly [{
85204
+ readonly internalType: "uint8";
85205
+ readonly name: "";
85206
+ readonly type: "uint8";
85207
+ }];
85208
+ readonly stateMutability: "view";
85209
+ readonly type: "function";
85210
+ }, {
85211
+ readonly inputs: readonly [];
85212
+ readonly name: "DECIMALS_OFFSET";
85213
+ readonly outputs: readonly [{
85214
+ readonly internalType: "uint8";
85215
+ readonly name: "";
85216
+ readonly type: "uint8";
85217
+ }];
85218
+ readonly stateMutability: "view";
85219
+ readonly type: "function";
85220
+ }, {
85221
+ readonly inputs: readonly [{
85222
+ readonly internalType: "uint256";
85223
+ readonly name: "shares";
85224
+ readonly type: "uint256";
85225
+ }];
85226
+ readonly name: "previewRedeem";
85227
+ readonly outputs: readonly [{
85228
+ readonly internalType: "uint256";
85229
+ readonly name: "";
85230
+ readonly type: "uint256";
85231
+ }];
85232
+ readonly stateMutability: "view";
85233
+ readonly type: "function";
85234
+ }, {
85235
+ readonly inputs: readonly [];
85236
+ readonly name: "totalAssets";
85237
+ readonly outputs: readonly [{
85238
+ readonly internalType: "uint256";
85239
+ readonly name: "";
85240
+ readonly type: "uint256";
85241
+ }];
85242
+ readonly stateMutability: "view";
85243
+ readonly type: "function";
85244
+ }, {
85245
+ readonly inputs: readonly [];
85246
+ readonly name: "totalSupply";
85247
+ readonly outputs: readonly [{
85248
+ readonly internalType: "uint256";
85249
+ readonly name: "";
85250
+ readonly type: "uint256";
85251
+ }];
85252
+ readonly stateMutability: "view";
85253
+ readonly type: "function";
85254
+ }];
85255
+ };
85256
+ export declare const YearnVault: {
85257
+ readonly abi: readonly [{
85258
+ readonly stateMutability: "view";
85259
+ readonly type: "function";
85260
+ readonly name: "balanceOf";
85261
+ readonly inputs: readonly [{
85262
+ readonly name: "arg0";
85263
+ readonly type: "address";
85264
+ }];
85265
+ readonly outputs: readonly [{
85266
+ readonly name: "";
85267
+ readonly type: "uint256";
85268
+ }];
85269
+ readonly gas: 3923;
85270
+ }, {
85271
+ readonly stateMutability: "view";
85272
+ readonly type: "function";
85273
+ readonly name: "totalAssets";
85274
+ readonly inputs: readonly [];
85275
+ readonly outputs: readonly [{
85276
+ readonly name: "";
85277
+ readonly type: "uint256";
85278
+ }];
85279
+ readonly gas: 8698;
85280
+ }, {
85281
+ readonly stateMutability: "view";
85282
+ readonly type: "function";
85283
+ readonly name: "totalSupply";
85284
+ readonly inputs: readonly [];
85285
+ readonly outputs: readonly [{
85286
+ readonly name: "";
85287
+ readonly type: "uint256";
85288
+ }];
85289
+ readonly gas: 3768;
85290
+ }];
85291
+ };
85292
+ export declare const YearnView: {
85293
+ readonly abi: readonly [{
85294
+ readonly inputs: readonly [{
85295
+ readonly internalType: "address";
85296
+ readonly name: "_vault";
85297
+ readonly type: "address";
85298
+ }];
85299
+ readonly name: "getPoolLiquidity";
85300
+ readonly outputs: readonly [{
85301
+ readonly internalType: "uint256";
85302
+ readonly name: "";
85303
+ readonly type: "uint256";
85304
+ }];
85305
+ readonly stateMutability: "view";
85306
+ readonly type: "function";
85307
+ }];
85308
+ readonly networks: {
85309
+ readonly "1": {
85310
+ readonly address: "0x36314D468E1da48Fb637fFB7c7DBDF222eC3FFe7";
85311
+ };
85312
+ };
85313
+ };
85314
+ export declare const MakerDsr: {
85315
+ abi: {
85316
+ constant: boolean;
85317
+ inputs: {
85318
+ internalType: string;
85319
+ name: string;
85320
+ type: string;
85321
+ }[];
85322
+ name: string;
85323
+ outputs: {
85324
+ internalType: string;
85325
+ name: string;
85326
+ type: string;
85327
+ }[];
85328
+ payable: boolean;
85329
+ stateMutability: string;
85330
+ type: string;
85331
+ }[];
85332
+ networks: {
85333
+ "1": {
85334
+ address: string;
85335
+ };
85336
+ };
85337
+ };
@@ -1256,3 +1256,25 @@ export const StkAAVE = {
1256
1256
  }
1257
1257
  }
1258
1258
  };
1259
+ export const MorphoVault = {
1260
+ "abi": [{ "inputs": [], "name": "acceptTimelock", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], "name": "convertToAssets", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DECIMALS_OFFSET", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], "name": "previewRedeem", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalAssets", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
1261
+ };
1262
+ export const YearnVault = {
1263
+ "abi": [{ "stateMutability": "view", "type": "function", "name": "balanceOf", "inputs": [{ "name": "arg0", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }], "gas": 3923 }, { "stateMutability": "view", "type": "function", "name": "totalAssets", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "gas": 8698 }, { "stateMutability": "view", "type": "function", "name": "totalSupply", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "gas": 3768 }]
1264
+ };
1265
+ export const YearnView = {
1266
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "_vault", "type": "address" }], "name": "getPoolLiquidity", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
1267
+ "networks": {
1268
+ "1": {
1269
+ "address": "0x36314D468E1da48Fb637fFB7c7DBDF222eC3FFe7",
1270
+ }
1271
+ }
1272
+ };
1273
+ export const MakerDsr = {
1274
+ "abi": [{ "constant": true, "inputs": [], "name": "chi", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "pie", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "Pie", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }],
1275
+ "networks": {
1276
+ "1": {
1277
+ "address": "0x197e90f9fad81970ba7976f33cbd77088e5d7cf7",
1278
+ }
1279
+ }
1280
+ };