@morpho-org/blue-sdk 2.0.0-next.1 → 2.0.0-next.4

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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -9
  3. package/lib/addresses.d.ts +117 -0
  4. package/lib/addresses.js +156 -0
  5. package/lib/chain.d.ts +29 -0
  6. package/lib/chain.js +286 -0
  7. package/lib/constants.d.ts +29 -0
  8. package/lib/constants.js +30 -0
  9. package/lib/errors.d.ts +52 -0
  10. package/lib/errors.js +97 -0
  11. package/lib/holding/AssetBalances.d.ts +48 -0
  12. package/lib/holding/AssetBalances.js +38 -0
  13. package/lib/holding/Holding.d.ts +64 -0
  14. package/lib/holding/Holding.js +65 -0
  15. package/lib/holding/index.d.ts +2 -0
  16. package/lib/holding/index.js +2 -0
  17. package/lib/index.js +12 -0
  18. package/lib/market/Market.d.ts +332 -0
  19. package/lib/market/Market.js +459 -0
  20. package/lib/market/MarketConfig.d.ts +52 -0
  21. package/lib/market/MarketConfig.js +73 -0
  22. package/lib/market/MarketUtils.d.ts +233 -0
  23. package/lib/market/MarketUtils.js +257 -0
  24. package/lib/market/index.d.ts +3 -0
  25. package/lib/market/index.js +3 -0
  26. package/lib/math/AdaptiveCurveIrmLib.d.ts +39 -0
  27. package/lib/math/AdaptiveCurveIrmLib.js +131 -0
  28. package/lib/math/MathLib.d.ts +111 -0
  29. package/lib/math/MathLib.js +185 -0
  30. package/lib/math/SharesMath.d.ts +12 -0
  31. package/lib/math/SharesMath.js +18 -0
  32. package/lib/math/index.d.ts +3 -0
  33. package/lib/math/index.js +3 -0
  34. package/lib/position/Position.d.ts +127 -0
  35. package/lib/position/Position.js +199 -0
  36. package/lib/position/index.d.ts +1 -0
  37. package/lib/position/index.js +1 -0
  38. package/lib/token/ConstantWrappedToken.d.ts +17 -0
  39. package/lib/token/ConstantWrappedToken.js +30 -0
  40. package/lib/token/ExchangeRateWrappedToken.d.ts +11 -0
  41. package/lib/token/ExchangeRateWrappedToken.js +17 -0
  42. package/lib/token/Token.d.ts +46 -0
  43. package/lib/token/Token.js +59 -0
  44. package/lib/token/VaultToken.d.ts +23 -0
  45. package/lib/token/VaultToken.js +27 -0
  46. package/lib/token/WrappedToken.d.ts +17 -0
  47. package/lib/token/WrappedToken.js +29 -0
  48. package/lib/token/index.d.ts +5 -0
  49. package/lib/token/index.js +5 -0
  50. package/lib/types.d.ts +27 -0
  51. package/lib/types.js +17 -0
  52. package/lib/user/User.d.ts +20 -0
  53. package/lib/user/User.js +19 -0
  54. package/lib/user/index.d.ts +1 -0
  55. package/lib/user/index.js +1 -0
  56. package/lib/vault/Vault.d.ts +152 -0
  57. package/lib/vault/Vault.js +221 -0
  58. package/lib/vault/VaultConfig.d.ts +22 -0
  59. package/lib/vault/VaultConfig.js +28 -0
  60. package/lib/vault/VaultMarketAllocation.d.ts +20 -0
  61. package/lib/vault/VaultMarketAllocation.js +26 -0
  62. package/lib/vault/VaultMarketConfig.d.ts +43 -0
  63. package/lib/vault/VaultMarketConfig.js +39 -0
  64. package/lib/vault/VaultMarketPublicAllocatorConfig.d.ts +29 -0
  65. package/lib/vault/VaultMarketPublicAllocatorConfig.js +24 -0
  66. package/lib/vault/VaultUser.d.ts +26 -0
  67. package/lib/vault/VaultUser.js +24 -0
  68. package/lib/vault/VaultUtils.d.ts +16 -0
  69. package/lib/vault/VaultUtils.js +17 -0
  70. package/lib/vault/index.d.ts +7 -0
  71. package/lib/vault/index.js +7 -0
  72. package/package.json +30 -34
  73. /package/{src/index.ts → lib/index.d.ts} +0 -0
@@ -0,0 +1,30 @@
1
+ import { MathLib } from "../math/index.js";
2
+ import { WrappedToken } from "./WrappedToken.js";
3
+ export class ConstantWrappedToken extends WrappedToken {
4
+ underlyingDecimals;
5
+ constructor(token, underlying, underlyingDecimals = 18n) {
6
+ super(token, underlying);
7
+ this.underlyingDecimals = BigInt(underlyingDecimals);
8
+ }
9
+ toWrappedExactAmountIn(unwrappedAmount, _slippage, rounding = "Down") {
10
+ return super.toWrappedExactAmountIn(unwrappedAmount, 0n, rounding);
11
+ }
12
+ /** The amount of unwrappedTokens that should be wrapped to receive `wrappedAmount` */
13
+ toWrappedExactAmountOut(wrappedAmount, _slippage, rounding = "Up") {
14
+ return super.toWrappedExactAmountOut(wrappedAmount, 0n, rounding);
15
+ }
16
+ /** The expected amount when unwrapping `wrappedAmount` */
17
+ toUnwrappedExactAmountIn(wrappedAmount, _slippage, rounding = "Down") {
18
+ return super.toUnwrappedExactAmountIn(wrappedAmount, 0n, rounding);
19
+ }
20
+ /** The amount of wrappedTokens that should be unwrapped to receive `unwrappedAmount` */
21
+ toUnwrappedExactAmountOut(unwrappedAmount, _slippage, rounding = "Up") {
22
+ return super.toUnwrappedExactAmountOut(unwrappedAmount, 0n, rounding);
23
+ }
24
+ _wrap(amount) {
25
+ return MathLib.mulDivDown(amount, 10n ** BigInt(this.decimals), 10n ** this.underlyingDecimals);
26
+ }
27
+ _unwrap(amount) {
28
+ return MathLib.mulDivDown(amount, 10n ** this.underlyingDecimals, 10n ** BigInt(this.decimals));
29
+ }
30
+ }
@@ -0,0 +1,11 @@
1
+ import { type RoundingDirection } from "../math/index.js";
2
+ import type { Address } from "../types.js";
3
+ import type { InputToken } from "./Token.js";
4
+ import { WrappedToken } from "./WrappedToken.js";
5
+ export declare class ExchangeRateWrappedToken extends WrappedToken {
6
+ readonly underlying: Address;
7
+ wrappedTokenExchangeRate: bigint;
8
+ constructor(token: InputToken, underlying: Address, wrappedTokenExchangeRate: bigint);
9
+ protected _wrap(amount: bigint, rounding: RoundingDirection): bigint;
10
+ protected _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
11
+ }
@@ -0,0 +1,17 @@
1
+ import { MathLib } from "../math/index.js";
2
+ import { WrappedToken } from "./WrappedToken.js";
3
+ export class ExchangeRateWrappedToken extends WrappedToken {
4
+ underlying;
5
+ wrappedTokenExchangeRate;
6
+ constructor(token, underlying, wrappedTokenExchangeRate) {
7
+ super(token, underlying);
8
+ this.underlying = underlying;
9
+ this.wrappedTokenExchangeRate = wrappedTokenExchangeRate;
10
+ }
11
+ _wrap(amount, rounding) {
12
+ return MathLib.wDiv(amount, this.wrappedTokenExchangeRate, rounding);
13
+ }
14
+ _unwrap(amount, rounding) {
15
+ return MathLib.wMul(amount, this.wrappedTokenExchangeRate, rounding);
16
+ }
17
+ }
@@ -0,0 +1,46 @@
1
+ import { type ChainId } from "../chain.js";
2
+ import { type RoundingDirection } from "../math/index.js";
3
+ import type { Address, BigIntish } from "../types.js";
4
+ export interface InputToken {
5
+ address: Address;
6
+ decimals: BigIntish;
7
+ symbol: string;
8
+ name?: string;
9
+ }
10
+ export declare class Token implements InputToken {
11
+ static native(chainId: ChainId): Token;
12
+ /**
13
+ * The token's address.
14
+ */
15
+ readonly address: Address;
16
+ /**
17
+ * The token's number of decimals.
18
+ */
19
+ readonly decimals: number;
20
+ /**
21
+ * The token's symbol.
22
+ */
23
+ readonly symbol: string;
24
+ /**
25
+ * The name of the token (defaults to the symbol).
26
+ */
27
+ readonly name: string;
28
+ constructor({ address, decimals, symbol, name }: InputToken);
29
+ }
30
+ export declare class TokenWithPrice extends Token {
31
+ /**
32
+ * Price of the token in USD (scaled by WAD).
33
+ */
34
+ price?: bigint;
35
+ constructor(token: InputToken, price?: bigint);
36
+ /**
37
+ * Quotes an amount in USD (scaled by WAD) in this token.
38
+ * @param amount The amount of USD to quote.
39
+ */
40
+ fromUsd(amount: bigint, rounding?: RoundingDirection): bigint | null;
41
+ /**
42
+ * Quotes an amount of tokens in USD (scaled by WAD).
43
+ * @param amount The amount of tokens to quote.
44
+ */
45
+ toUsd(amount: bigint, rounding?: RoundingDirection): bigint | null;
46
+ }
@@ -0,0 +1,59 @@
1
+ import { NATIVE_ADDRESS } from "../addresses.js";
2
+ import { ChainUtils } from "../chain.js";
3
+ import { MathLib } from "../math/index.js";
4
+ export class Token {
5
+ static native(chainId) {
6
+ const currency = ChainUtils.CHAIN_METADATA[chainId].nativeCurrency;
7
+ return new Token({ ...currency, address: NATIVE_ADDRESS });
8
+ }
9
+ /**
10
+ * The token's address.
11
+ */
12
+ address;
13
+ /**
14
+ * The token's number of decimals.
15
+ */
16
+ decimals;
17
+ /**
18
+ * The token's symbol.
19
+ */
20
+ symbol;
21
+ /**
22
+ * The name of the token (defaults to the symbol).
23
+ */
24
+ name;
25
+ constructor({ address, decimals, symbol, name }) {
26
+ this.address = address;
27
+ this.decimals = Number(decimals);
28
+ this.symbol = symbol;
29
+ this.name = name ?? symbol;
30
+ }
31
+ }
32
+ export class TokenWithPrice extends Token {
33
+ /**
34
+ * Price of the token in USD (scaled by WAD).
35
+ */
36
+ price;
37
+ constructor(token, price) {
38
+ super(token);
39
+ this.price = price;
40
+ }
41
+ /**
42
+ * Quotes an amount in USD (scaled by WAD) in this token.
43
+ * @param amount The amount of USD to quote.
44
+ */
45
+ fromUsd(amount, rounding = "Down") {
46
+ if (this.price == null)
47
+ return null;
48
+ return MathLib.mulDiv(amount, 10n ** BigInt(this.decimals), this.price, rounding);
49
+ }
50
+ /**
51
+ * Quotes an amount of tokens in USD (scaled by WAD).
52
+ * @param amount The amount of tokens to quote.
53
+ */
54
+ toUsd(amount, rounding = "Down") {
55
+ if (this.price == null)
56
+ return null;
57
+ return MathLib.mulDiv(amount, this.price, 10n ** BigInt(this.decimals), rounding);
58
+ }
59
+ }
@@ -0,0 +1,23 @@
1
+ import type { RoundingDirection } from "../math/index.js";
2
+ import type { Address } from "../types.js";
3
+ import type { InputVaultConfig } from "../vault/VaultConfig.js";
4
+ import { WrappedToken } from "./WrappedToken.js";
5
+ export interface InputVaultToken {
6
+ totalAssets: bigint;
7
+ totalSupply: bigint;
8
+ }
9
+ export declare class VaultToken extends WrappedToken implements InputVaultToken {
10
+ readonly asset: Address;
11
+ readonly decimalsOffset: bigint;
12
+ /**
13
+ * The ERC4626 vault's total supply of shares.
14
+ */
15
+ totalSupply: bigint;
16
+ /**
17
+ * The ERC4626 vault's total assets.
18
+ */
19
+ totalAssets: bigint;
20
+ constructor(config: InputVaultConfig, { totalAssets, totalSupply }: InputVaultToken);
21
+ protected _wrap(amount: bigint, rounding?: RoundingDirection): bigint;
22
+ protected _unwrap(amount: bigint, rounding?: RoundingDirection): bigint;
23
+ }
@@ -0,0 +1,27 @@
1
+ import { VaultUtils } from "../vault/VaultUtils.js";
2
+ import { WrappedToken } from "./WrappedToken.js";
3
+ export class VaultToken extends WrappedToken {
4
+ asset;
5
+ decimalsOffset;
6
+ /**
7
+ * The ERC4626 vault's total supply of shares.
8
+ */
9
+ totalSupply;
10
+ /**
11
+ * The ERC4626 vault's total assets.
12
+ */
13
+ totalAssets;
14
+ constructor(config, { totalAssets, totalSupply }) {
15
+ super(config, config.asset);
16
+ this.asset = config.asset;
17
+ this.totalAssets = totalAssets;
18
+ this.totalSupply = totalSupply;
19
+ this.decimalsOffset = BigInt(config.decimalsOffset);
20
+ }
21
+ _wrap(amount, rounding) {
22
+ return VaultUtils.toShares(amount, this, rounding);
23
+ }
24
+ _unwrap(amount, rounding) {
25
+ return VaultUtils.toAssets(amount, this, rounding);
26
+ }
27
+ }
@@ -0,0 +1,17 @@
1
+ import { type RoundingDirection } from "../math/index.js";
2
+ import type { Address } from "../types.js";
3
+ import { type InputToken, Token } from "./Token.js";
4
+ export declare abstract class WrappedToken extends Token {
5
+ readonly underlying: Address;
6
+ constructor(token: InputToken, underlying: Address);
7
+ /** The expected amount when wrapping `unwrappedAmount` */
8
+ toWrappedExactAmountIn(unwrappedAmount: bigint, slippage?: bigint, rounding?: RoundingDirection): bigint;
9
+ /** The amount of unwrappedTokens that should be wrapped to receive `wrappedAmount` */
10
+ toWrappedExactAmountOut(wrappedAmount: bigint, slippage?: bigint, rounding?: RoundingDirection): bigint;
11
+ /** The expected amount when unwrapping `wrappedAmount` */
12
+ toUnwrappedExactAmountIn(wrappedAmount: bigint, slippage?: bigint, rounding?: RoundingDirection): bigint;
13
+ /** The amount of wrappedTokens that should be unwrapped to receive `unwrappedAmount` */
14
+ toUnwrappedExactAmountOut(unwrappedAmount: bigint, slippage?: bigint, rounding?: RoundingDirection): bigint;
15
+ protected abstract _wrap(amount: bigint, rounding: RoundingDirection): bigint;
16
+ protected abstract _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
17
+ }
@@ -0,0 +1,29 @@
1
+ import { MathLib } from "../math/index.js";
2
+ import { Token } from "./Token.js";
3
+ export class WrappedToken extends Token {
4
+ underlying;
5
+ constructor(token, underlying) {
6
+ super(token);
7
+ this.underlying = underlying;
8
+ }
9
+ /** The expected amount when wrapping `unwrappedAmount` */
10
+ toWrappedExactAmountIn(unwrappedAmount, slippage = 0n, rounding = "Down") {
11
+ const wrappedAmount = this._wrap(unwrappedAmount, rounding);
12
+ return MathLib.wMul(wrappedAmount, MathLib.WAD - slippage, "Down");
13
+ }
14
+ /** The amount of unwrappedTokens that should be wrapped to receive `wrappedAmount` */
15
+ toWrappedExactAmountOut(wrappedAmount, slippage = 0n, rounding = "Up") {
16
+ const wAmountTarget = MathLib.wDiv(wrappedAmount, MathLib.WAD - slippage, rounding);
17
+ return this._unwrap(wAmountTarget, rounding);
18
+ }
19
+ /** The expected amount when unwrapping `wrappedAmount` */
20
+ toUnwrappedExactAmountIn(wrappedAmount, slippage = 0n, rounding = "Down") {
21
+ const unwrappedAmount = this._unwrap(wrappedAmount, rounding);
22
+ return MathLib.wMul(unwrappedAmount, MathLib.WAD - slippage, "Up");
23
+ }
24
+ /** The amount of wrappedTokens that should be unwrapped to receive `unwrappedAmount` */
25
+ toUnwrappedExactAmountOut(unwrappedAmount, slippage = 0n, rounding = "Up") {
26
+ const unwrappedAmountToTarget = MathLib.wDiv(unwrappedAmount, MathLib.WAD - slippage, rounding);
27
+ return this._wrap(unwrappedAmountToTarget, rounding);
28
+ }
29
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./Token.js";
2
+ export * from "./WrappedToken.js";
3
+ export * from "./ConstantWrappedToken.js";
4
+ export * from "./ExchangeRateWrappedToken.js";
5
+ export * from "./VaultToken.js";
@@ -0,0 +1,5 @@
1
+ export * from "./Token.js";
2
+ export * from "./WrappedToken.js";
3
+ export * from "./ConstantWrappedToken.js";
4
+ export * from "./ExchangeRateWrappedToken.js";
5
+ export * from "./VaultToken.js";
package/lib/types.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The address of a Contract, or an EOA
3
+ */
4
+ export type Address = `0x${string}`;
5
+ /**
6
+ * The id of a market used on the Blue contract
7
+ */
8
+ export type MarketId = `0x${string}` & {
9
+ __TYPE__: "marketId";
10
+ };
11
+ export type BigIntish = bigint | string | number | boolean;
12
+ /**
13
+ * The possible transaction type on the Blue contract
14
+ */
15
+ export declare enum TransactionType {
16
+ Supply = "Supply",
17
+ SupplyCollateral = "Supply Collateral",
18
+ Withdraw = "Withdraw",
19
+ WithdrawCollateral = "Withdraw Collateral",
20
+ Borrow = "Borrow",
21
+ Repay = "Repay"
22
+ }
23
+ export type Loadable<T> = T | undefined;
24
+ export type Failable<T> = T | null;
25
+ export type Fetchable<T> = Failable<Loadable<T>>;
26
+ export declare function isFetched<T>(v: Fetchable<T>): v is T;
27
+ export declare const isMarketId: (value: unknown) => value is MarketId;
package/lib/types.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The possible transaction type on the Blue contract
3
+ */
4
+ export var TransactionType;
5
+ (function (TransactionType) {
6
+ TransactionType["Supply"] = "Supply";
7
+ TransactionType["SupplyCollateral"] = "Supply Collateral";
8
+ TransactionType["Withdraw"] = "Withdraw";
9
+ TransactionType["WithdrawCollateral"] = "Withdraw Collateral";
10
+ TransactionType["Borrow"] = "Borrow";
11
+ TransactionType["Repay"] = "Repay";
12
+ })(TransactionType || (TransactionType = {}));
13
+ // TODO: replace with isDefined
14
+ export function isFetched(v) {
15
+ return v !== undefined && v !== null;
16
+ }
17
+ export const isMarketId = (value) => typeof value === "string" && /^0x[0-9A-Fa-f]{64}$/.test(value);
@@ -0,0 +1,20 @@
1
+ import type { Address } from "../types.js";
2
+ export declare class User {
3
+ /**
4
+ * The user's address.
5
+ */
6
+ readonly address: Address;
7
+ /**
8
+ * Whether the bundler is authorized to manage the user's position on Morpho Blue.
9
+ */
10
+ isBundlerAuthorized: boolean;
11
+ /**
12
+ * The user's nonce on Morpho Blue.
13
+ */
14
+ morphoNonce: bigint;
15
+ constructor({ address, isBundlerAuthorized, morphoNonce, }: {
16
+ address: Address;
17
+ isBundlerAuthorized: boolean;
18
+ morphoNonce: bigint;
19
+ });
20
+ }
@@ -0,0 +1,19 @@
1
+ export class User {
2
+ /**
3
+ * The user's address.
4
+ */
5
+ address;
6
+ /**
7
+ * Whether the bundler is authorized to manage the user's position on Morpho Blue.
8
+ */
9
+ isBundlerAuthorized;
10
+ /**
11
+ * The user's nonce on Morpho Blue.
12
+ */
13
+ morphoNonce;
14
+ constructor({ address, isBundlerAuthorized, morphoNonce, }) {
15
+ this.address = address;
16
+ this.isBundlerAuthorized = isBundlerAuthorized;
17
+ this.morphoNonce = morphoNonce;
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ export * from "./User.js";
@@ -0,0 +1 @@
1
+ export * from "./User.js";
@@ -0,0 +1,152 @@
1
+ import { type CapacityLimit } from "../market/index.js";
2
+ import { type RoundingDirection } from "../math/index.js";
3
+ import { VaultToken } from "../token/index.js";
4
+ import type { Address, BigIntish, MarketId } from "../types.js";
5
+ import type { InputVaultConfig } from "./VaultConfig.js";
6
+ import { type InputVaultMarketAllocation, VaultMarketAllocation } from "./VaultMarketAllocation.js";
7
+ export interface Pending<T> {
8
+ value: T;
9
+ validAt: bigint;
10
+ }
11
+ export interface VaultPublicAllocatorConfig {
12
+ /**
13
+ * The PublicAllocator's admin address.
14
+ */
15
+ admin: Address;
16
+ /**
17
+ * The PublicAllocator's reallocation fee (in native token).
18
+ */
19
+ fee: bigint;
20
+ /**
21
+ * The PublicAllocator's reallocation fee accrued so far (in native token).
22
+ */
23
+ accruedFee: bigint;
24
+ }
25
+ export interface InputVault extends InputVaultConfig {
26
+ curator: Address;
27
+ owner: Address;
28
+ guardian: Address;
29
+ fee: bigint;
30
+ feeRecipient: Address;
31
+ skimRecipient: Address;
32
+ pendingTimelock: Pending<bigint>;
33
+ pendingGuardian: Pending<Address>;
34
+ pendingOwner: Address;
35
+ timelock: bigint;
36
+ supplyQueue: MarketId[];
37
+ withdrawQueue: MarketId[];
38
+ totalSupply: bigint;
39
+ totalAssets: bigint;
40
+ lastTotalAssets: bigint;
41
+ publicAllocatorConfig?: VaultPublicAllocatorConfig;
42
+ }
43
+ export declare class Vault extends VaultToken implements InputVault {
44
+ /**
45
+ * The MetaMorpho vault's owner address.
46
+ */
47
+ owner: Address;
48
+ /**
49
+ * The MetaMorpho vault's curator address.
50
+ */
51
+ curator: Address;
52
+ /**
53
+ * The MetaMorpho vault's guardian address.
54
+ */
55
+ guardian: Address;
56
+ /**
57
+ * The MetaMorpho vault's skim recipient address (mostly used to skim reward tokens claimed to the vault).
58
+ */
59
+ skimRecipient: Address;
60
+ /**
61
+ * The MetaMorpho vault's fee recipient address.
62
+ */
63
+ feeRecipient: Address;
64
+ /**
65
+ * The MetaMorpho vault's timelock (in seconds).
66
+ */
67
+ timelock: bigint;
68
+ /**
69
+ * The MetaMorpho vault's fee.
70
+ */
71
+ fee: bigint;
72
+ /**
73
+ * The MetaMorpho vault's pending owner address and activation timestamp.
74
+ */
75
+ pendingOwner: Address;
76
+ /**
77
+ * The MetaMorpho vault's pending guardian address and activation timestamp.
78
+ */
79
+ pendingGuardian: Pending<Address>;
80
+ /**
81
+ * The MetaMorpho vault's pending timelock (in seconds) and activation timestamp.
82
+ */
83
+ pendingTimelock: Pending<bigint>;
84
+ /**
85
+ * The MetaMorpho vault's ordered supply queue.
86
+ */
87
+ supplyQueue: MarketId[];
88
+ /**
89
+ * The MetaMorpho vault's ordered withdraw queue.
90
+ */
91
+ withdrawQueue: MarketId[];
92
+ /**
93
+ * The MetaMorpho vault's last total assets used to calculate performance fees.
94
+ */
95
+ lastTotalAssets: bigint;
96
+ /**
97
+ * The MetaMorpho vault's public allocator configuration.
98
+ */
99
+ publicAllocatorConfig?: VaultPublicAllocatorConfig;
100
+ constructor({ curator, owner, guardian, publicAllocatorConfig, fee, feeRecipient, skimRecipient, pendingTimelock, pendingGuardian, pendingOwner, timelock, supplyQueue, withdrawQueue, totalSupply, totalAssets, lastTotalAssets, ...config }: InputVault);
101
+ /**
102
+ * The amount of interest in assets accrued since the last interaction with the vault.
103
+ */
104
+ get totalInterest(): bigint;
105
+ toAssets(shares: bigint, rounding?: RoundingDirection): bigint;
106
+ toShares(assets: bigint, rounding?: RoundingDirection): bigint;
107
+ }
108
+ export interface CollateralAllocation {
109
+ address: Address;
110
+ lltvs: Set<bigint>;
111
+ oracles: Set<Address>;
112
+ markets: Set<MarketId>;
113
+ proportion: bigint;
114
+ }
115
+ export interface InputAccrualVault extends Omit<InputVault, "withdrawQueue" | "totalAssets"> {
116
+ }
117
+ export declare class AccrualVault extends Vault implements InputAccrualVault {
118
+ /**
119
+ * The allocation of the vault on each market enabled.
120
+ */
121
+ readonly allocations: Map<MarketId, VaultMarketAllocation>;
122
+ /**
123
+ * The proportion of assets of the vault supplied to markets collateralized by each collateral asset.
124
+ */
125
+ readonly collateralAllocations: Map<Address, CollateralAllocation>;
126
+ constructor(vault: InputAccrualVault,
127
+ /**
128
+ * The allocation of the vault on each market of the withdraw queue,
129
+ * in the same order as the withdraw queue.
130
+ */
131
+ allocations: Omit<InputVaultMarketAllocation, "proportion">[]);
132
+ /**
133
+ * The vault's liquidity directly available from allocated markets.
134
+ */
135
+ get liquidity(): bigint;
136
+ /**
137
+ * The MetaMorpho vault's average APY on its assets, including the performance fee.
138
+ */
139
+ get avgApy(): bigint;
140
+ /**
141
+ * The MetaMorpho vault's average APY on its assets, excluding the performance fee.
142
+ */
143
+ get netApy(): bigint;
144
+ getAllocationProportion(marketId: MarketId): bigint;
145
+ getDepositCapacityLimit(assets: bigint): CapacityLimit;
146
+ getWithdrawCapacityLimit(shares: bigint): CapacityLimit;
147
+ /**
148
+ * Returns a new vault derived from this vault, whose interest has been accrued up to the given timestamp.
149
+ * @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to each of the vault's market's `lastUpdate`.
150
+ */
151
+ accrueInterest(timestamp: BigIntish): AccrualVault;
152
+ }