@defisaver/positions-sdk 2.1.35 → 2.1.37
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.
- package/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +64 -64
- package/cjs/config/contracts.d.ts +42 -0
- package/cjs/config/contracts.js +4 -1
- package/cjs/contracts.d.ts +205 -0
- package/cjs/contracts.js +11 -2
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/savings/index.d.ts +3 -2
- package/cjs/savings/index.js +3 -1
- package/cjs/savings/morphoVaults/index.js +17 -17
- package/cjs/savings/skyOptions/options.js +1 -0
- package/cjs/savings/yearnV3Vaults/index.d.ts +7 -0
- package/cjs/savings/yearnV3Vaults/index.js +97 -0
- package/cjs/savings/yearnV3Vaults/options.d.ts +8 -0
- package/cjs/savings/yearnV3Vaults/options.js +53 -0
- package/cjs/types/savings/index.d.ts +3 -1
- package/cjs/types/savings/index.js +1 -0
- package/cjs/types/savings/sky.d.ts +1 -0
- package/cjs/types/savings/yearnV3Vaults.d.ts +16 -0
- package/cjs/types/savings/yearnV3Vaults.js +11 -0
- package/esm/config/contracts.d.ts +42 -0
- package/esm/config/contracts.js +3 -0
- package/esm/contracts.d.ts +205 -0
- package/esm/contracts.js +8 -0
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/savings/index.d.ts +3 -2
- package/esm/savings/index.js +2 -1
- package/esm/savings/morphoVaults/index.js +17 -17
- package/esm/savings/skyOptions/options.js +1 -0
- package/esm/savings/yearnV3Vaults/index.d.ts +7 -0
- package/esm/savings/yearnV3Vaults/index.js +56 -0
- package/esm/savings/yearnV3Vaults/options.d.ts +8 -0
- package/esm/savings/yearnV3Vaults/options.js +49 -0
- package/esm/types/savings/index.d.ts +3 -1
- package/esm/types/savings/index.js +1 -0
- package/esm/types/savings/sky.d.ts +1 -0
- package/esm/types/savings/yearnV3Vaults.d.ts +16 -0
- package/esm/types/savings/yearnV3Vaults.js +8 -0
- package/package.json +48 -48
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +625 -625
- package/src/aaveV3/merit.ts +97 -97
- package/src/aaveV3/merkl.ts +74 -74
- package/src/claiming/aaveV3.ts +154 -154
- package/src/claiming/compV3.ts +22 -22
- package/src/claiming/ethena.ts +61 -61
- package/src/claiming/index.ts +12 -12
- package/src/claiming/king.ts +66 -66
- package/src/claiming/morphoBlue.ts +118 -118
- package/src/claiming/spark.ts +225 -225
- package/src/compoundV2/index.ts +244 -244
- package/src/compoundV3/index.ts +274 -274
- package/src/config/contracts.ts +1295 -1292
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +171 -162
- package/src/curveUsd/index.ts +254 -254
- package/src/eulerV2/index.ts +324 -324
- package/src/exchange/index.ts +25 -25
- package/src/fluid/index.ts +1800 -1800
- package/src/helpers/aaveHelpers/index.ts +187 -187
- package/src/helpers/compoundHelpers/index.ts +283 -283
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +222 -222
- package/src/helpers/fluidHelpers/index.ts +326 -326
- package/src/helpers/index.ts +10 -10
- package/src/helpers/liquityV2Helpers/index.ts +82 -82
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +52 -52
- package/src/helpers/morphoBlueHelpers/index.ts +396 -396
- package/src/helpers/sparkHelpers/index.ts +158 -158
- package/src/index.ts +49 -49
- package/src/liquity/index.ts +159 -159
- package/src/liquityV2/index.ts +703 -703
- package/src/llamaLend/index.ts +305 -305
- package/src/maker/index.ts +223 -223
- package/src/markets/aave/index.ts +118 -118
- package/src/markets/aave/marketAssets.ts +54 -54
- package/src/markets/compound/index.ts +243 -243
- package/src/markets/compound/marketsAssets.ts +97 -97
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2900 -2900
- package/src/markets/index.ts +25 -25
- package/src/markets/liquityV2/index.ts +102 -102
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +971 -971
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +85 -85
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +598 -598
- package/src/savings/index.ts +84 -82
- package/src/savings/makerDsr/index.ts +53 -53
- package/src/savings/makerDsr/options.ts +9 -9
- package/src/savings/morphoVaults/index.ts +80 -80
- package/src/savings/morphoVaults/options.ts +203 -203
- package/src/savings/skyOptions/index.ts +95 -95
- package/src/savings/skyOptions/options.ts +10 -9
- package/src/savings/sparkSavingsVaults/index.ts +60 -60
- package/src/savings/sparkSavingsVaults/options.ts +35 -35
- package/src/savings/yearnV3Vaults/index.ts +61 -0
- package/src/savings/yearnV3Vaults/options.ts +56 -0
- package/src/savings/yearnVaults/index.ts +73 -73
- package/src/savings/yearnVaults/options.ts +32 -32
- package/src/services/priceService.ts +278 -278
- package/src/services/utils.ts +115 -115
- package/src/services/viem.ts +34 -34
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +456 -456
- package/src/staking/eligibility.ts +53 -53
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +186 -186
- package/src/types/aave.ts +196 -196
- package/src/types/claiming.ts +114 -114
- package/src/types/common.ts +107 -107
- package/src/types/compound.ts +144 -144
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +175 -175
- package/src/types/fluid.ts +483 -483
- package/src/types/index.ts +14 -14
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +126 -126
- package/src/types/llamaLend.ts +159 -159
- package/src/types/maker.ts +63 -63
- package/src/types/merit.ts +1 -1
- package/src/types/merkl.ts +70 -70
- package/src/types/morphoBlue.ts +200 -200
- package/src/types/portfolio.ts +60 -60
- package/src/types/savings/index.ts +24 -22
- package/src/types/savings/makerDsr.ts +13 -13
- package/src/types/savings/morphoVaults.ts +33 -33
- package/src/types/savings/sky.ts +14 -13
- package/src/types/savings/sparkSavingsVaults.ts +15 -15
- package/src/types/savings/yearnV3Vaults.ts +18 -0
- package/src/types/savings/yearnVaults.ts +14 -14
- package/src/types/spark.ts +133 -133
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
|
@@ -128,73 +128,73 @@ const getApyAfterValuesEstimation = (selectedMarket, actions, provider, network)
|
|
|
128
128
|
});
|
|
129
129
|
exports.getApyAfterValuesEstimation = getApyAfterValuesEstimation;
|
|
130
130
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
131
|
-
const MARKET_QUERY = `
|
|
132
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
133
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
134
|
-
reallocatableLiquidityAssets
|
|
135
|
-
targetBorrowUtilization
|
|
136
|
-
loanAsset {
|
|
137
|
-
address
|
|
138
|
-
decimals
|
|
139
|
-
priceUsd
|
|
140
|
-
}
|
|
141
|
-
state {
|
|
142
|
-
liquidityAssets
|
|
143
|
-
borrowAssets
|
|
144
|
-
supplyAssets
|
|
145
|
-
}
|
|
146
|
-
publicAllocatorSharedLiquidity {
|
|
147
|
-
assets
|
|
148
|
-
vault {
|
|
149
|
-
address
|
|
150
|
-
name
|
|
151
|
-
}
|
|
152
|
-
allocationMarket {
|
|
153
|
-
uniqueKey
|
|
154
|
-
loanAsset {
|
|
155
|
-
address
|
|
156
|
-
}
|
|
157
|
-
collateralAsset {
|
|
158
|
-
address
|
|
159
|
-
}
|
|
160
|
-
irmAddress
|
|
161
|
-
oracle {
|
|
162
|
-
address
|
|
163
|
-
}
|
|
164
|
-
lltv
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
loanAsset {
|
|
168
|
-
address
|
|
169
|
-
}
|
|
170
|
-
collateralAsset {
|
|
171
|
-
address
|
|
172
|
-
}
|
|
173
|
-
oracle {
|
|
174
|
-
address
|
|
175
|
-
}
|
|
176
|
-
irmAddress
|
|
177
|
-
lltv
|
|
178
|
-
}
|
|
179
|
-
}
|
|
131
|
+
const MARKET_QUERY = `
|
|
132
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
133
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
134
|
+
reallocatableLiquidityAssets
|
|
135
|
+
targetBorrowUtilization
|
|
136
|
+
loanAsset {
|
|
137
|
+
address
|
|
138
|
+
decimals
|
|
139
|
+
priceUsd
|
|
140
|
+
}
|
|
141
|
+
state {
|
|
142
|
+
liquidityAssets
|
|
143
|
+
borrowAssets
|
|
144
|
+
supplyAssets
|
|
145
|
+
}
|
|
146
|
+
publicAllocatorSharedLiquidity {
|
|
147
|
+
assets
|
|
148
|
+
vault {
|
|
149
|
+
address
|
|
150
|
+
name
|
|
151
|
+
}
|
|
152
|
+
allocationMarket {
|
|
153
|
+
uniqueKey
|
|
154
|
+
loanAsset {
|
|
155
|
+
address
|
|
156
|
+
}
|
|
157
|
+
collateralAsset {
|
|
158
|
+
address
|
|
159
|
+
}
|
|
160
|
+
irmAddress
|
|
161
|
+
oracle {
|
|
162
|
+
address
|
|
163
|
+
}
|
|
164
|
+
lltv
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
loanAsset {
|
|
168
|
+
address
|
|
169
|
+
}
|
|
170
|
+
collateralAsset {
|
|
171
|
+
address
|
|
172
|
+
}
|
|
173
|
+
oracle {
|
|
174
|
+
address
|
|
175
|
+
}
|
|
176
|
+
irmAddress
|
|
177
|
+
lltv
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
180
|
`;
|
|
181
|
-
const REWARDS_QUERY = `
|
|
182
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
183
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
184
|
-
uniqueKey
|
|
185
|
-
state {
|
|
186
|
-
rewards {
|
|
187
|
-
amountPerSuppliedToken
|
|
188
|
-
supplyApr
|
|
189
|
-
amountPerBorrowedToken
|
|
190
|
-
borrowApr
|
|
191
|
-
asset {
|
|
192
|
-
address
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
181
|
+
const REWARDS_QUERY = `
|
|
182
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
183
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
184
|
+
uniqueKey
|
|
185
|
+
state {
|
|
186
|
+
rewards {
|
|
187
|
+
amountPerSuppliedToken
|
|
188
|
+
supplyApr
|
|
189
|
+
amountPerBorrowedToken
|
|
190
|
+
borrowApr
|
|
191
|
+
asset {
|
|
192
|
+
address
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
198
|
`;
|
|
199
199
|
/**
|
|
200
200
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
package/cjs/savings/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ import * as yearnVaults from './yearnVaults';
|
|
|
5
5
|
import * as makerDsr from './makerDsr';
|
|
6
6
|
import * as skyOptions from './skyOptions';
|
|
7
7
|
import * as sparkSavingsVaults from './sparkSavingsVaults';
|
|
8
|
-
|
|
9
|
-
export
|
|
8
|
+
import * as yearnV3Vaults from './yearnV3Vaults';
|
|
9
|
+
export { morphoVaults, yearnVaults, makerDsr, skyOptions, sparkSavingsVaults, yearnV3Vaults, };
|
|
10
|
+
export declare const getSavingsData: (provider: EthereumProvider, network: NetworkNumber, accounts: EthAddress[]) => Promise<Partial<Record<MakerDsrType | MorphoVaultType | SkySavingsType | SparkSavingsVaultType | import("../types").YearnV3VaultType | YearnVaultType, import("../types").SavingsVaultData>>>;
|
package/cjs/savings/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.getSavingsData = exports.sparkSavingsVaults = exports.skyOptions = exports.makerDsr = exports.yearnVaults = exports.morphoVaults = void 0;
|
|
45
|
+
exports.getSavingsData = exports.yearnV3Vaults = exports.sparkSavingsVaults = exports.skyOptions = exports.makerDsr = exports.yearnVaults = exports.morphoVaults = void 0;
|
|
46
46
|
const types_1 = require("../types");
|
|
47
47
|
const morphoVaults = __importStar(require("./morphoVaults"));
|
|
48
48
|
exports.morphoVaults = morphoVaults;
|
|
@@ -54,6 +54,8 @@ const skyOptions = __importStar(require("./skyOptions"));
|
|
|
54
54
|
exports.skyOptions = skyOptions;
|
|
55
55
|
const sparkSavingsVaults = __importStar(require("./sparkSavingsVaults"));
|
|
56
56
|
exports.sparkSavingsVaults = sparkSavingsVaults;
|
|
57
|
+
const yearnV3Vaults = __importStar(require("./yearnV3Vaults"));
|
|
58
|
+
exports.yearnV3Vaults = yearnV3Vaults;
|
|
57
59
|
const getSavingsData = (provider, network, accounts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
60
|
const morphoVaultsList = Object.keys(morphoVaults.morphoVaultsOptions.MORPHO_VAULTS);
|
|
59
61
|
const yearnVaultsList = Object.keys(yearnVaults.yearnVaultsOptions.YEARN_VAULTS);
|
|
@@ -54,23 +54,23 @@ const morphoVaultsOptions = __importStar(require("./options"));
|
|
|
54
54
|
exports.morphoVaultsOptions = morphoVaultsOptions;
|
|
55
55
|
const viem_1 = require("../../services/viem");
|
|
56
56
|
const contracts_1 = require("../../contracts");
|
|
57
|
-
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
58
|
-
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
59
|
-
id,
|
|
60
|
-
dailyApy,
|
|
61
|
-
dailyApys {
|
|
62
|
-
apy, netApy
|
|
63
|
-
},
|
|
64
|
-
monthlyApys {
|
|
65
|
-
apy, netApy
|
|
66
|
-
},
|
|
67
|
-
liquidity {
|
|
68
|
-
underlying, usd,
|
|
69
|
-
},
|
|
70
|
-
asset {
|
|
71
|
-
priceUsd
|
|
72
|
-
}
|
|
73
|
-
}
|
|
57
|
+
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
58
|
+
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
59
|
+
id,
|
|
60
|
+
dailyApy,
|
|
61
|
+
dailyApys {
|
|
62
|
+
apy, netApy
|
|
63
|
+
},
|
|
64
|
+
monthlyApys {
|
|
65
|
+
apy, netApy
|
|
66
|
+
},
|
|
67
|
+
liquidity {
|
|
68
|
+
underlying, usd,
|
|
69
|
+
},
|
|
70
|
+
asset {
|
|
71
|
+
priceUsd
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
74
|
}`;
|
|
75
75
|
const MORPHO_BLUE_API = 'https://blue-api.morpho.org/graphql';
|
|
76
76
|
const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Client } from 'viem';
|
|
2
|
+
import { SavingsVaultData, YearnV3Vault } from '../../types';
|
|
3
|
+
import { EthAddress, EthereumProvider, NetworkNumber } from '../../types/common';
|
|
4
|
+
import * as yearnV3VaultsOptions from './options';
|
|
5
|
+
export { yearnV3VaultsOptions, };
|
|
6
|
+
export declare const _getYearnV3VaultData: (provider: Client, network: NetworkNumber, yearnV3Vault: YearnV3Vault, accounts: EthAddress[]) => Promise<SavingsVaultData>;
|
|
7
|
+
export declare function getYearnV3VaultData(provider: EthereumProvider, network: NetworkNumber, yearnV3Vault: YearnV3Vault, accounts: EthAddress[]): Promise<SavingsVaultData>;
|
|
@@ -0,0 +1,97 @@
|
|
|
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._getYearnV3VaultData = exports.yearnV3VaultsOptions = void 0;
|
|
49
|
+
exports.getYearnV3VaultData = getYearnV3VaultData;
|
|
50
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
51
|
+
const tokens_1 = require("@defisaver/tokens");
|
|
52
|
+
const viem_1 = require("../../services/viem");
|
|
53
|
+
const yearnV3VaultsOptions = __importStar(require("./options"));
|
|
54
|
+
exports.yearnV3VaultsOptions = yearnV3VaultsOptions;
|
|
55
|
+
const contracts_1 = require("../../contracts");
|
|
56
|
+
const _getYearnV3VaultData = (provider, network, yearnV3Vault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
const yearnV3VaultContract = (0, contracts_1.getYearnV3VaultContractViem)(provider, yearnV3Vault.address);
|
|
58
|
+
const shares = {};
|
|
59
|
+
const [totalAssets, totalSupply, totalDebt] = yield Promise.all([
|
|
60
|
+
yearnV3VaultContract.read.totalAssets(),
|
|
61
|
+
yearnV3VaultContract.read.totalSupply(),
|
|
62
|
+
yearnV3VaultContract.read.totalDebt(),
|
|
63
|
+
...accounts.map((account) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
+
const share = yield yearnV3VaultContract.read.balanceOf([account]);
|
|
65
|
+
shares[account] = share;
|
|
66
|
+
})),
|
|
67
|
+
]);
|
|
68
|
+
const poolSize = (0, tokens_1.assetAmountInEth)(totalAssets.toString(), yearnV3Vault.asset);
|
|
69
|
+
const debt = (0, tokens_1.assetAmountInEth)(totalDebt.toString(), yearnV3Vault.asset);
|
|
70
|
+
// DEV: Check if true
|
|
71
|
+
const liquidity = poolSize;
|
|
72
|
+
const supplied = {};
|
|
73
|
+
accounts.forEach((account) => {
|
|
74
|
+
const share = shares[account] || BigInt(0);
|
|
75
|
+
supplied[account.toLowerCase()] = (0, tokens_1.assetAmountInEth)(new decimal_js_1.default(share).mul(totalAssets).div(totalSupply).toFixed()
|
|
76
|
+
.toString(), yearnV3Vault.asset);
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
poolSize,
|
|
80
|
+
supplied,
|
|
81
|
+
liquidity,
|
|
82
|
+
asset: yearnV3Vault.asset,
|
|
83
|
+
optionType: yearnV3Vault.type,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
exports._getYearnV3VaultData = _getYearnV3VaultData;
|
|
87
|
+
function getYearnV3VaultData(provider, network, yearnV3Vault, accounts) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
return (0, exports._getYearnV3VaultData)((0, viem_1.getViemProvider)(provider, network, {
|
|
90
|
+
batch: {
|
|
91
|
+
multicall: {
|
|
92
|
+
batchSize: 2500000,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
}), network, yearnV3Vault, accounts);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { YearnV3Vault, YearnV3VaultType } from '../../types';
|
|
2
|
+
export declare const YEARN_V3_VAULT_USDC: YearnV3Vault;
|
|
3
|
+
export declare const YEARN_V3_VAULT_USDS: YearnV3Vault;
|
|
4
|
+
export declare const YEARN_V3_VAULT_DAI: YearnV3Vault;
|
|
5
|
+
export declare const YEARN_V3_VAULT_USDT: YearnV3Vault;
|
|
6
|
+
export declare const YEARN_V3_VAULT_WETH_1: YearnV3Vault;
|
|
7
|
+
export declare const YEARN_V3_VAULTS: Record<YearnV3VaultType, YearnV3Vault>;
|
|
8
|
+
export declare const getYearnV3Vault: (type: YearnV3VaultType) => YearnV3Vault;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getYearnV3Vault = exports.YEARN_V3_VAULTS = exports.YEARN_V3_VAULT_WETH_1 = exports.YEARN_V3_VAULT_USDT = exports.YEARN_V3_VAULT_DAI = exports.YEARN_V3_VAULT_USDS = exports.YEARN_V3_VAULT_USDC = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
exports.YEARN_V3_VAULT_USDC = {
|
|
6
|
+
type: types_1.YearnV3VaultType.YearnVaultV3USDC,
|
|
7
|
+
name: 'Yearn V3 USDC',
|
|
8
|
+
address: '0xBe53A109B494E5c9f97b9Cd39Fe969BE68BF6204',
|
|
9
|
+
asset: 'USDC',
|
|
10
|
+
deploymentBlock: 19419991,
|
|
11
|
+
isLegacy: false,
|
|
12
|
+
};
|
|
13
|
+
exports.YEARN_V3_VAULT_USDS = {
|
|
14
|
+
type: types_1.YearnV3VaultType.YearnVaultV3USDS,
|
|
15
|
+
name: 'Yearn V3 USDS',
|
|
16
|
+
address: '0x182863131F9a4630fF9E27830d945B1413e347E8',
|
|
17
|
+
asset: 'USDS',
|
|
18
|
+
deploymentBlock: 20917639,
|
|
19
|
+
isLegacy: false,
|
|
20
|
+
};
|
|
21
|
+
exports.YEARN_V3_VAULT_DAI = {
|
|
22
|
+
type: types_1.YearnV3VaultType.YearnVaultV3DAI,
|
|
23
|
+
name: 'Yearn V3 DAI',
|
|
24
|
+
address: '0x028eC7330ff87667b6dfb0D94b954c820195336c',
|
|
25
|
+
asset: 'DAI',
|
|
26
|
+
deploymentBlock: 19419991,
|
|
27
|
+
isLegacy: false,
|
|
28
|
+
};
|
|
29
|
+
exports.YEARN_V3_VAULT_USDT = {
|
|
30
|
+
type: types_1.YearnV3VaultType.YearnVaultV3USDT,
|
|
31
|
+
name: 'Yearn V3 USDT',
|
|
32
|
+
address: '0x310B7Ea7475A0B449Cfd73bE81522F1B88eFAFaa',
|
|
33
|
+
asset: 'USDT',
|
|
34
|
+
deploymentBlock: 20369520,
|
|
35
|
+
isLegacy: false,
|
|
36
|
+
};
|
|
37
|
+
exports.YEARN_V3_VAULT_WETH_1 = {
|
|
38
|
+
type: types_1.YearnV3VaultType.YearnVaultV3WETH_1,
|
|
39
|
+
name: 'Yearn V3 WETH',
|
|
40
|
+
address: '0xc56413869c6CDf96496f2b1eF801fEDBdFA7dDB0',
|
|
41
|
+
asset: 'WETH',
|
|
42
|
+
deploymentBlock: 19419991,
|
|
43
|
+
isLegacy: false,
|
|
44
|
+
};
|
|
45
|
+
exports.YEARN_V3_VAULTS = {
|
|
46
|
+
[types_1.YearnV3VaultType.YearnVaultV3USDC]: exports.YEARN_V3_VAULT_USDC,
|
|
47
|
+
[types_1.YearnV3VaultType.YearnVaultV3USDS]: exports.YEARN_V3_VAULT_USDS,
|
|
48
|
+
[types_1.YearnV3VaultType.YearnVaultV3DAI]: exports.YEARN_V3_VAULT_DAI,
|
|
49
|
+
[types_1.YearnV3VaultType.YearnVaultV3USDT]: exports.YEARN_V3_VAULT_USDT,
|
|
50
|
+
[types_1.YearnV3VaultType.YearnVaultV3WETH_1]: exports.YEARN_V3_VAULT_WETH_1,
|
|
51
|
+
};
|
|
52
|
+
const getYearnV3Vault = (type) => exports.YEARN_V3_VAULTS[type];
|
|
53
|
+
exports.getYearnV3Vault = getYearnV3Vault;
|
|
@@ -3,12 +3,14 @@ import { MakerDsrType } from './makerDsr';
|
|
|
3
3
|
import { MorphoVaultType } from './morphoVaults';
|
|
4
4
|
import { SkySavingsType } from './sky';
|
|
5
5
|
import { SparkSavingsVaultType } from './sparkSavingsVaults';
|
|
6
|
+
import { YearnV3VaultType } from './yearnV3Vaults';
|
|
6
7
|
import { YearnVaultType } from './yearnVaults';
|
|
7
8
|
export * from './morphoVaults';
|
|
8
9
|
export * from './yearnVaults';
|
|
9
10
|
export * from './makerDsr';
|
|
10
11
|
export * from './sky';
|
|
11
12
|
export * from './sparkSavingsVaults';
|
|
13
|
+
export * from './yearnV3Vaults';
|
|
12
14
|
export interface SavingsVaultData {
|
|
13
15
|
poolSize: string;
|
|
14
16
|
liquidity: string;
|
|
@@ -16,4 +18,4 @@ export interface SavingsVaultData {
|
|
|
16
18
|
asset: string;
|
|
17
19
|
optionType: string;
|
|
18
20
|
}
|
|
19
|
-
export type SavingsData = Partial<Record<MorphoVaultType | YearnVaultType | MakerDsrType | SkySavingsType | SparkSavingsVaultType, SavingsVaultData>>;
|
|
21
|
+
export type SavingsData = Partial<Record<MorphoVaultType | YearnVaultType | MakerDsrType | SkySavingsType | SparkSavingsVaultType | YearnV3VaultType, SavingsVaultData>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EthAddress } from '../common';
|
|
2
|
+
export declare enum YearnV3VaultType {
|
|
3
|
+
YearnVaultV3USDC = "yearn_v3_vault_usdc",
|
|
4
|
+
YearnVaultV3USDS = "yearn_v3_vault_usds",
|
|
5
|
+
YearnVaultV3USDT = "yearn_v3_vault_usdt",
|
|
6
|
+
YearnVaultV3DAI = "yearn_v3_vault_dai",
|
|
7
|
+
YearnVaultV3WETH_1 = "yearn_v3_vault_weth_1"
|
|
8
|
+
}
|
|
9
|
+
export interface YearnV3Vault {
|
|
10
|
+
type: YearnV3VaultType;
|
|
11
|
+
address: EthAddress;
|
|
12
|
+
asset: string;
|
|
13
|
+
name: string;
|
|
14
|
+
deploymentBlock: number;
|
|
15
|
+
isLegacy: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.YearnV3VaultType = void 0;
|
|
4
|
+
var YearnV3VaultType;
|
|
5
|
+
(function (YearnV3VaultType) {
|
|
6
|
+
YearnV3VaultType["YearnVaultV3USDC"] = "yearn_v3_vault_usdc";
|
|
7
|
+
YearnV3VaultType["YearnVaultV3USDS"] = "yearn_v3_vault_usds";
|
|
8
|
+
YearnV3VaultType["YearnVaultV3USDT"] = "yearn_v3_vault_usdt";
|
|
9
|
+
YearnV3VaultType["YearnVaultV3DAI"] = "yearn_v3_vault_dai";
|
|
10
|
+
YearnV3VaultType["YearnVaultV3WETH_1"] = "yearn_v3_vault_weth_1";
|
|
11
|
+
})(YearnV3VaultType || (exports.YearnV3VaultType = YearnV3VaultType = {}));
|
|
@@ -85483,3 +85483,45 @@ export declare const SkySavings: {
|
|
|
85483
85483
|
};
|
|
85484
85484
|
};
|
|
85485
85485
|
};
|
|
85486
|
+
export declare const YearnV3Vault: {
|
|
85487
|
+
readonly abi: readonly [{
|
|
85488
|
+
readonly stateMutability: "view";
|
|
85489
|
+
readonly type: "function";
|
|
85490
|
+
readonly name: "balanceOf";
|
|
85491
|
+
readonly inputs: readonly [{
|
|
85492
|
+
readonly name: "addr";
|
|
85493
|
+
readonly type: "address";
|
|
85494
|
+
}];
|
|
85495
|
+
readonly outputs: readonly [{
|
|
85496
|
+
readonly name: "";
|
|
85497
|
+
readonly type: "uint256";
|
|
85498
|
+
}];
|
|
85499
|
+
}, {
|
|
85500
|
+
readonly stateMutability: "view";
|
|
85501
|
+
readonly type: "function";
|
|
85502
|
+
readonly name: "totalAssets";
|
|
85503
|
+
readonly inputs: readonly [];
|
|
85504
|
+
readonly outputs: readonly [{
|
|
85505
|
+
readonly name: "";
|
|
85506
|
+
readonly type: "uint256";
|
|
85507
|
+
}];
|
|
85508
|
+
}, {
|
|
85509
|
+
readonly stateMutability: "view";
|
|
85510
|
+
readonly type: "function";
|
|
85511
|
+
readonly name: "totalDebt";
|
|
85512
|
+
readonly inputs: readonly [];
|
|
85513
|
+
readonly outputs: readonly [{
|
|
85514
|
+
readonly name: "";
|
|
85515
|
+
readonly type: "uint256";
|
|
85516
|
+
}];
|
|
85517
|
+
}, {
|
|
85518
|
+
readonly stateMutability: "view";
|
|
85519
|
+
readonly type: "function";
|
|
85520
|
+
readonly name: "totalSupply";
|
|
85521
|
+
readonly inputs: readonly [];
|
|
85522
|
+
readonly outputs: readonly [{
|
|
85523
|
+
readonly name: "";
|
|
85524
|
+
readonly type: "uint256";
|
|
85525
|
+
}];
|
|
85526
|
+
}];
|
|
85527
|
+
};
|
package/esm/config/contracts.js
CHANGED
|
@@ -1289,3 +1289,6 @@ export const SkySavings = {
|
|
|
1289
1289
|
}
|
|
1290
1290
|
}
|
|
1291
1291
|
};
|
|
1292
|
+
export const YearnV3Vault = {
|
|
1293
|
+
"abi": [{ "stateMutability": "view", "type": "function", "name": "balanceOf", "inputs": [{ "name": "addr", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "totalAssets", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "totalDebt", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }, { "stateMutability": "view", "type": "function", "name": "totalSupply", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }] }]
|
|
1294
|
+
};
|