@morpho-org/blue-sdk 5.2.0-next.0 → 5.2.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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VaultMarketAllocation = void 0;
4
4
  const index_js_1 = require("../math/index.js");
5
+ const VaultMarketConfig_js_1 = require("./VaultMarketConfig.js");
5
6
  class VaultMarketAllocation {
6
7
  /**
7
8
  * The vault's configuration on the corresponding market.
@@ -12,7 +13,7 @@ class VaultMarketAllocation {
12
13
  */
13
14
  position;
14
15
  constructor({ config, position }) {
15
- this.config = config;
16
+ this.config = new VaultMarketConfig_js_1.VaultMarketConfig(config);
16
17
  this.position = position;
17
18
  }
18
19
  get vault() {
@@ -5,4 +5,3 @@ export * from "./VaultMarketConfig.js";
5
5
  export * from "./VaultMarketPublicAllocatorConfig.js";
6
6
  export * from "./VaultUser.js";
7
7
  export * from "./Vault.js";
8
- export * from "./v2";
@@ -21,4 +21,3 @@ __exportStar(require("./VaultMarketConfig.js"), exports);
21
21
  __exportStar(require("./VaultMarketPublicAllocatorConfig.js"), exports);
22
22
  __exportStar(require("./VaultUser.js"), exports);
23
23
  __exportStar(require("./Vault.js"), exports);
24
- __exportStar(require("./v2"), exports);
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": "5.2.0-next.0",
4
+ "version": "5.2.0",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "typescript": "^5.7.2",
32
- "viem": "^2.33.3",
32
+ "viem": "^2.23.0",
33
33
  "vitest": "^3.0.5",
34
34
  "@morpho-org/morpho-ts": "^2.4.3",
35
35
  "@morpho-org/test": "^2.6.0"
package/lib/utils.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export declare enum CapacityLimitReason {
2
- liquidity = "Liquidity",
3
- balance = "Balance",
4
- position = "Position",
5
- collateral = "Collateral",
6
- cap = "Cap",
7
- vaultV2_absoluteCap = "VaultV2_AbsoluteCap",
8
- vaultV2_relativeCap = "VaultV2_RelativeCap"
9
- }
10
- export interface CapacityLimit {
11
- value: bigint;
12
- limiter: CapacityLimitReason;
13
- }
14
- export declare const safeParseNumber: (value: number, decimals?: number) => bigint;
15
- export declare const safeParseUnits: (strValue: string, decimals?: number) => bigint;
package/lib/utils.js DELETED
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.safeParseUnits = exports.safeParseNumber = exports.CapacityLimitReason = void 0;
4
- var CapacityLimitReason;
5
- (function (CapacityLimitReason) {
6
- CapacityLimitReason["liquidity"] = "Liquidity";
7
- CapacityLimitReason["balance"] = "Balance";
8
- CapacityLimitReason["position"] = "Position";
9
- CapacityLimitReason["collateral"] = "Collateral";
10
- CapacityLimitReason["cap"] = "Cap";
11
- CapacityLimitReason["vaultV2_absoluteCap"] = "VaultV2_AbsoluteCap";
12
- CapacityLimitReason["vaultV2_relativeCap"] = "VaultV2_RelativeCap";
13
- })(CapacityLimitReason || (exports.CapacityLimitReason = CapacityLimitReason = {}));
14
- // Alternative to Number.toFixed that doesn't use scientific notation for excessively small or large numbers.
15
- const toFixed = (x, decimals) => new Intl.NumberFormat("en-US", {
16
- style: "decimal",
17
- useGrouping: false,
18
- maximumFractionDigits: decimals,
19
- minimumFractionDigits: decimals,
20
- }).format(x);
21
- const safeParseNumber = (value, decimals = 18) => (0, exports.safeParseUnits)(toFixed(value, decimals), decimals);
22
- exports.safeParseNumber = safeParseNumber;
23
- const safeParseUnits = (strValue, decimals = 18) => {
24
- if (!/[-+]?[0-9]*\.?[0-9]+/.test(strValue))
25
- throw Error(`invalid number: ${strValue}`);
26
- let [whole, dec = ""] = strValue.split(".");
27
- dec = dec.slice(0, decimals);
28
- return parseUnits([whole || "0", dec].filter((v) => v.length > 0).join("."), decimals);
29
- };
30
- exports.safeParseUnits = safeParseUnits;
31
- /**
32
- * Multiplies a string representation of a number by a given exponent of base 10 (10exponent).
33
- *
34
- * - Docs: https://viem.sh/docs/utilities/parseUnits
35
- *
36
- * @example
37
- * import { parseUnits } from 'viem'
38
- *
39
- * parseUnits('420', 9)
40
- * // 420000000000n
41
- */
42
- // TODO: get rid of this copy.
43
- function parseUnits(value, decimals) {
44
- let [integer, fraction = "0"] = value.split(".");
45
- const negative = integer.startsWith("-");
46
- if (negative)
47
- integer = integer.slice(1);
48
- // trim trailing zeros.
49
- fraction = fraction.replace(/(0+)$/, "");
50
- // round off if the fraction is larger than the number of decimals.
51
- if (decimals === 0) {
52
- if (Math.round(Number(`.${fraction}`)) === 1)
53
- integer = `${BigInt(integer) + 1n}`;
54
- fraction = "";
55
- }
56
- else if (fraction.length > decimals) {
57
- const [left, unit, right] = [
58
- fraction.slice(0, decimals - 1),
59
- fraction.slice(decimals - 1, decimals),
60
- fraction.slice(decimals),
61
- ];
62
- const rounded = Math.round(Number(`${unit}.${right}`));
63
- if (rounded > 9)
64
- fraction = `${BigInt(left) + BigInt(1)}0`.padStart(left.length + 1, "0");
65
- else
66
- fraction = `${left}${rounded}`;
67
- if (fraction.length > decimals) {
68
- fraction = fraction.slice(1);
69
- integer = `${BigInt(integer) + 1n}`;
70
- }
71
- fraction = fraction.slice(0, decimals);
72
- }
73
- else {
74
- fraction = fraction.padEnd(decimals, "0");
75
- }
76
- return BigInt(`${negative ? "-" : ""}${integer}${fraction}`);
77
- }
@@ -1,87 +0,0 @@
1
- import { type Address, type Hash, type Hex } from "viem";
2
- import { type RoundingDirection } from "../../math";
3
- import { type IToken, WrappedToken } from "../../token";
4
- import type { BigIntish } from "../../types";
5
- import { type CapacityLimit } from "../../utils";
6
- import type { IAccrualVaultV2Adapter } from "./VaultV2Adapter";
7
- export interface IVaultV2Allocation {
8
- id: Hash;
9
- absoluteCap: bigint;
10
- relativeCap: bigint;
11
- allocation: bigint;
12
- }
13
- export interface IVaultV2 extends IToken {
14
- asset: Address;
15
- /**
16
- * The total assets, *including* virtually accrued interest.
17
- */
18
- totalAssets: bigint;
19
- /**
20
- * The total assets, *excluding* virtually accrued interest.
21
- */
22
- _totalAssets: bigint;
23
- /**
24
- * The total supply of shares.
25
- */
26
- totalSupply: bigint;
27
- virtualShares: bigint;
28
- maxRate: bigint;
29
- lastUpdate: bigint;
30
- adapters: Address[];
31
- liquidityAdapter: Address;
32
- liquidityData: Hex;
33
- liquidityAllocations: IVaultV2Allocation[] | undefined;
34
- performanceFee: bigint;
35
- managementFee: bigint;
36
- performanceFeeRecipient: Address;
37
- managementFeeRecipient: Address;
38
- }
39
- export declare class VaultV2 extends WrappedToken implements IVaultV2 {
40
- readonly asset: Address;
41
- totalAssets: bigint;
42
- _totalAssets: bigint;
43
- totalSupply: bigint;
44
- virtualShares: bigint;
45
- maxRate: bigint;
46
- lastUpdate: bigint;
47
- adapters: `0x${string}`[];
48
- liquidityAdapter: `0x${string}`;
49
- liquidityData: `0x${string}`;
50
- liquidityAllocations: IVaultV2Allocation[] | undefined;
51
- performanceFee: bigint;
52
- managementFee: bigint;
53
- performanceFeeRecipient: `0x${string}`;
54
- managementFeeRecipient: `0x${string}`;
55
- constructor({ asset, totalAssets, _totalAssets, totalSupply, virtualShares, maxRate, lastUpdate, adapters, liquidityAdapter, liquidityData, liquidityAllocations, performanceFee, managementFee, performanceFeeRecipient, managementFeeRecipient, ...config }: IVaultV2);
56
- toAssets(shares: BigIntish): bigint;
57
- toShares(assets: BigIntish): bigint;
58
- protected _wrap(amount: BigIntish, rounding: RoundingDirection): bigint;
59
- protected _unwrap(amount: BigIntish, rounding: RoundingDirection): bigint;
60
- }
61
- export interface IAccrualVaultV2 extends Omit<IVaultV2, "adapters"> {
62
- }
63
- export declare class AccrualVaultV2 extends VaultV2 implements IAccrualVaultV2 {
64
- accrualLiquidityAdapter: IAccrualVaultV2Adapter | undefined;
65
- accrualAdapters: IAccrualVaultV2Adapter[];
66
- assetBalance: bigint;
67
- constructor(vault: IAccrualVaultV2, accrualLiquidityAdapter: IAccrualVaultV2Adapter | undefined, accrualAdapters: IAccrualVaultV2Adapter[], assetBalance: bigint);
68
- /**
69
- * Returns the maximum amount of assets that can be deposited to the vault.
70
- * @param assets The maximum amount of assets to deposit.
71
- */
72
- maxDeposit(assets: BigIntish): CapacityLimit;
73
- /**
74
- * Returns the maximum amount of assets that can be withdrawn from the vault.
75
- * @param shares The maximum amount of shares to redeem.
76
- */
77
- maxWithdraw(shares: BigIntish): CapacityLimit;
78
- /**
79
- * Returns a new vault derived from this vault, whose interest has been accrued up to the given timestamp.
80
- * @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to the vault's `lastUpdate`.
81
- */
82
- accrueInterest(timestamp: BigIntish): {
83
- vault: AccrualVaultV2;
84
- performanceFeeShares: bigint;
85
- managementFeeShares: bigint;
86
- };
87
- }
@@ -1,160 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AccrualVaultV2 = exports.VaultV2 = void 0;
4
- const viem_1 = require("viem");
5
- const errors_1 = require("../../errors");
6
- const math_1 = require("../../math");
7
- const token_1 = require("../../token");
8
- const utils_1 = require("../../utils");
9
- const VaultV2MorphoVaultV1Adapter_1 = require("./VaultV2MorphoVaultV1Adapter");
10
- class VaultV2 extends token_1.WrappedToken {
11
- asset;
12
- totalAssets;
13
- _totalAssets;
14
- totalSupply;
15
- virtualShares;
16
- maxRate;
17
- lastUpdate;
18
- adapters;
19
- liquidityAdapter;
20
- liquidityData;
21
- liquidityAllocations;
22
- performanceFee;
23
- managementFee;
24
- performanceFeeRecipient;
25
- managementFeeRecipient;
26
- constructor({ asset, totalAssets, _totalAssets, totalSupply, virtualShares, maxRate, lastUpdate, adapters, liquidityAdapter, liquidityData, liquidityAllocations, performanceFee, managementFee, performanceFeeRecipient, managementFeeRecipient, ...config }) {
27
- super(config, asset);
28
- this.asset = asset;
29
- this.totalAssets = totalAssets;
30
- this._totalAssets = _totalAssets;
31
- this.totalSupply = totalSupply;
32
- this.virtualShares = virtualShares;
33
- this.maxRate = maxRate;
34
- this.lastUpdate = lastUpdate;
35
- this.adapters = adapters;
36
- this.liquidityAdapter = liquidityAdapter;
37
- this.liquidityData = liquidityData;
38
- this.liquidityAllocations = liquidityAllocations;
39
- this.performanceFee = performanceFee;
40
- this.managementFee = managementFee;
41
- this.performanceFeeRecipient = performanceFeeRecipient;
42
- this.managementFeeRecipient = managementFeeRecipient;
43
- }
44
- toAssets(shares) {
45
- return this._unwrap(shares, "Down");
46
- }
47
- toShares(assets) {
48
- return this._wrap(assets, "Down");
49
- }
50
- _wrap(amount, rounding) {
51
- return math_1.MathLib.mulDiv(amount, this.totalSupply + this.virtualShares, this.totalAssets + 1n, rounding);
52
- }
53
- _unwrap(amount, rounding) {
54
- return math_1.MathLib.mulDiv(amount, this.totalAssets + 1n, this.totalSupply + this.virtualShares, rounding);
55
- }
56
- }
57
- exports.VaultV2 = VaultV2;
58
- class AccrualVaultV2 extends VaultV2 {
59
- accrualLiquidityAdapter;
60
- accrualAdapters;
61
- assetBalance;
62
- constructor(vault, accrualLiquidityAdapter, accrualAdapters, assetBalance) {
63
- super({ ...vault, adapters: accrualAdapters.map((a) => a.address) });
64
- this.accrualLiquidityAdapter = accrualLiquidityAdapter;
65
- this.accrualAdapters = accrualAdapters;
66
- this.assetBalance = assetBalance;
67
- }
68
- /**
69
- * Returns the maximum amount of assets that can be deposited to the vault.
70
- * @param assets The maximum amount of assets to deposit.
71
- */
72
- maxDeposit(assets) {
73
- if (this.liquidityAdapter === viem_1.zeroAddress)
74
- return { value: BigInt(assets), limiter: utils_1.CapacityLimitReason.balance };
75
- let liquidityAdapterLimit;
76
- if (this.accrualLiquidityAdapter instanceof VaultV2MorphoVaultV1Adapter_1.AccrualVaultV2MorphoVaultV1Adapter) {
77
- liquidityAdapterLimit = this.accrualLiquidityAdapter.maxDeposit(this.liquidityData, assets);
78
- }
79
- if (this.liquidityAllocations == null || liquidityAdapterLimit == null)
80
- throw new errors_1.VaultV2Errors.UnsupportedLiquidityAdapter(this.liquidityAdapter);
81
- // At this stage: `liquidityAdapterLimit.value <= assets`
82
- for (const { absoluteCap, relativeCap, allocation } of this
83
- .liquidityAllocations) {
84
- // `absoluteCap` can be set lower than `allocation`.
85
- const absoluteMaxDeposit = math_1.MathLib.zeroFloorSub(absoluteCap, allocation);
86
- if (liquidityAdapterLimit.value > absoluteMaxDeposit)
87
- return {
88
- value: absoluteMaxDeposit,
89
- limiter: utils_1.CapacityLimitReason.vaultV2_absoluteCap,
90
- };
91
- // `relativeCap` can be set lower than `allocation / totalAssets`.
92
- const relativeMaxDeposit = math_1.MathLib.zeroFloorSub(math_1.MathLib.wMulDown(this.totalAssets, relativeCap), allocation);
93
- if (liquidityAdapterLimit.value > relativeMaxDeposit &&
94
- relativeCap !== math_1.MathLib.WAD)
95
- return {
96
- value: relativeMaxDeposit,
97
- limiter: utils_1.CapacityLimitReason.vaultV2_relativeCap,
98
- };
99
- }
100
- return liquidityAdapterLimit;
101
- }
102
- /**
103
- * Returns the maximum amount of assets that can be withdrawn from the vault.
104
- * @param shares The maximum amount of shares to redeem.
105
- */
106
- maxWithdraw(shares) {
107
- const assets = this.toAssets(shares);
108
- if (this.liquidityAdapter === viem_1.zeroAddress)
109
- return { value: BigInt(assets), limiter: utils_1.CapacityLimitReason.balance };
110
- let liquidity = this.assetBalance;
111
- if (this.accrualLiquidityAdapter instanceof VaultV2MorphoVaultV1Adapter_1.AccrualVaultV2MorphoVaultV1Adapter)
112
- liquidity += this.accrualLiquidityAdapter.maxWithdraw(this.liquidityData).value;
113
- if (assets > liquidity)
114
- return {
115
- value: liquidity,
116
- limiter: utils_1.CapacityLimitReason.liquidity,
117
- };
118
- return {
119
- value: assets,
120
- limiter: utils_1.CapacityLimitReason.balance,
121
- };
122
- }
123
- /**
124
- * Returns a new vault derived from this vault, whose interest has been accrued up to the given timestamp.
125
- * @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to the vault's `lastUpdate`.
126
- */
127
- accrueInterest(timestamp) {
128
- const vault = new AccrualVaultV2(this, this.accrualLiquidityAdapter, this.accrualAdapters, this.assetBalance);
129
- timestamp = BigInt(timestamp);
130
- const elapsed = timestamp - this.lastUpdate;
131
- if (elapsed < 0n)
132
- throw new errors_1.VaultV2Errors.InvalidInterestAccrual(this.address, timestamp, this.lastUpdate);
133
- // Corresponds to the `firstTotalAssets == 0` onchain check.
134
- if (elapsed === 0n)
135
- return { vault, performanceFeeShares: 0n, managementFeeShares: 0n };
136
- const realAssets = vault.accrualAdapters.reduce((curr, adapter) => curr + adapter.realAssets(timestamp), vault.assetBalance);
137
- const maxTotalAssets = vault._totalAssets +
138
- math_1.MathLib.wMulDown(vault._totalAssets * elapsed, vault.maxRate);
139
- const newTotalAssets = math_1.MathLib.min(realAssets, maxTotalAssets);
140
- const interest = math_1.MathLib.zeroFloorSub(newTotalAssets, vault._totalAssets);
141
- const performanceFeeAssets = interest > 0n && vault.performanceFee > 0n
142
- ? math_1.MathLib.wMulDown(interest, vault.performanceFee)
143
- : 0n;
144
- const managementFeeAssets = elapsed > 0n && vault.managementFee > 0n
145
- ? math_1.MathLib.wMulDown(newTotalAssets * elapsed, vault.managementFee)
146
- : 0n;
147
- const newTotalAssetsWithoutFees = newTotalAssets - performanceFeeAssets - managementFeeAssets;
148
- const performanceFeeShares = math_1.MathLib.mulDivDown(performanceFeeAssets, vault.totalSupply + vault.virtualShares, newTotalAssetsWithoutFees + 1n);
149
- const managementFeeShares = math_1.MathLib.mulDivDown(managementFeeAssets, vault.totalSupply + vault.virtualShares, newTotalAssetsWithoutFees + 1n);
150
- vault.totalAssets = newTotalAssets;
151
- vault._totalAssets = newTotalAssets;
152
- if (performanceFeeShares)
153
- vault.totalSupply += performanceFeeShares;
154
- if (managementFeeShares)
155
- vault.totalSupply += managementFeeShares;
156
- vault.lastUpdate = BigInt(timestamp);
157
- return { vault, performanceFeeShares, managementFeeShares };
158
- }
159
- }
160
- exports.AccrualVaultV2 = AccrualVaultV2;
@@ -1,29 +0,0 @@
1
- import type { Address, Hash, Hex } from "viem";
2
- import type { BigIntish } from "../../types";
3
- import type { CapacityLimit } from "../../utils";
4
- export interface IVaultV2Adapter {
5
- address: Address;
6
- parentVault: Address;
7
- adapterId: Hash;
8
- skimRecipient: Address;
9
- }
10
- export declare abstract class VaultV2Adapter implements IVaultV2Adapter {
11
- readonly address: Address;
12
- readonly parentVault: Address;
13
- readonly adapterId: Hash;
14
- skimRecipient: Address;
15
- constructor({ address, parentVault, adapterId, skimRecipient, }: IVaultV2Adapter);
16
- }
17
- export interface IAccrualVaultV2Adapter extends IVaultV2Adapter {
18
- realAssets(timestamp: BigIntish): bigint;
19
- /**
20
- * Returns the maximum amount of assets that can be deposited to this adapter.
21
- * @param assets The maximum amount of assets to deposit.
22
- */
23
- maxDeposit(data: Hex, assets: BigIntish): CapacityLimit;
24
- /**
25
- * Returns the maximum amount of assets that can be withdrawn from this adapter.
26
- * @param shares The maximum amount of shares to redeem.
27
- */
28
- maxWithdraw(data: Hex): CapacityLimit;
29
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VaultV2Adapter = void 0;
4
- class VaultV2Adapter {
5
- address;
6
- parentVault;
7
- adapterId;
8
- skimRecipient;
9
- constructor({ address, parentVault, adapterId, skimRecipient, }) {
10
- this.address = address;
11
- this.parentVault = parentVault;
12
- this.adapterId = adapterId;
13
- this.skimRecipient = skimRecipient;
14
- }
15
- }
16
- exports.VaultV2Adapter = VaultV2Adapter;
@@ -1,24 +0,0 @@
1
- import { type Address, type Hex } from "viem";
2
- import { VaultV2Adapter } from "./VaultV2Adapter";
3
- export interface IVaultV2MorphoVaultV1Adapter extends IVaultV2Adapter {
4
- morphoVaultV1: Address;
5
- }
6
- import type { BigIntish } from "../../types";
7
- import type { AccrualVault } from "../Vault";
8
- import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter";
9
- export declare class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter implements IVaultV2MorphoVaultV1Adapter {
10
- static adapterId(address: Address): `0x${string}`;
11
- readonly morphoVaultV1: Address;
12
- constructor({ morphoVaultV1, ...vaultV2Adapter }: IVaultV2MorphoVaultV1Adapter);
13
- ids(): `0x${string}`[];
14
- }
15
- export interface IAccrualVaultV2MorphoVaultV1Adapter extends IVaultV2MorphoVaultV1Adapter {
16
- }
17
- export declare class AccrualVaultV2MorphoVaultV1Adapter extends VaultV2MorphoVaultV1Adapter implements IAccrualVaultV2MorphoVaultV1Adapter, IAccrualVaultV2Adapter {
18
- accrualVaultV1: AccrualVault;
19
- shares: bigint;
20
- constructor(adapter: IAccrualVaultV2MorphoVaultV1Adapter, accrualVaultV1: AccrualVault, shares: bigint);
21
- realAssets(timestamp: BigIntish): bigint;
22
- maxDeposit(_data: Hex, assets: BigIntish): import("../..").CapacityLimit;
23
- maxWithdraw(_data: Hex): import("../..").CapacityLimit;
24
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AccrualVaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoVaultV1Adapter = void 0;
4
- const viem_1 = require("viem");
5
- const VaultV2Adapter_1 = require("./VaultV2Adapter");
6
- class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter_1.VaultV2Adapter {
7
- static adapterId(address) {
8
- return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["this", address]));
9
- }
10
- morphoVaultV1;
11
- constructor({ morphoVaultV1, ...vaultV2Adapter }) {
12
- super({
13
- ...vaultV2Adapter,
14
- adapterId: VaultV2MorphoVaultV1Adapter.adapterId(vaultV2Adapter.address),
15
- });
16
- this.morphoVaultV1 = morphoVaultV1;
17
- }
18
- ids() {
19
- return [this.adapterId];
20
- }
21
- }
22
- exports.VaultV2MorphoVaultV1Adapter = VaultV2MorphoVaultV1Adapter;
23
- class AccrualVaultV2MorphoVaultV1Adapter extends VaultV2MorphoVaultV1Adapter {
24
- accrualVaultV1;
25
- shares;
26
- constructor(adapter, accrualVaultV1, shares) {
27
- super(adapter);
28
- this.accrualVaultV1 = accrualVaultV1;
29
- this.shares = shares;
30
- }
31
- realAssets(timestamp) {
32
- return this.accrualVaultV1.accrueInterest(timestamp).toAssets(this.shares);
33
- }
34
- maxDeposit(_data, assets) {
35
- return this.accrualVaultV1.maxDeposit(assets);
36
- }
37
- maxWithdraw(_data) {
38
- return this.accrualVaultV1.maxWithdraw(this.shares);
39
- }
40
- }
41
- exports.AccrualVaultV2MorphoVaultV1Adapter = AccrualVaultV2MorphoVaultV1Adapter;
@@ -1,3 +0,0 @@
1
- export * from "./VaultV2.js";
2
- export * from "./VaultV2Adapter.js";
3
- export * from "./VaultV2MorphoVaultV1Adapter.js";
@@ -1,19 +0,0 @@
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("./VaultV2.js"), exports);
18
- __exportStar(require("./VaultV2Adapter.js"), exports);
19
- __exportStar(require("./VaultV2MorphoVaultV1Adapter.js"), exports);