@morpho-org/blue-sdk 4.5.0 → 4.5.1
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/lib/vault/Vault.d.ts +12 -12
- package/lib/vault/Vault.js +16 -19
- package/package.json +1 -1
package/lib/vault/Vault.d.ts
CHANGED
|
@@ -148,29 +148,29 @@ export declare class AccrualVault extends Vault implements IAccrualVault {
|
|
|
148
148
|
*/
|
|
149
149
|
get liquidity(): bigint;
|
|
150
150
|
/**
|
|
151
|
-
* The MetaMorpho vault's
|
|
152
|
-
*
|
|
151
|
+
* The MetaMorpho vault's current instantaneous Annual Percentage Yield (APY)
|
|
152
|
+
* weighted-averaged over its market deposits, before deducting the performance fee (scaled by WAD).
|
|
153
153
|
* If interested in the APY at a specific timestamp, use `getApy(timestamp)` instead.
|
|
154
154
|
*/
|
|
155
155
|
get apy(): bigint;
|
|
156
156
|
/**
|
|
157
|
-
* The MetaMorpho vault's
|
|
158
|
-
*
|
|
157
|
+
* The MetaMorpho vault's current instantaneous Annual Percentage Yield (APY)
|
|
158
|
+
* weighted-averaged over its market deposits, after deducting the performance fee (scaled by WAD).
|
|
159
159
|
* If interested in the APY at a specific timestamp, use `getApy(timestamp)` instead.
|
|
160
160
|
*/
|
|
161
161
|
get netApy(): bigint;
|
|
162
162
|
/**
|
|
163
|
-
* The MetaMorpho vault's
|
|
164
|
-
*
|
|
165
|
-
* if
|
|
163
|
+
* The MetaMorpho vault's experienced Annual Percentage Yield (APY)
|
|
164
|
+
* weighted-averaged over its market deposits, before deducting the performance fee,
|
|
165
|
+
* if interest was to be accrued on each market at the given timestamp (scaled by WAD).
|
|
166
166
|
*/
|
|
167
|
-
getApy(timestamp
|
|
167
|
+
getApy(timestamp?: BigIntish): bigint;
|
|
168
168
|
/**
|
|
169
|
-
* The MetaMorpho vault's
|
|
170
|
-
*
|
|
171
|
-
* if
|
|
169
|
+
* The MetaMorpho vault's experienced Annual Percentage Yield (APY)
|
|
170
|
+
* weighted-averaged over its market deposits, after deducting the performance fee,
|
|
171
|
+
* if interest was to be accrued on each market at the given timestamp (scaled by WAD).
|
|
172
172
|
*/
|
|
173
|
-
getNetApy(timestamp
|
|
173
|
+
getNetApy(timestamp?: BigIntish): bigint;
|
|
174
174
|
getAllocationProportion(marketId: MarketId): bigint;
|
|
175
175
|
getDepositCapacityLimit(assets: bigint): CapacityLimit;
|
|
176
176
|
getWithdrawCapacityLimit(shares: bigint): CapacityLimit;
|
package/lib/vault/Vault.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AccrualVault = exports.Vault = void 0;
|
|
4
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
4
5
|
const index_js_1 = require("../market/index.js");
|
|
5
6
|
const index_js_2 = require("../math/index.js");
|
|
6
7
|
const index_js_3 = require("../token/index.js");
|
|
@@ -153,44 +154,40 @@ class AccrualVault extends Vault {
|
|
|
153
154
|
.reduce((total, { position }) => total + position.withdrawCapacityLimit.value, 0n);
|
|
154
155
|
}
|
|
155
156
|
/**
|
|
156
|
-
* The MetaMorpho vault's
|
|
157
|
-
*
|
|
157
|
+
* The MetaMorpho vault's current instantaneous Annual Percentage Yield (APY)
|
|
158
|
+
* weighted-averaged over its market deposits, before deducting the performance fee (scaled by WAD).
|
|
158
159
|
* If interested in the APY at a specific timestamp, use `getApy(timestamp)` instead.
|
|
159
160
|
*/
|
|
160
161
|
get apy() {
|
|
161
|
-
|
|
162
|
-
return 0n;
|
|
163
|
-
return (this.allocations
|
|
164
|
-
.values()
|
|
165
|
-
.reduce((total, { position }) => total + position.market.supplyApy * position.supplyAssets, 0n) / this.totalAssets);
|
|
162
|
+
return this.getApy();
|
|
166
163
|
}
|
|
167
164
|
/**
|
|
168
|
-
* The MetaMorpho vault's
|
|
169
|
-
*
|
|
165
|
+
* The MetaMorpho vault's current instantaneous Annual Percentage Yield (APY)
|
|
166
|
+
* weighted-averaged over its market deposits, after deducting the performance fee (scaled by WAD).
|
|
170
167
|
* If interested in the APY at a specific timestamp, use `getApy(timestamp)` instead.
|
|
171
168
|
*/
|
|
172
169
|
get netApy() {
|
|
173
|
-
return
|
|
170
|
+
return this.getNetApy();
|
|
174
171
|
}
|
|
175
172
|
/**
|
|
176
|
-
* The MetaMorpho vault's
|
|
177
|
-
*
|
|
178
|
-
* if
|
|
173
|
+
* The MetaMorpho vault's experienced Annual Percentage Yield (APY)
|
|
174
|
+
* weighted-averaged over its market deposits, before deducting the performance fee,
|
|
175
|
+
* if interest was to be accrued on each market at the given timestamp (scaled by WAD).
|
|
179
176
|
*/
|
|
180
|
-
getApy(timestamp) {
|
|
177
|
+
getApy(timestamp = morpho_ts_1.Time.timestamp()) {
|
|
181
178
|
if (this.totalAssets === 0n)
|
|
182
179
|
return 0n;
|
|
183
180
|
return (this.allocations
|
|
184
181
|
.values()
|
|
185
182
|
.reduce((total, { position }) => total +
|
|
186
|
-
position.market.
|
|
183
|
+
position.market.getAvgSupplyApy(timestamp) * position.supplyAssets, 0n) / this.totalAssets);
|
|
187
184
|
}
|
|
188
185
|
/**
|
|
189
|
-
* The MetaMorpho vault's
|
|
190
|
-
*
|
|
191
|
-
* if
|
|
186
|
+
* The MetaMorpho vault's experienced Annual Percentage Yield (APY)
|
|
187
|
+
* weighted-averaged over its market deposits, after deducting the performance fee,
|
|
188
|
+
* if interest was to be accrued on each market at the given timestamp (scaled by WAD).
|
|
192
189
|
*/
|
|
193
|
-
getNetApy(timestamp) {
|
|
190
|
+
getNetApy(timestamp = morpho_ts_1.Time.timestamp()) {
|
|
194
191
|
return index_js_2.MathLib.wMulDown(this.getApy(timestamp), index_js_2.MathLib.WAD - this.fee);
|
|
195
192
|
}
|
|
196
193
|
getAllocationProportion(marketId) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/blue-sdk",
|
|
3
3
|
"description": "Framework-agnostic package that defines Morpho-related entity classes (such as `Market`, `Token`, `Vault`).",
|
|
4
|
-
"version": "4.5.
|
|
4
|
+
"version": "4.5.1",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Rubilmax <rmilon@gmail.com>"
|