@morpho-org/blue-sdk 6.0.1 → 6.1.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.
- package/lib/cjs/addresses.d.ts +105 -0
- package/lib/cjs/addresses.js +74 -0
- package/lib/cjs/chain.d.ts +84 -1
- package/lib/cjs/chain.js +78 -0
- package/lib/cjs/errors.d.ts +34 -0
- package/lib/cjs/errors.js +28 -0
- package/lib/cjs/holding/AssetBalances.d.ts +3 -0
- package/lib/cjs/holding/AssetBalances.js +1 -0
- package/lib/cjs/holding/Holding.d.ts +6 -0
- package/lib/cjs/holding/Holding.js +2 -0
- package/lib/cjs/market/Market.d.ts +4 -0
- package/lib/cjs/market/MarketParams.d.ts +3 -0
- package/lib/cjs/market/MarketParams.js +1 -0
- package/lib/cjs/market/MarketUtils.d.ts +397 -0
- package/lib/cjs/market/MarketUtils.js +397 -2
- package/lib/cjs/math/AdaptiveCurveIrmLib.d.ts +51 -1
- package/lib/cjs/math/AdaptiveCurveIrmLib.js +51 -1
- package/lib/cjs/math/MathLib.d.ts +152 -4
- package/lib/cjs/math/MathLib.js +151 -4
- package/lib/cjs/math/SharesMath.d.ts +34 -0
- package/lib/cjs/math/SharesMath.js +34 -0
- package/lib/cjs/position/Position.d.ts +4 -0
- package/lib/cjs/position/Position.js +2 -0
- package/lib/cjs/position/PreLiquidationPosition.d.ts +4 -0
- package/lib/cjs/position/PreLiquidationPosition.js +2 -0
- package/lib/cjs/preLiquidation.d.ts +16 -0
- package/lib/cjs/preLiquidation.js +16 -0
- package/lib/cjs/token/ConstantWrappedToken.d.ts +1 -0
- package/lib/cjs/token/ConstantWrappedToken.js +1 -0
- package/lib/cjs/token/Eip5267Domain.d.ts +4 -0
- package/lib/cjs/token/Eip5267Domain.js +2 -0
- package/lib/cjs/token/ExchangeRateWrappedToken.d.ts +1 -0
- package/lib/cjs/token/ExchangeRateWrappedToken.js +1 -0
- package/lib/cjs/token/Token.d.ts +2 -0
- package/lib/cjs/token/Token.js +1 -0
- package/lib/cjs/token/VaultToken.d.ts +2 -0
- package/lib/cjs/token/VaultToken.js +1 -0
- package/lib/cjs/token/WrappedToken.d.ts +1 -0
- package/lib/cjs/token/WrappedToken.js +1 -0
- package/lib/cjs/types.d.ts +17 -0
- package/lib/cjs/types.js +13 -0
- package/lib/cjs/user/User.d.ts +1 -0
- package/lib/cjs/user/User.js +1 -0
- package/lib/cjs/utils.d.ts +2 -0
- package/lib/cjs/utils.js +1 -0
- package/lib/cjs/vault/Vault.d.ts +7 -0
- package/lib/cjs/vault/Vault.js +2 -0
- package/lib/cjs/vault/VaultConfig.d.ts +2 -0
- package/lib/cjs/vault/VaultConfig.js +1 -0
- package/lib/cjs/vault/VaultMarketAllocation.d.ts +2 -0
- package/lib/cjs/vault/VaultMarketAllocation.js +1 -0
- package/lib/cjs/vault/VaultMarketConfig.d.ts +2 -0
- package/lib/cjs/vault/VaultMarketConfig.js +1 -0
- package/lib/cjs/vault/VaultMarketPublicAllocatorConfig.d.ts +1 -0
- package/lib/cjs/vault/VaultMarketPublicAllocatorConfig.js +1 -0
- package/lib/cjs/vault/VaultUser.d.ts +2 -0
- package/lib/cjs/vault/VaultUser.js +1 -0
- package/lib/cjs/vault/VaultUtils.d.ts +49 -0
- package/lib/cjs/vault/VaultUtils.js +49 -0
- package/lib/cjs/vault/v2/VaultV2.d.ts +5 -0
- package/lib/cjs/vault/v2/VaultV2.js +2 -0
- package/lib/cjs/vault/v2/VaultV2Adapter.d.ts +3 -0
- package/lib/cjs/vault/v2/VaultV2Adapter.js +1 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1Adapter.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1Adapter.js +2 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +2 -0
- package/lib/cjs/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoVaultV1Adapter.js +2 -0
- package/lib/esm/addresses.d.ts +105 -0
- package/lib/esm/addresses.js +74 -0
- package/lib/esm/chain.d.ts +84 -1
- package/lib/esm/chain.js +78 -0
- package/lib/esm/errors.d.ts +34 -0
- package/lib/esm/errors.js +28 -0
- package/lib/esm/holding/AssetBalances.d.ts +3 -0
- package/lib/esm/holding/AssetBalances.js +1 -0
- package/lib/esm/holding/Holding.d.ts +6 -0
- package/lib/esm/holding/Holding.js +2 -0
- package/lib/esm/market/Market.d.ts +4 -0
- package/lib/esm/market/MarketParams.d.ts +3 -0
- package/lib/esm/market/MarketParams.js +1 -0
- package/lib/esm/market/MarketUtils.d.ts +397 -0
- package/lib/esm/market/MarketUtils.js +397 -2
- package/lib/esm/math/AdaptiveCurveIrmLib.d.ts +51 -1
- package/lib/esm/math/AdaptiveCurveIrmLib.js +51 -1
- package/lib/esm/math/MathLib.d.ts +152 -4
- package/lib/esm/math/MathLib.js +151 -4
- package/lib/esm/math/SharesMath.d.ts +34 -0
- package/lib/esm/math/SharesMath.js +34 -0
- package/lib/esm/position/Position.d.ts +4 -0
- package/lib/esm/position/Position.js +2 -0
- package/lib/esm/position/PreLiquidationPosition.d.ts +4 -0
- package/lib/esm/position/PreLiquidationPosition.js +2 -0
- package/lib/esm/preLiquidation.d.ts +16 -0
- package/lib/esm/preLiquidation.js +16 -0
- package/lib/esm/token/ConstantWrappedToken.d.ts +1 -0
- package/lib/esm/token/ConstantWrappedToken.js +1 -0
- package/lib/esm/token/Eip5267Domain.d.ts +4 -0
- package/lib/esm/token/Eip5267Domain.js +2 -0
- package/lib/esm/token/ExchangeRateWrappedToken.d.ts +1 -0
- package/lib/esm/token/ExchangeRateWrappedToken.js +1 -0
- package/lib/esm/token/Token.d.ts +2 -0
- package/lib/esm/token/Token.js +1 -0
- package/lib/esm/token/VaultToken.d.ts +2 -0
- package/lib/esm/token/VaultToken.js +1 -0
- package/lib/esm/token/WrappedToken.d.ts +1 -0
- package/lib/esm/token/WrappedToken.js +1 -0
- package/lib/esm/types.d.ts +17 -0
- package/lib/esm/types.js +13 -0
- package/lib/esm/user/User.d.ts +1 -0
- package/lib/esm/user/User.js +1 -0
- package/lib/esm/utils.d.ts +2 -0
- package/lib/esm/utils.js +1 -0
- package/lib/esm/vault/Vault.d.ts +7 -0
- package/lib/esm/vault/Vault.js +2 -0
- package/lib/esm/vault/VaultConfig.d.ts +2 -0
- package/lib/esm/vault/VaultConfig.js +1 -0
- package/lib/esm/vault/VaultMarketAllocation.d.ts +2 -0
- package/lib/esm/vault/VaultMarketAllocation.js +1 -0
- package/lib/esm/vault/VaultMarketConfig.d.ts +2 -0
- package/lib/esm/vault/VaultMarketConfig.js +1 -0
- package/lib/esm/vault/VaultMarketPublicAllocatorConfig.d.ts +1 -0
- package/lib/esm/vault/VaultMarketPublicAllocatorConfig.js +1 -0
- package/lib/esm/vault/VaultUser.d.ts +2 -0
- package/lib/esm/vault/VaultUser.js +1 -0
- package/lib/esm/vault/VaultUtils.d.ts +49 -0
- package/lib/esm/vault/VaultUtils.js +49 -0
- package/lib/esm/vault/v2/VaultV2.d.ts +5 -0
- package/lib/esm/vault/v2/VaultV2.js +2 -0
- package/lib/esm/vault/v2/VaultV2Adapter.d.ts +3 -0
- package/lib/esm/vault/v2/VaultV2Adapter.js +1 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1Adapter.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1Adapter.js +2 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +2 -0
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.js +2 -0
- package/package.json +2 -2
|
@@ -1,11 +1,43 @@
|
|
|
1
1
|
import { MathLib } from "../math/index.js";
|
|
2
|
+
/** ERC-4626 virtual share and asset conversion helpers for MetaMorpho vaults. */
|
|
2
3
|
export var VaultUtils;
|
|
3
4
|
(function (VaultUtils) {
|
|
5
|
+
/** Virtual assets added to ERC-4626 total assets in conversion formulas. */
|
|
4
6
|
VaultUtils.VIRTUAL_ASSETS = 1n;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the decimals offset between 18-decimal vault shares and an asset.
|
|
9
|
+
*
|
|
10
|
+
* @param decimals - The asset decimals.
|
|
11
|
+
* @returns The non-negative decimals offset.
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { VaultUtils } from "@morpho-org/blue-sdk";
|
|
15
|
+
*
|
|
16
|
+
* const offset = VaultUtils.decimalsOffset(6n);
|
|
17
|
+
* // offset === 12n
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
5
20
|
function decimalsOffset(decimals) {
|
|
6
21
|
return MathLib.zeroFloorSub(18n, decimals);
|
|
7
22
|
}
|
|
8
23
|
VaultUtils.decimalsOffset = decimalsOffset;
|
|
24
|
+
/**
|
|
25
|
+
* Converts vault shares to underlying assets.
|
|
26
|
+
*
|
|
27
|
+
* @param shares - The amount of vault shares.
|
|
28
|
+
* @param vault.totalAssets - The vault's total assets.
|
|
29
|
+
* @param vault.totalSupply - The vault's total share supply.
|
|
30
|
+
* @param vault.decimalsOffset - The vault's decimals offset.
|
|
31
|
+
* @param rounding - Optional rounding direction. Defaults to `"Down"`.
|
|
32
|
+
* @returns The equivalent amount of underlying assets.
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { VaultUtils } from "@morpho-org/blue-sdk";
|
|
36
|
+
*
|
|
37
|
+
* const assets = VaultUtils.toAssets(100n, { totalAssets: 1_000n, totalSupply: 100n, decimalsOffset: 0n });
|
|
38
|
+
* // assets satisfies bigint
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
9
41
|
// biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
|
|
10
42
|
function toAssets(shares, { totalAssets, totalSupply,
|
|
11
43
|
// biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
|
|
@@ -13,6 +45,23 @@ export var VaultUtils;
|
|
|
13
45
|
return MathLib.mulDiv(shares, BigInt(totalAssets) + VaultUtils.VIRTUAL_ASSETS, BigInt(totalSupply) + 10n ** BigInt(decimalsOffset), rounding);
|
|
14
46
|
}
|
|
15
47
|
VaultUtils.toAssets = toAssets;
|
|
48
|
+
/**
|
|
49
|
+
* Converts underlying assets to vault shares.
|
|
50
|
+
*
|
|
51
|
+
* @param assets - The amount of underlying assets.
|
|
52
|
+
* @param vault.totalAssets - The vault's total assets.
|
|
53
|
+
* @param vault.totalSupply - The vault's total share supply.
|
|
54
|
+
* @param vault.decimalsOffset - The vault's decimals offset.
|
|
55
|
+
* @param rounding - Optional rounding direction. Defaults to `"Up"`.
|
|
56
|
+
* @returns The equivalent amount of vault shares.
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { VaultUtils } from "@morpho-org/blue-sdk";
|
|
60
|
+
*
|
|
61
|
+
* const shares = VaultUtils.toShares(100n, { totalAssets: 1_000n, totalSupply: 100n, decimalsOffset: 0n });
|
|
62
|
+
* // shares satisfies bigint
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
16
65
|
// biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
|
|
17
66
|
function toShares(assets, { totalAssets, totalSupply,
|
|
18
67
|
// biome-ignore lint/nursery/noShadow: TODO rename to avoid shadowing
|
|
@@ -4,12 +4,14 @@ import { type IToken, WrappedToken } from "../../token/index.js";
|
|
|
4
4
|
import type { BigIntish } from "../../types.js";
|
|
5
5
|
import { type CapacityLimit } from "../../utils.js";
|
|
6
6
|
import type { IAccrualVaultV2Adapter } from "./VaultV2Adapter.js";
|
|
7
|
+
/** Plain input shape for one Vault V2 liquidity allocation. */
|
|
7
8
|
export interface IVaultV2Allocation {
|
|
8
9
|
id: Hash;
|
|
9
10
|
absoluteCap: bigint;
|
|
10
11
|
relativeCap: bigint;
|
|
11
12
|
allocation: bigint;
|
|
12
13
|
}
|
|
14
|
+
/** Plain input shape for a Morpho Vault V2. */
|
|
13
15
|
export interface IVaultV2 extends IToken {
|
|
14
16
|
asset: Address;
|
|
15
17
|
/**
|
|
@@ -32,6 +34,7 @@ export interface IVaultV2 extends IToken {
|
|
|
32
34
|
performanceFeeRecipient: Address;
|
|
33
35
|
managementFeeRecipient: Address;
|
|
34
36
|
}
|
|
37
|
+
/** Represents a Morpho Vault V2 and its fee, adapter, and accounting state. */
|
|
35
38
|
export declare class VaultV2 extends WrappedToken implements IVaultV2 {
|
|
36
39
|
readonly asset: Address;
|
|
37
40
|
_totalAssets: bigint;
|
|
@@ -53,8 +56,10 @@ export declare class VaultV2 extends WrappedToken implements IVaultV2 {
|
|
|
53
56
|
protected _wrap(amount: BigIntish, rounding: RoundingDirection): bigint;
|
|
54
57
|
protected _unwrap(amount: BigIntish, rounding: RoundingDirection): bigint;
|
|
55
58
|
}
|
|
59
|
+
/** Plain input shape for a Morpho Vault V2 paired with accrued adapter state. */
|
|
56
60
|
export interface IAccrualVaultV2 extends Omit<IVaultV2, "adapters"> {
|
|
57
61
|
}
|
|
62
|
+
/** Represents a Morpho Vault V2 with accrued adapter and liquidity state. */
|
|
58
63
|
export declare class AccrualVaultV2 extends VaultV2 implements IAccrualVaultV2 {
|
|
59
64
|
accrualLiquidityAdapter: IAccrualVaultV2Adapter | undefined;
|
|
60
65
|
accrualAdapters: IAccrualVaultV2Adapter[];
|
|
@@ -3,6 +3,7 @@ import { VaultV2Errors } from "../../errors.js";
|
|
|
3
3
|
import { MathLib } from "../../math/index.js";
|
|
4
4
|
import { WrappedToken } from "../../token/index.js";
|
|
5
5
|
import { CapacityLimitReason } from "../../utils.js";
|
|
6
|
+
/** Represents a Morpho Vault V2 and its fee, adapter, and accounting state. */
|
|
6
7
|
export class VaultV2 extends WrappedToken {
|
|
7
8
|
asset;
|
|
8
9
|
_totalAssets;
|
|
@@ -49,6 +50,7 @@ export class VaultV2 extends WrappedToken {
|
|
|
49
50
|
return MathLib.mulDiv(amount, this._totalAssets + 1n, this.totalSupply + this.virtualShares, rounding);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
/** Represents a Morpho Vault V2 with accrued adapter and liquidity state. */
|
|
52
54
|
export class AccrualVaultV2 extends VaultV2 {
|
|
53
55
|
accrualLiquidityAdapter;
|
|
54
56
|
accrualAdapters;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address, Hash, Hex } from "viem";
|
|
2
2
|
import type { BigIntish } from "../../types.js";
|
|
3
3
|
import type { CapacityLimit } from "../../utils.js";
|
|
4
|
+
/** Plain input shape for a Morpho Vault V2 adapter. */
|
|
4
5
|
export interface IVaultV2Adapter {
|
|
5
6
|
type: string;
|
|
6
7
|
address: Address;
|
|
@@ -8,6 +9,7 @@ export interface IVaultV2Adapter {
|
|
|
8
9
|
adapterId: Hash;
|
|
9
10
|
skimRecipient: Address;
|
|
10
11
|
}
|
|
12
|
+
/** Base class for Morpho Vault V2 adapters. */
|
|
11
13
|
export declare abstract class VaultV2Adapter implements IVaultV2Adapter {
|
|
12
14
|
readonly type: string;
|
|
13
15
|
readonly address: Address;
|
|
@@ -16,6 +18,7 @@ export declare abstract class VaultV2Adapter implements IVaultV2Adapter {
|
|
|
16
18
|
skimRecipient: Address;
|
|
17
19
|
constructor({ type, address, parentVault, adapterId, skimRecipient, }: IVaultV2Adapter);
|
|
18
20
|
}
|
|
21
|
+
/** Adapter interface with accrued asset and capacity methods. */
|
|
19
22
|
export interface IAccrualVaultV2Adapter extends IVaultV2Adapter {
|
|
20
23
|
realAssets(timestamp: BigIntish): bigint;
|
|
21
24
|
/**
|
|
@@ -5,10 +5,12 @@ import type { BigIntish } from "../../types.js";
|
|
|
5
5
|
import { CapacityLimitReason } from "../../utils.js";
|
|
6
6
|
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter.js";
|
|
7
7
|
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
8
|
+
/** Plain input shape for a Vault V2 adapter investing in Morpho Blue markets. */
|
|
8
9
|
export interface IVaultV2MorphoMarketV1Adapter extends Omit<IVaultV2Adapter, "adapterId" | "type"> {
|
|
9
10
|
type?: "VaultV2MorphoMarketV1Adapter";
|
|
10
11
|
marketParamsList: IMarketParams[];
|
|
11
12
|
}
|
|
13
|
+
/** Represents a Vault V2 adapter investing in Morpho Blue markets. */
|
|
12
14
|
export declare class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter implements IVaultV2MorphoMarketV1Adapter {
|
|
13
15
|
readonly type: "VaultV2MorphoMarketV1Adapter";
|
|
14
16
|
static adapterId(address: Address): `0x${string}`;
|
|
@@ -18,8 +20,10 @@ export declare class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter impleme
|
|
|
18
20
|
constructor({ marketParamsList, ...vaultV2Adapter }: IVaultV2MorphoMarketV1Adapter);
|
|
19
21
|
ids(params: MarketParams): `0x${string}`[];
|
|
20
22
|
}
|
|
23
|
+
/** Plain input shape for an accrued Morpho Blue market Vault V2 adapter. */
|
|
21
24
|
export interface IAccrualVaultV2MorphoMarketV1Adapter extends IVaultV2MorphoMarketV1Adapter {
|
|
22
25
|
}
|
|
26
|
+
/** Represents an accrued Morpho Blue market Vault V2 adapter. */
|
|
23
27
|
export declare class AccrualVaultV2MorphoMarketV1Adapter extends VaultV2MorphoMarketV1Adapter implements IAccrualVaultV2MorphoMarketV1Adapter, IAccrualVaultV2Adapter {
|
|
24
28
|
positions: AccrualPosition[];
|
|
25
29
|
constructor(adapter: IAccrualVaultV2MorphoMarketV1Adapter, positions: AccrualPosition[]);
|
|
@@ -2,6 +2,7 @@ import { encodeAbiParameters, keccak256 } from "viem";
|
|
|
2
2
|
import { MarketParams, marketParamsAbi, } from "../../market/index.js";
|
|
3
3
|
import { CapacityLimitReason } from "../../utils.js";
|
|
4
4
|
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
5
|
+
/** Represents a Vault V2 adapter investing in Morpho Blue markets. */
|
|
5
6
|
export class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter {
|
|
6
7
|
static adapterId(address) {
|
|
7
8
|
return keccak256(encodeAbiParameters([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
@@ -29,6 +30,7 @@ export class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter {
|
|
|
29
30
|
];
|
|
30
31
|
}
|
|
31
32
|
}
|
|
33
|
+
/** Represents an accrued Morpho Blue market Vault V2 adapter. */
|
|
32
34
|
export class AccrualVaultV2MorphoMarketV1Adapter extends VaultV2MorphoMarketV1Adapter {
|
|
33
35
|
positions;
|
|
34
36
|
constructor(adapter, positions) {
|
|
@@ -4,12 +4,14 @@ import type { BigIntish, MarketId } from "../../types.js";
|
|
|
4
4
|
import { CapacityLimitReason } from "../../utils.js";
|
|
5
5
|
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter.js";
|
|
6
6
|
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
7
|
+
/** Plain input shape for a Vault V2 Morpho Blue market adapter using market ids. */
|
|
7
8
|
export interface IVaultV2MorphoMarketV1AdapterV2 extends Omit<IVaultV2Adapter, "adapterId" | "type"> {
|
|
8
9
|
type?: "VaultV2MorphoMarketV1AdapterV2";
|
|
9
10
|
marketIds: MarketId[];
|
|
10
11
|
adaptiveCurveIrm: Address;
|
|
11
12
|
supplyShares: Record<MarketId, bigint>;
|
|
12
13
|
}
|
|
14
|
+
/** Represents a Vault V2 Morpho Blue market adapter using market ids. */
|
|
13
15
|
export declare class VaultV2MorphoMarketV1AdapterV2 extends VaultV2Adapter implements IVaultV2MorphoMarketV1AdapterV2 {
|
|
14
16
|
readonly type: "VaultV2MorphoMarketV1AdapterV2";
|
|
15
17
|
static adapterId(address: Address): `0x${string}`;
|
|
@@ -21,8 +23,10 @@ export declare class VaultV2MorphoMarketV1AdapterV2 extends VaultV2Adapter imple
|
|
|
21
23
|
constructor({ marketIds, adaptiveCurveIrm, supplyShares, ...vaultV2Adapter }: IVaultV2MorphoMarketV1AdapterV2);
|
|
22
24
|
ids(params: MarketParams): `0x${string}`[];
|
|
23
25
|
}
|
|
26
|
+
/** Plain input shape for an accrued Vault V2 Morpho Blue market-id adapter. */
|
|
24
27
|
export interface IAccrualVaultV2MorphoMarketV1AdapterV2 extends IVaultV2MorphoMarketV1AdapterV2 {
|
|
25
28
|
}
|
|
29
|
+
/** Represents an accrued Vault V2 Morpho Blue market-id adapter. */
|
|
26
30
|
export declare class AccrualVaultV2MorphoMarketV1AdapterV2 extends VaultV2MorphoMarketV1AdapterV2 implements IAccrualVaultV2MorphoMarketV1AdapterV2, IAccrualVaultV2Adapter {
|
|
27
31
|
markets: Market[];
|
|
28
32
|
constructor(adapter: IAccrualVaultV2MorphoMarketV1AdapterV2, markets: Market[]);
|
|
@@ -2,6 +2,7 @@ import { encodeAbiParameters, keccak256 } from "viem";
|
|
|
2
2
|
import { MarketParams, marketParamsAbi, } from "../../market/index.js";
|
|
3
3
|
import { CapacityLimitReason } from "../../utils.js";
|
|
4
4
|
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
5
|
+
/** Represents a Vault V2 Morpho Blue market adapter using market ids. */
|
|
5
6
|
export class VaultV2MorphoMarketV1AdapterV2 extends VaultV2Adapter {
|
|
6
7
|
static adapterId(address) {
|
|
7
8
|
return keccak256(encodeAbiParameters([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
@@ -33,6 +34,7 @@ export class VaultV2MorphoMarketV1AdapterV2 extends VaultV2Adapter {
|
|
|
33
34
|
];
|
|
34
35
|
}
|
|
35
36
|
}
|
|
37
|
+
/** Represents an accrued Vault V2 Morpho Blue market-id adapter. */
|
|
36
38
|
export class AccrualVaultV2MorphoMarketV1AdapterV2 extends VaultV2MorphoMarketV1AdapterV2 {
|
|
37
39
|
markets;
|
|
38
40
|
constructor(adapter, markets) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
2
|
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
3
|
+
/** Plain input shape for a Vault V2 adapter investing in a MetaMorpho V1 vault. */
|
|
3
4
|
export interface IVaultV2MorphoVaultV1Adapter extends Omit<IVaultV2Adapter, "adapterId" | "type"> {
|
|
4
5
|
type?: "VaultV2MorphoVaultV1Adapter";
|
|
5
6
|
morphoVaultV1: Address;
|
|
@@ -7,6 +8,7 @@ export interface IVaultV2MorphoVaultV1Adapter extends Omit<IVaultV2Adapter, "ada
|
|
|
7
8
|
import type { BigIntish } from "../../types.js";
|
|
8
9
|
import type { AccrualVault } from "../Vault.js";
|
|
9
10
|
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter.js";
|
|
11
|
+
/** Represents a Vault V2 adapter investing in a MetaMorpho V1 vault. */
|
|
10
12
|
export declare class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter implements IVaultV2MorphoVaultV1Adapter {
|
|
11
13
|
readonly type: "VaultV2MorphoVaultV1Adapter";
|
|
12
14
|
static adapterId(address: Address): `0x${string}`;
|
|
@@ -14,8 +16,10 @@ export declare class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter implemen
|
|
|
14
16
|
constructor({ morphoVaultV1, ...vaultV2Adapter }: IVaultV2MorphoVaultV1Adapter);
|
|
15
17
|
ids(): `0x${string}`[];
|
|
16
18
|
}
|
|
19
|
+
/** Plain input shape for an accrued Vault V2 MetaMorpho V1 adapter. */
|
|
17
20
|
export interface IAccrualVaultV2MorphoVaultV1Adapter extends IVaultV2MorphoVaultV1Adapter {
|
|
18
21
|
}
|
|
22
|
+
/** Represents an accrued Vault V2 MetaMorpho V1 adapter. */
|
|
19
23
|
export declare class AccrualVaultV2MorphoVaultV1Adapter extends VaultV2MorphoVaultV1Adapter implements IAccrualVaultV2MorphoVaultV1Adapter, IAccrualVaultV2Adapter {
|
|
20
24
|
accrualVaultV1: AccrualVault;
|
|
21
25
|
shares: bigint;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { encodeAbiParameters, keccak256 } from "viem";
|
|
2
2
|
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
3
|
+
/** Represents a Vault V2 adapter investing in a MetaMorpho V1 vault. */
|
|
3
4
|
export class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter {
|
|
4
5
|
static adapterId(address) {
|
|
5
6
|
return keccak256(encodeAbiParameters([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
@@ -17,6 +18,7 @@ export class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter {
|
|
|
17
18
|
return [this.adapterId];
|
|
18
19
|
}
|
|
19
20
|
}
|
|
21
|
+
/** Represents an accrued Vault V2 MetaMorpho V1 adapter. */
|
|
20
22
|
export class AccrualVaultV2MorphoVaultV1Adapter extends VaultV2MorphoVaultV1Adapter {
|
|
21
23
|
accrualVaultV1;
|
|
22
24
|
shares;
|
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": "6.0
|
|
4
|
+
"version": "6.1.0",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Rubilmax <rmilon@gmail.com>"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"typescript": "^6.0.3",
|
|
37
37
|
"viem": "^2.50.4",
|
|
38
38
|
"vitest": "^4.1.7",
|
|
39
|
-
"@morpho-org/morpho-ts": "^2.
|
|
39
|
+
"@morpho-org/morpho-ts": "^2.6.0",
|
|
40
40
|
"@morpho-org/test": "^2.8.1"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|