@morpho-org/blue-sdk 4.5.0 → 4.6.0

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.
@@ -211,7 +211,7 @@ declare const _addressesRegistry: {
211
211
  readonly metaMorphoFactory: "0x27D4Af0AC9E7FDfA6D0853236f249CC27AE79488";
212
212
  readonly chainlinkOracleFactory: "0x39d8622C607A691D7705E8842fbB12E3c38dCD41";
213
213
  readonly preLiquidationFactory: "0xe3cE2051a24e58DBFC0eFBe4c2d9e89c5eAe4695";
214
- readonly wNative: "0xfc00000000000000000000000000000000000006";
214
+ readonly wNative: "0xFC00000000000000000000000000000000000006";
215
215
  };
216
216
  readonly 534352: {
217
217
  readonly morpho: "0x2d012EdbAdc37eDc2BC62791B666f9193FDF5a55";
@@ -349,6 +349,19 @@ declare const _addressesRegistry: {
349
349
  readonly preLiquidationFactory: "0x678EB53A3bB79111263f47B84989d16D81c36D85";
350
350
  readonly wNative: "0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62";
351
351
  };
352
+ readonly 42793: {
353
+ readonly morpho: "0xbCE7364E63C3B13C73E9977a83c9704E2aCa876e";
354
+ readonly bundler3: {
355
+ readonly bundler3: "0x69dc8086191437b55775b79C730BB3876397e7D1";
356
+ readonly generalAdapter1: "0xEabdAC78A7f0a9B3dF0e23D69A5a5fF7f580a910";
357
+ };
358
+ readonly adaptiveCurveIrm: "0xC1523BE776e66ba07b609b1914D0925278f21FE5";
359
+ readonly publicAllocator: "0x8b8B1bd41d36c06253203CD21463994aB752c1e6";
360
+ readonly metaMorphoFactory: "0x997a79c3C04c5B9eb27d343ae126bcCFb5D74781";
361
+ readonly chainlinkOracleFactory: "0x12FA40f687a35611720E1DcB59976B6e51247298";
362
+ readonly preLiquidationFactory: "0xd1c37fDd941256FC184eF3A07Be540a90b81Ec21";
363
+ readonly wNative: "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb";
364
+ };
352
365
  readonly 239: {
353
366
  readonly morpho: "0x918B9F2E4B44E20c6423105BB6cCEB71473aD35c";
354
367
  readonly bundler3: {
@@ -566,7 +579,7 @@ export declare let addressesRegistry: {
566
579
  readonly metaMorphoFactory: "0x27D4Af0AC9E7FDfA6D0853236f249CC27AE79488";
567
580
  readonly chainlinkOracleFactory: "0x39d8622C607A691D7705E8842fbB12E3c38dCD41";
568
581
  readonly preLiquidationFactory: "0xe3cE2051a24e58DBFC0eFBe4c2d9e89c5eAe4695";
569
- readonly wNative: "0xfc00000000000000000000000000000000000006";
582
+ readonly wNative: "0xFC00000000000000000000000000000000000006";
570
583
  };
571
584
  readonly 534352: {
572
585
  readonly morpho: "0x2d012EdbAdc37eDc2BC62791B666f9193FDF5a55";
@@ -704,6 +717,19 @@ export declare let addressesRegistry: {
704
717
  readonly preLiquidationFactory: "0x678EB53A3bB79111263f47B84989d16D81c36D85";
705
718
  readonly wNative: "0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62";
706
719
  };
720
+ readonly 42793: {
721
+ readonly morpho: "0xbCE7364E63C3B13C73E9977a83c9704E2aCa876e";
722
+ readonly bundler3: {
723
+ readonly bundler3: "0x69dc8086191437b55775b79C730BB3876397e7D1";
724
+ readonly generalAdapter1: "0xEabdAC78A7f0a9B3dF0e23D69A5a5fF7f580a910";
725
+ };
726
+ readonly adaptiveCurveIrm: "0xC1523BE776e66ba07b609b1914D0925278f21FE5";
727
+ readonly publicAllocator: "0x8b8B1bd41d36c06253203CD21463994aB752c1e6";
728
+ readonly metaMorphoFactory: "0x997a79c3C04c5B9eb27d343ae126bcCFb5D74781";
729
+ readonly chainlinkOracleFactory: "0x12FA40f687a35611720E1DcB59976B6e51247298";
730
+ readonly preLiquidationFactory: "0xd1c37fDd941256FC184eF3A07Be540a90b81Ec21";
731
+ readonly wNative: "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb";
732
+ };
707
733
  readonly 239: {
708
734
  readonly morpho: "0x918B9F2E4B44E20c6423105BB6cCEB71473aD35c";
709
735
  readonly bundler3: {
package/lib/addresses.js CHANGED
@@ -188,7 +188,7 @@ const _addressesRegistry = {
188
188
  metaMorphoFactory: "0x27D4Af0AC9E7FDfA6D0853236f249CC27AE79488",
189
189
  chainlinkOracleFactory: "0x39d8622C607A691D7705E8842fbB12E3c38dCD41",
190
190
  preLiquidationFactory: "0xe3cE2051a24e58DBFC0eFBe4c2d9e89c5eAe4695",
191
- wNative: "0xfc00000000000000000000000000000000000006",
191
+ wNative: "0xFC00000000000000000000000000000000000006",
192
192
  },
193
193
  [chain_js_1.ChainId.ScrollMainnet]: {
194
194
  morpho: "0x2d012EdbAdc37eDc2BC62791B666f9193FDF5a55",
@@ -331,6 +331,19 @@ const _addressesRegistry = {
331
331
  preLiquidationFactory: "0x678EB53A3bB79111263f47B84989d16D81c36D85",
332
332
  wNative: "0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62",
333
333
  },
334
+ [chain_js_1.ChainId.EtherlinkMainnet]: {
335
+ morpho: "0xbCE7364E63C3B13C73E9977a83c9704E2aCa876e",
336
+ bundler3: {
337
+ bundler3: "0x69dc8086191437b55775b79C730BB3876397e7D1",
338
+ generalAdapter1: "0xEabdAC78A7f0a9B3dF0e23D69A5a5fF7f580a910",
339
+ },
340
+ adaptiveCurveIrm: "0xC1523BE776e66ba07b609b1914D0925278f21FE5",
341
+ publicAllocator: "0x8b8B1bd41d36c06253203CD21463994aB752c1e6",
342
+ metaMorphoFactory: "0x997a79c3C04c5B9eb27d343ae126bcCFb5D74781",
343
+ chainlinkOracleFactory: "0x12FA40f687a35611720E1DcB59976B6e51247298",
344
+ preLiquidationFactory: "0xd1c37fDd941256FC184eF3A07Be540a90b81Ec21",
345
+ wNative: "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb",
346
+ },
334
347
  [chain_js_1.ChainId.TacMainnet]: {
335
348
  morpho: "0x918B9F2E4B44E20c6423105BB6cCEB71473aD35c",
336
349
  bundler3: {
@@ -432,6 +445,9 @@ const _unwrappedTokensMapping = {
432
445
  [chain_js_1.ChainId.ArbitrumMainnet]: {
433
446
  [_addressesRegistry[chain_js_1.ChainId.ArbitrumMainnet].wNative]: exports.NATIVE_ADDRESS,
434
447
  },
448
+ [chain_js_1.ChainId.EtherlinkMainnet]: {
449
+ [_addressesRegistry[chain_js_1.ChainId.EtherlinkMainnet].wNative]: exports.NATIVE_ADDRESS,
450
+ },
435
451
  [chain_js_1.ChainId.TacMainnet]: {
436
452
  [_addressesRegistry[chain_js_1.ChainId.TacMainnet].wNative]: exports.NATIVE_ADDRESS,
437
453
  },
package/lib/chain.d.ts CHANGED
@@ -16,6 +16,7 @@ export declare enum ChainId {
16
16
  PlumeMainnet = 98866,
17
17
  CampMainnet = 123420001114,
18
18
  KatanaMainnet = 747474,
19
+ EtherlinkMainnet = 42793,
19
20
  TacMainnet = 239,
20
21
  LiskMainnet = 1135
21
22
  }
package/lib/chain.js CHANGED
@@ -20,6 +20,7 @@ var ChainId;
20
20
  ChainId[ChainId["PlumeMainnet"] = 98866] = "PlumeMainnet";
21
21
  ChainId[ChainId["CampMainnet"] = 123420001114] = "CampMainnet";
22
22
  ChainId[ChainId["KatanaMainnet"] = 747474] = "KatanaMainnet";
23
+ ChainId[ChainId["EtherlinkMainnet"] = 42793] = "EtherlinkMainnet";
23
24
  ChainId[ChainId["TacMainnet"] = 239] = "TacMainnet";
24
25
  ChainId[ChainId["LiskMainnet"] = 1135] = "LiskMainnet";
25
26
  })(ChainId || (exports.ChainId = ChainId = {}));
@@ -157,6 +158,13 @@ var ChainUtils;
157
158
  explorerUrl: "https://explorer.katanarpc.com",
158
159
  identifier: "katana",
159
160
  },
161
+ [ChainId.EtherlinkMainnet]: {
162
+ name: "Etherlink",
163
+ id: ChainId.EtherlinkMainnet,
164
+ nativeCurrency: { name: "Tezos", symbol: "XTZ", decimals: 18 },
165
+ explorerUrl: "https://explorer.etherlink.com",
166
+ identifier: "etherlink",
167
+ },
160
168
  [ChainId.TacMainnet]: {
161
169
  name: "TAC",
162
170
  id: ChainId.TacMainnet,
@@ -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 APY on its assets averaged over its market deposits,
152
- * before deducting the performance fee, at the time of each market's last update (scaled by WAD).
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 APY on its assets averaged over its market deposits,
158
- * after deducting the performance fee, at the time of each market's last update (scaled by WAD).
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 APY on its assets averaged over its market deposits,
164
- * before deducting the performance fee, at the given timestamp,
165
- * if the state of all the markets remains unchanged (not accrued) (scaled by WAD).
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: BigIntish): bigint;
167
+ getApy(timestamp?: BigIntish): bigint;
168
168
  /**
169
- * The MetaMorpho vault's APY on its assets averaged over its market deposits,
170
- * after deducting the performance fee, at the given timestamp,
171
- * if the state of all the markets remains unchanged (not accrued) (scaled by WAD).
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: BigIntish): bigint;
173
+ getNetApy(timestamp?: BigIntish): bigint;
174
174
  getAllocationProportion(marketId: MarketId): bigint;
175
175
  getDepositCapacityLimit(assets: bigint): CapacityLimit;
176
176
  getWithdrawCapacityLimit(shares: bigint): CapacityLimit;
@@ -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 APY on its assets averaged over its market deposits,
157
- * before deducting the performance fee, at the time of each market's last update (scaled by WAD).
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
- if (this.totalAssets === 0n)
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 APY on its assets averaged over its market deposits,
169
- * after deducting the performance fee, at the time of each market's last update (scaled by WAD).
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 index_js_2.MathLib.wMulDown(this.apy, index_js_2.MathLib.WAD - this.fee);
170
+ return this.getNetApy();
174
171
  }
175
172
  /**
176
- * The MetaMorpho vault's APY on its assets averaged over its market deposits,
177
- * before deducting the performance fee, at the given timestamp,
178
- * if the state of all the markets remains unchanged (not accrued) (scaled by WAD).
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.getSupplyApy(timestamp) * position.supplyAssets, 0n) / this.totalAssets);
183
+ position.market.getAvgSupplyApy(timestamp) * position.supplyAssets, 0n) / this.totalAssets);
187
184
  }
188
185
  /**
189
- * The MetaMorpho vault's APY on its assets averaged over its market deposits,
190
- * after deducting the performance fee, at the given timestamp,
191
- * if the state of all the markets remains unchanged (not accrued) (scaled by WAD).
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.0",
4
+ "version": "4.6.0",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -31,8 +31,8 @@
31
31
  "typescript": "^5.7.2",
32
32
  "viem": "^2.23.0",
33
33
  "vitest": "^3.0.5",
34
- "@morpho-org/morpho-ts": "^2.4.1",
35
- "@morpho-org/test": "^2.1.4"
34
+ "@morpho-org/test": "^2.1.4",
35
+ "@morpho-org/morpho-ts": "^2.4.1"
36
36
  },
37
37
  "scripts": {
38
38
  "prepublish": "$npm_execpath build",