@morpho-org/blue-sdk 6.0.1 → 6.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.
- package/lib/cjs/addresses.d.ts +225 -0
- package/lib/cjs/addresses.js +140 -0
- package/lib/cjs/chain.d.ts +108 -1
- package/lib/cjs/chain.js +94 -0
- package/lib/cjs/errors.d.ts +39 -0
- package/lib/cjs/errors.js +38 -1
- 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 +52 -2
- 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 +9 -0
- package/lib/cjs/vault/Vault.js +14 -1
- 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 +51 -2
- 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 +3 -1
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +3 -1
- 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 +225 -0
- package/lib/esm/addresses.js +140 -0
- package/lib/esm/chain.d.ts +108 -1
- package/lib/esm/chain.js +94 -0
- package/lib/esm/errors.d.ts +39 -0
- package/lib/esm/errors.js +36 -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 +52 -2
- 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 +9 -0
- package/lib/esm/vault/Vault.js +14 -1
- 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 +51 -2
- 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 +3 -1
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +3 -1
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.js +2 -0
- package/package.json +4 -4
|
@@ -1,13 +1,62 @@
|
|
|
1
1
|
import { type RoundingDirection } from "../math/index.js";
|
|
2
2
|
import type { BigIntish } from "../types.js";
|
|
3
|
+
/** ERC-4626 virtual share and asset conversion helpers for MetaMorpho vaults. */
|
|
3
4
|
export declare namespace VaultUtils {
|
|
5
|
+
/** Virtual assets added to ERC-4626 total assets in conversion formulas. */
|
|
4
6
|
const 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: BigIntish): bigint;
|
|
21
|
+
/**
|
|
22
|
+
* Converts vault shares to underlying assets.
|
|
23
|
+
*
|
|
24
|
+
* @param shares - The amount of vault shares.
|
|
25
|
+
* @param vault.totalAssets - The vault's total assets.
|
|
26
|
+
* @param vault.totalSupply - The vault's total share supply.
|
|
27
|
+
* @param vault.decimalsOffset - The vault's decimals offset.
|
|
28
|
+
* @param rounding - Optional rounding direction. Defaults to `"Down"`.
|
|
29
|
+
* @returns The equivalent amount of underlying assets.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { VaultUtils } from "@morpho-org/blue-sdk";
|
|
33
|
+
*
|
|
34
|
+
* const assets = VaultUtils.toAssets(100n, { totalAssets: 1_000n, totalSupply: 100n, decimalsOffset: 0n });
|
|
35
|
+
* // assets satisfies bigint
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
6
38
|
function toAssets(shares: BigIntish, { totalAssets, totalSupply, decimalsOffset, }: {
|
|
7
39
|
totalAssets: BigIntish;
|
|
8
40
|
totalSupply: BigIntish;
|
|
9
41
|
decimalsOffset: BigIntish;
|
|
10
42
|
}, rounding?: RoundingDirection): bigint;
|
|
43
|
+
/**
|
|
44
|
+
* Converts underlying assets to vault shares.
|
|
45
|
+
*
|
|
46
|
+
* @param assets - The amount of underlying assets.
|
|
47
|
+
* @param vault.totalAssets - The vault's total assets.
|
|
48
|
+
* @param vault.totalSupply - The vault's total share supply.
|
|
49
|
+
* @param vault.decimalsOffset - The vault's decimals offset.
|
|
50
|
+
* @param rounding - Optional rounding direction. Defaults to `"Up"`.
|
|
51
|
+
* @returns The equivalent amount of vault shares.
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { VaultUtils } from "@morpho-org/blue-sdk";
|
|
55
|
+
*
|
|
56
|
+
* const shares = VaultUtils.toShares(100n, { totalAssets: 1_000n, totalSupply: 100n, decimalsOffset: 0n });
|
|
57
|
+
* // shares satisfies bigint
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
11
60
|
function toShares(assets: BigIntish, { totalAssets, totalSupply, decimalsOffset, }: {
|
|
12
61
|
totalAssets: BigIntish;
|
|
13
62
|
totalSupply: BigIntish;
|
|
@@ -2,23 +2,72 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VaultUtils = void 0;
|
|
4
4
|
const index_js_1 = require("../math/index.js");
|
|
5
|
+
/** ERC-4626 virtual share and asset conversion helpers for MetaMorpho vaults. */
|
|
5
6
|
var VaultUtils;
|
|
6
7
|
(function (VaultUtils) {
|
|
8
|
+
/** Virtual assets added to ERC-4626 total assets in conversion formulas. */
|
|
7
9
|
VaultUtils.VIRTUAL_ASSETS = 1n;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the decimals offset between 18-decimal vault shares and an asset.
|
|
12
|
+
*
|
|
13
|
+
* @param decimals - The asset decimals.
|
|
14
|
+
* @returns The non-negative decimals offset.
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { VaultUtils } from "@morpho-org/blue-sdk";
|
|
18
|
+
*
|
|
19
|
+
* const offset = VaultUtils.decimalsOffset(6n);
|
|
20
|
+
* // offset === 12n
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
8
23
|
function decimalsOffset(decimals) {
|
|
9
24
|
return index_js_1.MathLib.zeroFloorSub(18n, decimals);
|
|
10
25
|
}
|
|
11
26
|
VaultUtils.decimalsOffset = decimalsOffset;
|
|
27
|
+
/**
|
|
28
|
+
* Converts vault shares to underlying assets.
|
|
29
|
+
*
|
|
30
|
+
* @param shares - The amount of vault shares.
|
|
31
|
+
* @param vault.totalAssets - The vault's total assets.
|
|
32
|
+
* @param vault.totalSupply - The vault's total share supply.
|
|
33
|
+
* @param vault.decimalsOffset - The vault's decimals offset.
|
|
34
|
+
* @param rounding - Optional rounding direction. Defaults to `"Down"`.
|
|
35
|
+
* @returns The equivalent amount of underlying assets.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { VaultUtils } from "@morpho-org/blue-sdk";
|
|
39
|
+
*
|
|
40
|
+
* const assets = VaultUtils.toAssets(100n, { totalAssets: 1_000n, totalSupply: 100n, decimalsOffset: 0n });
|
|
41
|
+
* // assets satisfies bigint
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
12
44
|
// biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
|
|
13
45
|
function toAssets(shares, { totalAssets, totalSupply,
|
|
14
|
-
// biome-ignore lint/
|
|
46
|
+
// biome-ignore lint/suspicious/noShadow: TODO rename to avoid shadowing
|
|
15
47
|
decimalsOffset, }, rounding = "Down") {
|
|
16
48
|
return index_js_1.MathLib.mulDiv(shares, BigInt(totalAssets) + VaultUtils.VIRTUAL_ASSETS, BigInt(totalSupply) + 10n ** BigInt(decimalsOffset), rounding);
|
|
17
49
|
}
|
|
18
50
|
VaultUtils.toAssets = toAssets;
|
|
51
|
+
/**
|
|
52
|
+
* Converts underlying assets to vault shares.
|
|
53
|
+
*
|
|
54
|
+
* @param assets - The amount of underlying assets.
|
|
55
|
+
* @param vault.totalAssets - The vault's total assets.
|
|
56
|
+
* @param vault.totalSupply - The vault's total share supply.
|
|
57
|
+
* @param vault.decimalsOffset - The vault's decimals offset.
|
|
58
|
+
* @param rounding - Optional rounding direction. Defaults to `"Up"`.
|
|
59
|
+
* @returns The equivalent amount of vault shares.
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { VaultUtils } from "@morpho-org/blue-sdk";
|
|
63
|
+
*
|
|
64
|
+
* const shares = VaultUtils.toShares(100n, { totalAssets: 1_000n, totalSupply: 100n, decimalsOffset: 0n });
|
|
65
|
+
* // shares satisfies bigint
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
19
68
|
// biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
|
|
20
69
|
function toShares(assets, { totalAssets, totalSupply,
|
|
21
|
-
// biome-ignore lint/
|
|
70
|
+
// biome-ignore lint/suspicious/noShadow: TODO rename to avoid shadowing
|
|
22
71
|
decimalsOffset, }, rounding = "Up") {
|
|
23
72
|
return index_js_1.MathLib.mulDiv(assets, BigInt(totalSupply) + 10n ** BigInt(decimalsOffset), BigInt(totalAssets) + VaultUtils.VIRTUAL_ASSETS, rounding);
|
|
24
73
|
}
|
|
@@ -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[];
|
|
@@ -6,6 +6,7 @@ const errors_js_1 = require("../../errors.js");
|
|
|
6
6
|
const index_js_1 = require("../../math/index.js");
|
|
7
7
|
const index_js_2 = require("../../token/index.js");
|
|
8
8
|
const utils_js_1 = require("../../utils.js");
|
|
9
|
+
/** Represents a Morpho Vault V2 and its fee, adapter, and accounting state. */
|
|
9
10
|
class VaultV2 extends index_js_2.WrappedToken {
|
|
10
11
|
asset;
|
|
11
12
|
_totalAssets;
|
|
@@ -53,6 +54,7 @@ class VaultV2 extends index_js_2.WrappedToken {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
exports.VaultV2 = VaultV2;
|
|
57
|
+
/** Represents a Morpho Vault V2 with accrued adapter and liquidity state. */
|
|
56
58
|
class AccrualVaultV2 extends VaultV2 {
|
|
57
59
|
accrualLiquidityAdapter;
|
|
58
60
|
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[]);
|
|
@@ -5,6 +5,7 @@ const viem_1 = require("viem");
|
|
|
5
5
|
const index_js_1 = require("../../market/index.js");
|
|
6
6
|
const utils_js_1 = require("../../utils.js");
|
|
7
7
|
const VaultV2Adapter_js_1 = require("./VaultV2Adapter.js");
|
|
8
|
+
/** Represents a Vault V2 adapter investing in Morpho Blue markets. */
|
|
8
9
|
class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter_js_1.VaultV2Adapter {
|
|
9
10
|
static adapterId(address) {
|
|
10
11
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
@@ -33,6 +34,7 @@ class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter_js_1.VaultV2Adapter {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
exports.VaultV2MorphoMarketV1Adapter = VaultV2MorphoMarketV1Adapter;
|
|
37
|
+
/** Represents an accrued Morpho Blue market Vault V2 adapter. */
|
|
36
38
|
class AccrualVaultV2MorphoMarketV1Adapter extends VaultV2MorphoMarketV1Adapter {
|
|
37
39
|
positions;
|
|
38
40
|
constructor(adapter, positions) {
|
|
@@ -51,7 +53,7 @@ class AccrualVaultV2MorphoMarketV1Adapter extends VaultV2MorphoMarketV1Adapter {
|
|
|
51
53
|
maxWithdraw(data) {
|
|
52
54
|
const marketId = index_js_1.MarketParams.fromHex(data).id;
|
|
53
55
|
const position = this.positions.find(
|
|
54
|
-
// biome-ignore lint/
|
|
56
|
+
// biome-ignore lint/suspicious/noShadow: TODO rename to avoid shadowing
|
|
55
57
|
(position) => position.marketId === marketId);
|
|
56
58
|
return (position?.market?.getWithdrawCapacityLimit(position) ?? {
|
|
57
59
|
value: 0n,
|
|
@@ -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[]);
|
|
@@ -5,6 +5,7 @@ const viem_1 = require("viem");
|
|
|
5
5
|
const index_js_1 = require("../../market/index.js");
|
|
6
6
|
const utils_js_1 = require("../../utils.js");
|
|
7
7
|
const VaultV2Adapter_js_1 = require("./VaultV2Adapter.js");
|
|
8
|
+
/** Represents a Vault V2 Morpho Blue market adapter using market ids. */
|
|
8
9
|
class VaultV2MorphoMarketV1AdapterV2 extends VaultV2Adapter_js_1.VaultV2Adapter {
|
|
9
10
|
static adapterId(address) {
|
|
10
11
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
@@ -37,6 +38,7 @@ class VaultV2MorphoMarketV1AdapterV2 extends VaultV2Adapter_js_1.VaultV2Adapter
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
exports.VaultV2MorphoMarketV1AdapterV2 = VaultV2MorphoMarketV1AdapterV2;
|
|
41
|
+
/** Represents an accrued Vault V2 Morpho Blue market-id adapter. */
|
|
40
42
|
class AccrualVaultV2MorphoMarketV1AdapterV2 extends VaultV2MorphoMarketV1AdapterV2 {
|
|
41
43
|
markets;
|
|
42
44
|
constructor(adapter, markets) {
|
|
@@ -57,7 +59,7 @@ class AccrualVaultV2MorphoMarketV1AdapterV2 extends VaultV2MorphoMarketV1Adapter
|
|
|
57
59
|
}
|
|
58
60
|
maxWithdraw(data) {
|
|
59
61
|
const marketId = index_js_1.MarketParams.fromHex(data).id;
|
|
60
|
-
// biome-ignore lint/
|
|
62
|
+
// biome-ignore lint/suspicious/noShadow: TODO rename to avoid shadowing
|
|
61
63
|
const market = this.markets.find((market) => market.id === marketId);
|
|
62
64
|
return (market?.getWithdrawCapacityLimit({
|
|
63
65
|
supplyShares: this.supplyShares[marketId] ?? 0n,
|
|
@@ -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;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AccrualVaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoVaultV1Adapter = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const VaultV2Adapter_js_1 = require("./VaultV2Adapter.js");
|
|
6
|
+
/** Represents a Vault V2 adapter investing in a MetaMorpho V1 vault. */
|
|
6
7
|
class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter_js_1.VaultV2Adapter {
|
|
7
8
|
static adapterId(address) {
|
|
8
9
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
@@ -21,6 +22,7 @@ class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter_js_1.VaultV2Adapter {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
exports.VaultV2MorphoVaultV1Adapter = VaultV2MorphoVaultV1Adapter;
|
|
25
|
+
/** Represents an accrued Vault V2 MetaMorpho V1 adapter. */
|
|
24
26
|
class AccrualVaultV2MorphoVaultV1Adapter extends VaultV2MorphoVaultV1Adapter {
|
|
25
27
|
accrualVaultV1;
|
|
26
28
|
shares;
|
package/lib/esm/addresses.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { Address } from "./types.js";
|
|
|
6
6
|
* NB: data might differ from expected onchain native token data
|
|
7
7
|
*/
|
|
8
8
|
export declare const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
9
|
+
/** Registry entry for protocol, adapter, factory, and token addresses on one chain. */
|
|
9
10
|
export interface ChainAddresses {
|
|
10
11
|
morpho: Address;
|
|
11
12
|
permit2?: Address;
|
|
@@ -725,7 +726,52 @@ declare const _addressesRegistry: {
|
|
|
725
726
|
readonly preLiquidationFactory: "0xe8eCe452F04117e5Fe1Ea4403097215443225440";
|
|
726
727
|
readonly wNative: "0x19Aac5f612f524B754CA7e7c41cbFa2E981A4432";
|
|
727
728
|
};
|
|
729
|
+
readonly 5042: {
|
|
730
|
+
readonly morpho: "0x34CD04070dD72b14E241112F6d83812Df5Af7fCD";
|
|
731
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
732
|
+
readonly bundler3: {
|
|
733
|
+
readonly bundler3: "0x855dbe13C409Df75CAF6a985Cf6993a4D0319Feb";
|
|
734
|
+
readonly generalAdapter1: "0x0AF5BE7BD7B615e94e1d9275414482D028952466";
|
|
735
|
+
};
|
|
736
|
+
readonly adaptiveCurveIrm: "0xF02615d094Fc02fC031C35fe705e175aA4653f20";
|
|
737
|
+
readonly vaultV2Factory: "0x3b0eefaBfa22ec7CF2c73877ac16e78D76749f12";
|
|
738
|
+
readonly morphoMarketV1AdapterV2Factory: "0x6C2FF5114E45b50bc7195c2F1f87C98cbdad62Cc";
|
|
739
|
+
readonly registryList: "0xdEBC92370Cd74d55DA144116138681dbbb528765";
|
|
740
|
+
readonly chainlinkOracleFactory: "0xbFc8D6167a02889D5EB08a023d9aB712B44f7dE8";
|
|
741
|
+
readonly preLiquidationFactory: "0x8edf6Ac769a7E7D81d571aC0FB8733aD724f6922";
|
|
742
|
+
};
|
|
743
|
+
readonly 2818: {
|
|
744
|
+
readonly morpho: "0xAd10d07901Dc3195c3cb5e78E061F4EA8D9B4905";
|
|
745
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
746
|
+
readonly bundler3: {
|
|
747
|
+
readonly bundler3: "0xDB83A44Bf8f53966f7A4F7dCE7F8CdAaBCf83628";
|
|
748
|
+
readonly generalAdapter1: "0xcaeec65c85Fe964c8Bd814cb8E4CaF8B06bde776";
|
|
749
|
+
};
|
|
750
|
+
readonly adaptiveCurveIrm: "0xfB69467De332E03FF502B85bB2249d2f721F3319";
|
|
751
|
+
readonly vaultV2Factory: "0x7D8BF8B276f967F7539c9e91E1a85a33fefE612B";
|
|
752
|
+
readonly morphoMarketV1AdapterV2Factory: "0xa01D7c41cf419405d4DF2e5750d26438DCAC28a6";
|
|
753
|
+
readonly registryList: "0x553c013d1978CF82EF6b316f5c247B73718ba481";
|
|
754
|
+
readonly chainlinkOracleFactory: "0xE91032cE5B8D86bA4Be146c186984F49Af37fbf1";
|
|
755
|
+
readonly preLiquidationFactory: "0x41581344ba49B07EFA758a0F2a199b90f05Cc866";
|
|
756
|
+
readonly wNative: "0x5300000000000000000000000000000000000011";
|
|
757
|
+
};
|
|
758
|
+
readonly 4326: {
|
|
759
|
+
readonly morpho: "0x18120312A7cf44DcfEc6dCe5632a431579ED9100";
|
|
760
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
761
|
+
readonly bundler3: {
|
|
762
|
+
readonly bundler3: "0xf53D4c8f0f83F697CD6bB303567400cCf411aA63";
|
|
763
|
+
readonly generalAdapter1: "0x74d3cbc721613C8461df92658d0a20dF275Ca31b";
|
|
764
|
+
};
|
|
765
|
+
readonly adaptiveCurveIrm: "0x56875764185548B0ca72A1877b3aE15E44e8A323";
|
|
766
|
+
readonly vaultV2Factory: "0xf133FA5A78C398B31Cc4a180E6Ae84111D6DCF5B";
|
|
767
|
+
readonly morphoMarketV1AdapterV2Factory: "0x00a58b7a9B3E86CB21f5F11f29F4A12346457012";
|
|
768
|
+
readonly registryList: "0x3aE18af9717C734820137726967bef4fBc5Ec95c";
|
|
769
|
+
readonly chainlinkOracleFactory: "0x02522D475E7064E1d1E966e3197db050b19b2FC2";
|
|
770
|
+
readonly preLiquidationFactory: "0xF6035B231028E61cd2283651f22ecA45f8e3ADc8";
|
|
771
|
+
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
772
|
+
};
|
|
728
773
|
};
|
|
774
|
+
/** Deployment block registry with the same shape as `ChainAddresses`. */
|
|
729
775
|
export type ChainDeployments<Addresses = ChainAddresses> = {
|
|
730
776
|
[key in keyof Addresses]: Address extends Addresses[key] ? bigint : ChainDeployments<Addresses[key]>;
|
|
731
777
|
};
|
|
@@ -1324,9 +1370,82 @@ declare const _deployments: {
|
|
|
1324
1370
|
readonly preLiquidationFactory: 213462907n;
|
|
1325
1371
|
readonly wNative: 104802159n;
|
|
1326
1372
|
};
|
|
1373
|
+
readonly 5042: {
|
|
1374
|
+
readonly morpho: 1208685n;
|
|
1375
|
+
readonly permit2: 0n;
|
|
1376
|
+
readonly bundler3: {
|
|
1377
|
+
readonly bundler3: 1208685n;
|
|
1378
|
+
readonly generalAdapter1: 1208685n;
|
|
1379
|
+
};
|
|
1380
|
+
readonly adaptiveCurveIrm: 1208685n;
|
|
1381
|
+
readonly vaultV2Factory: 1208931n;
|
|
1382
|
+
readonly morphoMarketV1AdapterV2Factory: 1208978n;
|
|
1383
|
+
readonly registryList: 1208978n;
|
|
1384
|
+
readonly chainlinkOracleFactory: 1208882n;
|
|
1385
|
+
readonly preLiquidationFactory: 1208882n;
|
|
1386
|
+
};
|
|
1387
|
+
readonly 2818: {
|
|
1388
|
+
readonly morpho: 23180020n;
|
|
1389
|
+
readonly permit2: 5081244n;
|
|
1390
|
+
readonly bundler3: {
|
|
1391
|
+
readonly bundler3: 23180020n;
|
|
1392
|
+
readonly generalAdapter1: 23180020n;
|
|
1393
|
+
};
|
|
1394
|
+
readonly adaptiveCurveIrm: 23180020n;
|
|
1395
|
+
readonly vaultV2Factory: 23180183n;
|
|
1396
|
+
readonly morphoMarketV1AdapterV2Factory: 23180228n;
|
|
1397
|
+
readonly registryList: 23180228n;
|
|
1398
|
+
readonly chainlinkOracleFactory: 23180111n;
|
|
1399
|
+
readonly preLiquidationFactory: 23180111n;
|
|
1400
|
+
readonly wNative: 0n;
|
|
1401
|
+
};
|
|
1402
|
+
readonly 4326: {
|
|
1403
|
+
readonly morpho: 16408957n;
|
|
1404
|
+
readonly permit2: 0n;
|
|
1405
|
+
readonly bundler3: {
|
|
1406
|
+
readonly bundler3: 16408957n;
|
|
1407
|
+
readonly generalAdapter1: 16408957n;
|
|
1408
|
+
};
|
|
1409
|
+
readonly adaptiveCurveIrm: 16408957n;
|
|
1410
|
+
readonly vaultV2Factory: 16409067n;
|
|
1411
|
+
readonly morphoMarketV1AdapterV2Factory: 16409115n;
|
|
1412
|
+
readonly registryList: 16409115n;
|
|
1413
|
+
readonly chainlinkOracleFactory: 16409024n;
|
|
1414
|
+
readonly preLiquidationFactory: 16409024n;
|
|
1415
|
+
readonly wNative: 0n;
|
|
1416
|
+
};
|
|
1327
1417
|
};
|
|
1418
|
+
/** Dot-separated label for an address entry in the chain registry. */
|
|
1328
1419
|
export type AddressLabel = DottedKeys<(typeof _addressesRegistry)[ChainId]>;
|
|
1420
|
+
/**
|
|
1421
|
+
* Returns the protocol address registry for a chain.
|
|
1422
|
+
*
|
|
1423
|
+
* @param chainId - The EIP-155 chain id.
|
|
1424
|
+
* @returns The configured protocol, adapter, factory, and token addresses for `chainId`.
|
|
1425
|
+
* @throws {UnsupportedChainIdError} when no address registry exists for `chainId`.
|
|
1426
|
+
* @example
|
|
1427
|
+
* ```ts
|
|
1428
|
+
* import { ChainId, getChainAddresses } from "@morpho-org/blue-sdk";
|
|
1429
|
+
*
|
|
1430
|
+
* const chainAddresses = getChainAddresses(ChainId.EthMainnet);
|
|
1431
|
+
* // chainAddresses satisfies ChainAddresses
|
|
1432
|
+
* ```
|
|
1433
|
+
*/
|
|
1329
1434
|
export declare const getChainAddresses: (chainId: number) => ChainAddresses;
|
|
1435
|
+
/**
|
|
1436
|
+
* Returns the unwrapped token mapped to a wrapped token on a chain.
|
|
1437
|
+
*
|
|
1438
|
+
* @param wrappedToken - The wrapped token address to resolve.
|
|
1439
|
+
* @param chainId - The EIP-155 chain id.
|
|
1440
|
+
* @returns The unwrapped token address, or `undefined` when no mapping is registered.
|
|
1441
|
+
* @example
|
|
1442
|
+
* ```ts
|
|
1443
|
+
* import { ChainId, getUnwrappedToken, NATIVE_ADDRESS, addresses } from "@morpho-org/blue-sdk";
|
|
1444
|
+
*
|
|
1445
|
+
* const unwrapped = getUnwrappedToken(addresses[ChainId.EthMainnet].wNative!, ChainId.EthMainnet);
|
|
1446
|
+
* // unwrapped === NATIVE_ADDRESS
|
|
1447
|
+
* ```
|
|
1448
|
+
*/
|
|
1330
1449
|
export declare function getUnwrappedToken(wrappedToken: Address, chainId: number): `0x${string}` | undefined;
|
|
1331
1450
|
/**
|
|
1332
1451
|
* The registry of all known ERC20Wrapper tokens.
|
|
@@ -1347,11 +1466,25 @@ export declare const permissionedBackedTokens: Record<number, Set<Address>>;
|
|
|
1347
1466
|
* All permissioned Coinbase tokens are considered PermissionedERC20Wrapper and automatically added to the permissionedWrapperTokens registry.
|
|
1348
1467
|
*/
|
|
1349
1468
|
export declare const permissionedCoinbaseTokens: Record<number, Set<Address>>;
|
|
1469
|
+
/**
|
|
1470
|
+
* Returns the known Coinbase-attested wrapped tokens for a chain.
|
|
1471
|
+
*
|
|
1472
|
+
* @param chainId - The EIP-155 chain id.
|
|
1473
|
+
* @returns A set of permissioned wrapped token addresses, or an empty set when none are registered.
|
|
1474
|
+
* @example
|
|
1475
|
+
* ```ts
|
|
1476
|
+
* import { ChainId, getPermissionedCoinbaseTokens } from "@morpho-org/blue-sdk";
|
|
1477
|
+
*
|
|
1478
|
+
* const tokens = getPermissionedCoinbaseTokens(ChainId.BaseMainnet);
|
|
1479
|
+
* // tokens satisfies Set<Address>
|
|
1480
|
+
* ```
|
|
1481
|
+
*/
|
|
1350
1482
|
export declare const getPermissionedCoinbaseTokens: (chainId: number) => Set<`0x${string}`>;
|
|
1351
1483
|
/** /!\ These tokens can not be listed in `erc20WrapperTokens` because the following specs are different:
|
|
1352
1484
|
* - calling `depositFor` supplies on blue instead of minting wrapped token to the user
|
|
1353
1485
|
*/
|
|
1354
1486
|
export declare const convexWrapperTokens: Record<number, Set<Address>>;
|
|
1487
|
+
/** Deep-frozen registry of known chain addresses, keyed by chain id. */
|
|
1355
1488
|
export declare let addressesRegistry: {
|
|
1356
1489
|
readonly 1: {
|
|
1357
1490
|
readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
@@ -2028,8 +2161,54 @@ export declare let addressesRegistry: {
|
|
|
2028
2161
|
readonly preLiquidationFactory: "0xe8eCe452F04117e5Fe1Ea4403097215443225440";
|
|
2029
2162
|
readonly wNative: "0x19Aac5f612f524B754CA7e7c41cbFa2E981A4432";
|
|
2030
2163
|
};
|
|
2164
|
+
readonly 5042: {
|
|
2165
|
+
readonly morpho: "0x34CD04070dD72b14E241112F6d83812Df5Af7fCD";
|
|
2166
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
2167
|
+
readonly bundler3: {
|
|
2168
|
+
readonly bundler3: "0x855dbe13C409Df75CAF6a985Cf6993a4D0319Feb";
|
|
2169
|
+
readonly generalAdapter1: "0x0AF5BE7BD7B615e94e1d9275414482D028952466";
|
|
2170
|
+
};
|
|
2171
|
+
readonly adaptiveCurveIrm: "0xF02615d094Fc02fC031C35fe705e175aA4653f20";
|
|
2172
|
+
readonly vaultV2Factory: "0x3b0eefaBfa22ec7CF2c73877ac16e78D76749f12";
|
|
2173
|
+
readonly morphoMarketV1AdapterV2Factory: "0x6C2FF5114E45b50bc7195c2F1f87C98cbdad62Cc";
|
|
2174
|
+
readonly registryList: "0xdEBC92370Cd74d55DA144116138681dbbb528765";
|
|
2175
|
+
readonly chainlinkOracleFactory: "0xbFc8D6167a02889D5EB08a023d9aB712B44f7dE8";
|
|
2176
|
+
readonly preLiquidationFactory: "0x8edf6Ac769a7E7D81d571aC0FB8733aD724f6922";
|
|
2177
|
+
};
|
|
2178
|
+
readonly 2818: {
|
|
2179
|
+
readonly morpho: "0xAd10d07901Dc3195c3cb5e78E061F4EA8D9B4905";
|
|
2180
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
2181
|
+
readonly bundler3: {
|
|
2182
|
+
readonly bundler3: "0xDB83A44Bf8f53966f7A4F7dCE7F8CdAaBCf83628";
|
|
2183
|
+
readonly generalAdapter1: "0xcaeec65c85Fe964c8Bd814cb8E4CaF8B06bde776";
|
|
2184
|
+
};
|
|
2185
|
+
readonly adaptiveCurveIrm: "0xfB69467De332E03FF502B85bB2249d2f721F3319";
|
|
2186
|
+
readonly vaultV2Factory: "0x7D8BF8B276f967F7539c9e91E1a85a33fefE612B";
|
|
2187
|
+
readonly morphoMarketV1AdapterV2Factory: "0xa01D7c41cf419405d4DF2e5750d26438DCAC28a6";
|
|
2188
|
+
readonly registryList: "0x553c013d1978CF82EF6b316f5c247B73718ba481";
|
|
2189
|
+
readonly chainlinkOracleFactory: "0xE91032cE5B8D86bA4Be146c186984F49Af37fbf1";
|
|
2190
|
+
readonly preLiquidationFactory: "0x41581344ba49B07EFA758a0F2a199b90f05Cc866";
|
|
2191
|
+
readonly wNative: "0x5300000000000000000000000000000000000011";
|
|
2192
|
+
};
|
|
2193
|
+
readonly 4326: {
|
|
2194
|
+
readonly morpho: "0x18120312A7cf44DcfEc6dCe5632a431579ED9100";
|
|
2195
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
2196
|
+
readonly bundler3: {
|
|
2197
|
+
readonly bundler3: "0xf53D4c8f0f83F697CD6bB303567400cCf411aA63";
|
|
2198
|
+
readonly generalAdapter1: "0x74d3cbc721613C8461df92658d0a20dF275Ca31b";
|
|
2199
|
+
};
|
|
2200
|
+
readonly adaptiveCurveIrm: "0x56875764185548B0ca72A1877b3aE15E44e8A323";
|
|
2201
|
+
readonly vaultV2Factory: "0xf133FA5A78C398B31Cc4a180E6Ae84111D6DCF5B";
|
|
2202
|
+
readonly morphoMarketV1AdapterV2Factory: "0x00a58b7a9B3E86CB21f5F11f29F4A12346457012";
|
|
2203
|
+
readonly registryList: "0x3aE18af9717C734820137726967bef4fBc5Ec95c";
|
|
2204
|
+
readonly chainlinkOracleFactory: "0x02522D475E7064E1d1E966e3197db050b19b2FC2";
|
|
2205
|
+
readonly preLiquidationFactory: "0xF6035B231028E61cd2283651f22ecA45f8e3ADc8";
|
|
2206
|
+
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
2207
|
+
};
|
|
2031
2208
|
};
|
|
2209
|
+
/** Address registry keyed by numeric chain id. */
|
|
2032
2210
|
export declare let addresses: Record<number, ChainAddresses>;
|
|
2211
|
+
/** Deep-frozen registry of deployment blocks, keyed by chain id. */
|
|
2033
2212
|
export declare let deployments: {
|
|
2034
2213
|
readonly 1: {
|
|
2035
2214
|
readonly morpho: 18883124n;
|
|
@@ -2625,7 +2804,52 @@ export declare let deployments: {
|
|
|
2625
2804
|
readonly preLiquidationFactory: 213462907n;
|
|
2626
2805
|
readonly wNative: 104802159n;
|
|
2627
2806
|
};
|
|
2807
|
+
readonly 5042: {
|
|
2808
|
+
readonly morpho: 1208685n;
|
|
2809
|
+
readonly permit2: 0n;
|
|
2810
|
+
readonly bundler3: {
|
|
2811
|
+
readonly bundler3: 1208685n;
|
|
2812
|
+
readonly generalAdapter1: 1208685n;
|
|
2813
|
+
};
|
|
2814
|
+
readonly adaptiveCurveIrm: 1208685n;
|
|
2815
|
+
readonly vaultV2Factory: 1208931n;
|
|
2816
|
+
readonly morphoMarketV1AdapterV2Factory: 1208978n;
|
|
2817
|
+
readonly registryList: 1208978n;
|
|
2818
|
+
readonly chainlinkOracleFactory: 1208882n;
|
|
2819
|
+
readonly preLiquidationFactory: 1208882n;
|
|
2820
|
+
};
|
|
2821
|
+
readonly 2818: {
|
|
2822
|
+
readonly morpho: 23180020n;
|
|
2823
|
+
readonly permit2: 5081244n;
|
|
2824
|
+
readonly bundler3: {
|
|
2825
|
+
readonly bundler3: 23180020n;
|
|
2826
|
+
readonly generalAdapter1: 23180020n;
|
|
2827
|
+
};
|
|
2828
|
+
readonly adaptiveCurveIrm: 23180020n;
|
|
2829
|
+
readonly vaultV2Factory: 23180183n;
|
|
2830
|
+
readonly morphoMarketV1AdapterV2Factory: 23180228n;
|
|
2831
|
+
readonly registryList: 23180228n;
|
|
2832
|
+
readonly chainlinkOracleFactory: 23180111n;
|
|
2833
|
+
readonly preLiquidationFactory: 23180111n;
|
|
2834
|
+
readonly wNative: 0n;
|
|
2835
|
+
};
|
|
2836
|
+
readonly 4326: {
|
|
2837
|
+
readonly morpho: 16408957n;
|
|
2838
|
+
readonly permit2: 0n;
|
|
2839
|
+
readonly bundler3: {
|
|
2840
|
+
readonly bundler3: 16408957n;
|
|
2841
|
+
readonly generalAdapter1: 16408957n;
|
|
2842
|
+
};
|
|
2843
|
+
readonly adaptiveCurveIrm: 16408957n;
|
|
2844
|
+
readonly vaultV2Factory: 16409067n;
|
|
2845
|
+
readonly morphoMarketV1AdapterV2Factory: 16409115n;
|
|
2846
|
+
readonly registryList: 16409115n;
|
|
2847
|
+
readonly chainlinkOracleFactory: 16409024n;
|
|
2848
|
+
readonly preLiquidationFactory: 16409024n;
|
|
2849
|
+
readonly wNative: 0n;
|
|
2850
|
+
};
|
|
2628
2851
|
};
|
|
2852
|
+
/** Deep-frozen registry of wrapped token to unwrapped token mappings. */
|
|
2629
2853
|
export declare let unwrappedTokensMapping: Record<number, Record<`0x${string}`, `0x${string}`>>;
|
|
2630
2854
|
/**
|
|
2631
2855
|
* Registers custom addresses and unwrapped token mappings to extend
|
|
@@ -2642,6 +2866,7 @@ export declare let unwrappedTokensMapping: Record<number, Record<`0x${string}`,
|
|
|
2642
2866
|
* Must provide all required deployments if chain is unknown.
|
|
2643
2867
|
*
|
|
2644
2868
|
* @throws {Error} If attempting to override an existing address.
|
|
2869
|
+
* @returns Nothing.
|
|
2645
2870
|
*
|
|
2646
2871
|
* @example
|
|
2647
2872
|
* ```ts
|