@morpho-org/blue-sdk 1.4.4 → 1.4.5
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/token/ConstantWrappedToken.d.ts +18 -0
- package/lib/token/ConstantWrappedToken.js +36 -0
- package/lib/token/ExchangeRateWrappedToken.d.ts +11 -0
- package/lib/token/ExchangeRateWrappedToken.js +21 -0
- package/lib/token/VaultToken.d.ts +14 -0
- package/lib/token/VaultToken.js +23 -0
- package/lib/token/WrappedToken.d.ts +2 -27
- package/lib/token/WrappedToken.js +3 -64
- package/lib/token/index.d.ts +3 -0
- package/lib/token/index.js +3 -0
- package/lib/vault/Vault.d.ts +2 -7
- package/lib/vault/Vault.js +2 -9
- package/lib/vault/VaultConfig.d.ts +1 -2
- package/package.json +5 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RoundingDirection } from "../maths";
|
|
2
|
+
import { Address } from "../types";
|
|
3
|
+
import { InputToken } from "./Token";
|
|
4
|
+
import { WrappedToken } from "./WrappedToken";
|
|
5
|
+
export declare class ConstantWrappedToken extends WrappedToken {
|
|
6
|
+
readonly underlying: Address;
|
|
7
|
+
private readonly _underlyingDecimals;
|
|
8
|
+
constructor(token: InputToken, underlying: Address, _underlyingDecimals?: number);
|
|
9
|
+
toWrappedExactAmountIn(unwrappedAmount: bigint, _slippage?: bigint, rounding?: RoundingDirection): bigint;
|
|
10
|
+
/** The amount of unwrappedTokens that should be wrapped to receive `wrappedAmount` */
|
|
11
|
+
toWrappedExactAmountOut(wrappedAmount: bigint, _slippage?: bigint, rounding?: RoundingDirection): bigint;
|
|
12
|
+
/** The expected amount when unwrapping `wrappedAmount` */
|
|
13
|
+
toUnwrappedExactAmountIn(wrappedAmount: bigint, _slippage?: bigint, rounding?: RoundingDirection): bigint;
|
|
14
|
+
/** The amount of wrappedTokens that should be unwrapped to receive `unwrappedAmount` */
|
|
15
|
+
toUnwrappedExactAmountOut(unwrappedAmount: bigint, _slippage?: bigint, rounding?: RoundingDirection): bigint;
|
|
16
|
+
protected _wrap(amount: bigint): bigint;
|
|
17
|
+
protected _unwrap(amount: bigint): bigint;
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConstantWrappedToken = void 0;
|
|
4
|
+
const maths_1 = require("../maths");
|
|
5
|
+
const WrappedToken_1 = require("./WrappedToken");
|
|
6
|
+
class ConstantWrappedToken extends WrappedToken_1.WrappedToken {
|
|
7
|
+
underlying;
|
|
8
|
+
_underlyingDecimals;
|
|
9
|
+
constructor(token, underlying, _underlyingDecimals = 18) {
|
|
10
|
+
super(token, underlying);
|
|
11
|
+
this.underlying = underlying;
|
|
12
|
+
this._underlyingDecimals = _underlyingDecimals;
|
|
13
|
+
}
|
|
14
|
+
toWrappedExactAmountIn(unwrappedAmount, _slippage, rounding = "Down") {
|
|
15
|
+
return super.toWrappedExactAmountIn(unwrappedAmount, 0n, rounding);
|
|
16
|
+
}
|
|
17
|
+
/** The amount of unwrappedTokens that should be wrapped to receive `wrappedAmount` */
|
|
18
|
+
toWrappedExactAmountOut(wrappedAmount, _slippage, rounding = "Up") {
|
|
19
|
+
return super.toWrappedExactAmountOut(wrappedAmount, 0n, rounding);
|
|
20
|
+
}
|
|
21
|
+
/** The expected amount when unwrapping `wrappedAmount` */
|
|
22
|
+
toUnwrappedExactAmountIn(wrappedAmount, _slippage, rounding = "Down") {
|
|
23
|
+
return super.toUnwrappedExactAmountIn(wrappedAmount, 0n, rounding);
|
|
24
|
+
}
|
|
25
|
+
/** The amount of wrappedTokens that should be unwrapped to receive `unwrappedAmount` */
|
|
26
|
+
toUnwrappedExactAmountOut(unwrappedAmount, _slippage, rounding = "Up") {
|
|
27
|
+
return super.toUnwrappedExactAmountOut(unwrappedAmount, 0n, rounding);
|
|
28
|
+
}
|
|
29
|
+
_wrap(amount) {
|
|
30
|
+
return maths_1.MathLib.mulDivDown(amount, 10n ** BigInt(this.decimals), 10n ** BigInt(this._underlyingDecimals));
|
|
31
|
+
}
|
|
32
|
+
_unwrap(amount) {
|
|
33
|
+
return maths_1.MathLib.mulDivDown(amount, 10n ** BigInt(this._underlyingDecimals), 10n ** BigInt(this.decimals));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ConstantWrappedToken = ConstantWrappedToken;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RoundingDirection } from "../maths";
|
|
2
|
+
import { Address } from "../types";
|
|
3
|
+
import { InputToken } from "./Token";
|
|
4
|
+
import { WrappedToken } from "./WrappedToken";
|
|
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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExchangeRateWrappedToken = void 0;
|
|
4
|
+
const maths_1 = require("../maths");
|
|
5
|
+
const WrappedToken_1 = require("./WrappedToken");
|
|
6
|
+
class ExchangeRateWrappedToken extends WrappedToken_1.WrappedToken {
|
|
7
|
+
underlying;
|
|
8
|
+
wrappedTokenExchangeRate;
|
|
9
|
+
constructor(token, underlying, wrappedTokenExchangeRate) {
|
|
10
|
+
super(token, underlying);
|
|
11
|
+
this.underlying = underlying;
|
|
12
|
+
this.wrappedTokenExchangeRate = wrappedTokenExchangeRate;
|
|
13
|
+
}
|
|
14
|
+
_wrap(amount, rounding) {
|
|
15
|
+
return maths_1.MathLib.wDiv(amount, this.wrappedTokenExchangeRate, rounding);
|
|
16
|
+
}
|
|
17
|
+
_unwrap(amount, rounding) {
|
|
18
|
+
return maths_1.MathLib.wMul(amount, this.wrappedTokenExchangeRate, rounding);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ExchangeRateWrappedToken = ExchangeRateWrappedToken;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RoundingDirection } from "../maths";
|
|
2
|
+
import { InputVaultConfig } from "../vault/VaultConfig";
|
|
3
|
+
import { WrappedToken } from "./WrappedToken";
|
|
4
|
+
export declare class VaultToken extends WrappedToken {
|
|
5
|
+
decimalsOffset: bigint;
|
|
6
|
+
totalAssets: bigint;
|
|
7
|
+
totalSupply: bigint;
|
|
8
|
+
constructor(config: InputVaultConfig, { totalAssets, totalSupply }: {
|
|
9
|
+
totalAssets: bigint;
|
|
10
|
+
totalSupply: bigint;
|
|
11
|
+
});
|
|
12
|
+
protected _wrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
13
|
+
protected _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VaultToken = void 0;
|
|
4
|
+
const VaultUtils_1 = require("../vault/VaultUtils");
|
|
5
|
+
const WrappedToken_1 = require("./WrappedToken");
|
|
6
|
+
class VaultToken extends WrappedToken_1.WrappedToken {
|
|
7
|
+
decimalsOffset;
|
|
8
|
+
totalAssets;
|
|
9
|
+
totalSupply;
|
|
10
|
+
constructor(config, { totalAssets, totalSupply }) {
|
|
11
|
+
super(config, config.asset);
|
|
12
|
+
this.totalAssets = totalAssets;
|
|
13
|
+
this.totalSupply = totalSupply;
|
|
14
|
+
this.decimalsOffset = config.decimalsOffset;
|
|
15
|
+
}
|
|
16
|
+
_wrap(amount, rounding) {
|
|
17
|
+
return VaultUtils_1.VaultUtils.toShares(amount, this, this, rounding);
|
|
18
|
+
}
|
|
19
|
+
_unwrap(amount, rounding) {
|
|
20
|
+
return VaultUtils_1.VaultUtils.toAssets(amount, this, this, rounding);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.VaultToken = VaultToken;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { RoundingDirection } from "../maths";
|
|
2
2
|
import { Address } from "../types";
|
|
3
|
-
import { Vault, VaultConfig } from "../vault";
|
|
4
3
|
import { InputToken, Token } from "./Token";
|
|
5
4
|
export declare abstract class WrappedToken extends Token {
|
|
6
5
|
readonly underlying: Address;
|
|
7
|
-
protected abstract _wrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
8
|
-
protected abstract _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
9
|
-
protected _noSlippage: boolean;
|
|
10
6
|
constructor(token: InputToken, underlying: Address);
|
|
11
7
|
/** The expected amount when wrapping `unwrappedAmount` */
|
|
12
8
|
toWrappedExactAmountIn(unwrappedAmount: bigint, slippage?: bigint, rounding?: RoundingDirection): bigint;
|
|
@@ -16,27 +12,6 @@ export declare abstract class WrappedToken extends Token {
|
|
|
16
12
|
toUnwrappedExactAmountIn(wrappedAmount: bigint, slippage?: bigint, rounding?: RoundingDirection): bigint;
|
|
17
13
|
/** The amount of wrappedTokens that should be unwrapped to receive `unwrappedAmount` */
|
|
18
14
|
toUnwrappedExactAmountOut(unwrappedAmount: bigint, slippage?: bigint, rounding?: RoundingDirection): bigint;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
readonly underlying: Address;
|
|
22
|
-
private readonly _underlyingDecimals;
|
|
23
|
-
protected _noSlippage: boolean;
|
|
24
|
-
constructor(token: InputToken, underlying: Address, _underlyingDecimals?: number);
|
|
25
|
-
protected _wrap(amount: bigint): bigint;
|
|
26
|
-
protected _unwrap(amount: bigint): bigint;
|
|
27
|
-
}
|
|
28
|
-
export declare class ExchangeRateWrappedToken extends WrappedToken {
|
|
29
|
-
readonly underlying: Address;
|
|
30
|
-
wrappedTokenExchangeRate: bigint;
|
|
31
|
-
protected _wrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
32
|
-
protected _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
33
|
-
constructor(token: InputToken, underlying: Address, wrappedTokenExchangeRate: bigint);
|
|
34
|
-
}
|
|
35
|
-
export declare class VaultToken extends WrappedToken {
|
|
36
|
-
protected _wrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
37
|
-
protected _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
38
|
-
totalAssets: bigint;
|
|
39
|
-
totalSupply: bigint;
|
|
40
|
-
config: VaultConfig;
|
|
41
|
-
constructor(token: InputToken, { totalAssets, totalSupply, config, }: Pick<Vault, "totalAssets" | "totalSupply" | "config">);
|
|
15
|
+
protected abstract _wrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
16
|
+
protected abstract _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
|
|
42
17
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WrappedToken = void 0;
|
|
4
4
|
const maths_1 = require("../maths");
|
|
5
|
-
const vault_1 = require("../vault");
|
|
6
5
|
const Token_1 = require("./Token");
|
|
7
6
|
class WrappedToken extends Token_1.Token {
|
|
8
7
|
underlying;
|
|
9
|
-
_noSlippage = false;
|
|
10
8
|
constructor(token, underlying) {
|
|
11
9
|
super(token);
|
|
12
10
|
this.underlying = underlying;
|
|
@@ -14,81 +12,22 @@ class WrappedToken extends Token_1.Token {
|
|
|
14
12
|
/** The expected amount when wrapping `unwrappedAmount` */
|
|
15
13
|
toWrappedExactAmountIn(unwrappedAmount, slippage = 0n, rounding = "Down") {
|
|
16
14
|
const wrappedAmount = this._wrap(unwrappedAmount, rounding);
|
|
17
|
-
if (this._noSlippage)
|
|
18
|
-
return wrappedAmount;
|
|
19
15
|
return maths_1.MathLib.wMul(wrappedAmount, maths_1.MathLib.WAD - slippage, "Down");
|
|
20
16
|
}
|
|
21
17
|
/** The amount of unwrappedTokens that should be wrapped to receive `wrappedAmount` */
|
|
22
18
|
toWrappedExactAmountOut(wrappedAmount, slippage = 0n, rounding = "Up") {
|
|
23
|
-
const wAmountTarget =
|
|
24
|
-
? wrappedAmount
|
|
25
|
-
: maths_1.MathLib.wDiv(wrappedAmount, maths_1.MathLib.WAD - slippage, rounding);
|
|
19
|
+
const wAmountTarget = maths_1.MathLib.wDiv(wrappedAmount, maths_1.MathLib.WAD - slippage, rounding);
|
|
26
20
|
return this._unwrap(wAmountTarget, rounding);
|
|
27
21
|
}
|
|
28
22
|
/** The expected amount when unwrapping `wrappedAmount` */
|
|
29
23
|
toUnwrappedExactAmountIn(wrappedAmount, slippage = 0n, rounding = "Down") {
|
|
30
24
|
const unwrappedAmount = this._unwrap(wrappedAmount, rounding);
|
|
31
|
-
if (this._noSlippage)
|
|
32
|
-
return unwrappedAmount;
|
|
33
25
|
return maths_1.MathLib.wMul(unwrappedAmount, maths_1.MathLib.WAD - slippage, "Up");
|
|
34
26
|
}
|
|
35
27
|
/** The amount of wrappedTokens that should be unwrapped to receive `unwrappedAmount` */
|
|
36
28
|
toUnwrappedExactAmountOut(unwrappedAmount, slippage = 0n, rounding = "Up") {
|
|
37
|
-
const unwrappedAmountToTarget =
|
|
38
|
-
? unwrappedAmount
|
|
39
|
-
: maths_1.MathLib.wDiv(unwrappedAmount, maths_1.MathLib.WAD - slippage, rounding);
|
|
29
|
+
const unwrappedAmountToTarget = maths_1.MathLib.wDiv(unwrappedAmount, maths_1.MathLib.WAD - slippage, rounding);
|
|
40
30
|
return this._wrap(unwrappedAmountToTarget, rounding);
|
|
41
31
|
}
|
|
42
32
|
}
|
|
43
33
|
exports.WrappedToken = WrappedToken;
|
|
44
|
-
class ConstantWrappedToken extends WrappedToken {
|
|
45
|
-
underlying;
|
|
46
|
-
_underlyingDecimals;
|
|
47
|
-
_noSlippage = true;
|
|
48
|
-
constructor(token, underlying, _underlyingDecimals = 18) {
|
|
49
|
-
super(token, underlying);
|
|
50
|
-
this.underlying = underlying;
|
|
51
|
-
this._underlyingDecimals = _underlyingDecimals;
|
|
52
|
-
}
|
|
53
|
-
_wrap(amount) {
|
|
54
|
-
return maths_1.MathLib.mulDivDown(amount, 10n ** BigInt(this.decimals), 10n ** BigInt(this._underlyingDecimals));
|
|
55
|
-
}
|
|
56
|
-
_unwrap(amount) {
|
|
57
|
-
return maths_1.MathLib.mulDivDown(amount, 10n ** BigInt(this._underlyingDecimals), 10n ** BigInt(this.decimals));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.ConstantWrappedToken = ConstantWrappedToken;
|
|
61
|
-
class ExchangeRateWrappedToken extends WrappedToken {
|
|
62
|
-
underlying;
|
|
63
|
-
wrappedTokenExchangeRate;
|
|
64
|
-
_wrap(amount, rounding) {
|
|
65
|
-
return maths_1.MathLib.wDiv(amount, this.wrappedTokenExchangeRate, rounding);
|
|
66
|
-
}
|
|
67
|
-
_unwrap(amount, rounding) {
|
|
68
|
-
return maths_1.MathLib.wMul(amount, this.wrappedTokenExchangeRate, rounding);
|
|
69
|
-
}
|
|
70
|
-
constructor(token, underlying, wrappedTokenExchangeRate) {
|
|
71
|
-
super(token, underlying);
|
|
72
|
-
this.underlying = underlying;
|
|
73
|
-
this.wrappedTokenExchangeRate = wrappedTokenExchangeRate;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.ExchangeRateWrappedToken = ExchangeRateWrappedToken;
|
|
77
|
-
class VaultToken extends WrappedToken {
|
|
78
|
-
_wrap(amount, rounding) {
|
|
79
|
-
return vault_1.VaultUtils.toShares(amount, this, this.config, rounding);
|
|
80
|
-
}
|
|
81
|
-
_unwrap(amount, rounding) {
|
|
82
|
-
return vault_1.VaultUtils.toAssets(amount, this, this.config, rounding);
|
|
83
|
-
}
|
|
84
|
-
totalAssets;
|
|
85
|
-
totalSupply;
|
|
86
|
-
config;
|
|
87
|
-
constructor(token, { totalAssets, totalSupply, config, }) {
|
|
88
|
-
super(token, config.asset);
|
|
89
|
-
this.totalAssets = totalAssets;
|
|
90
|
-
this.totalSupply = totalSupply;
|
|
91
|
-
this.config = config;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.VaultToken = VaultToken;
|
package/lib/token/index.d.ts
CHANGED
package/lib/token/index.js
CHANGED
|
@@ -16,3 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Token"), exports);
|
|
18
18
|
__exportStar(require("./WrappedToken"), exports);
|
|
19
|
+
__exportStar(require("./ConstantWrappedToken"), exports);
|
|
20
|
+
__exportStar(require("./ExchangeRateWrappedToken"), exports);
|
|
21
|
+
__exportStar(require("./VaultToken"), exports);
|
package/lib/vault/Vault.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CapacityLimit } from "../market";
|
|
2
2
|
import { RoundingDirection } from "../maths";
|
|
3
|
-
import {
|
|
3
|
+
import { VaultToken } from "../token";
|
|
4
4
|
import { Address, MarketId } from "../types";
|
|
5
5
|
import { VaultConfig } from "./VaultConfig";
|
|
6
6
|
import { InputVaultMarketAllocation, VaultMarketAllocation } from "./VaultMarketAllocation";
|
|
@@ -41,7 +41,7 @@ export interface InputVault {
|
|
|
41
41
|
lastTotalAssets: bigint;
|
|
42
42
|
publicAllocatorConfig?: VaultPublicAllocatorConfig;
|
|
43
43
|
}
|
|
44
|
-
export declare class Vault implements InputVault {
|
|
44
|
+
export declare class Vault extends VaultToken implements InputVault {
|
|
45
45
|
/**
|
|
46
46
|
* The MetaMorpho vault's config.
|
|
47
47
|
*/
|
|
@@ -111,7 +111,6 @@ export declare class Vault implements InputVault {
|
|
|
111
111
|
*/
|
|
112
112
|
publicAllocatorConfig?: VaultPublicAllocatorConfig;
|
|
113
113
|
constructor({ config, curator, owner, guardian, publicAllocatorConfig, fee, feeRecipient, skimRecipient, pendingTimelock, pendingGuardian, pendingOwner, timelock, supplyQueue, withdrawQueue, totalSupply, totalAssets, lastTotalAssets, }: InputVault);
|
|
114
|
-
get address(): string;
|
|
115
114
|
get asset(): string;
|
|
116
115
|
/**
|
|
117
116
|
* The amount of interest in assets accrued since the last interaction with the vault.
|
|
@@ -134,10 +133,6 @@ export declare class AccrualVault extends Vault implements InputAccrualVault {
|
|
|
134
133
|
* The allocation of the vault on each market enabled.
|
|
135
134
|
*/
|
|
136
135
|
readonly allocations: Map<MarketId, VaultMarketAllocation>;
|
|
137
|
-
/**
|
|
138
|
-
* The ERC4626 vault's share token.
|
|
139
|
-
*/
|
|
140
|
-
token: Token;
|
|
141
136
|
/**
|
|
142
137
|
* The proportion of assets of the vault supplied to markets collateralized by each collateral asset.
|
|
143
138
|
*/
|
package/lib/vault/Vault.js
CHANGED
|
@@ -6,7 +6,7 @@ const maths_1 = require("../maths");
|
|
|
6
6
|
const token_1 = require("../token");
|
|
7
7
|
const VaultMarketAllocation_1 = require("./VaultMarketAllocation");
|
|
8
8
|
const VaultUtils_1 = require("./VaultUtils");
|
|
9
|
-
class Vault {
|
|
9
|
+
class Vault extends token_1.VaultToken {
|
|
10
10
|
/**
|
|
11
11
|
* The MetaMorpho vault's config.
|
|
12
12
|
*/
|
|
@@ -76,6 +76,7 @@ class Vault {
|
|
|
76
76
|
*/
|
|
77
77
|
publicAllocatorConfig;
|
|
78
78
|
constructor({ config, curator, owner, guardian, publicAllocatorConfig, fee, feeRecipient, skimRecipient, pendingTimelock, pendingGuardian, pendingOwner, timelock, supplyQueue, withdrawQueue, totalSupply, totalAssets, lastTotalAssets, }) {
|
|
79
|
+
super(config, { totalAssets, totalSupply });
|
|
79
80
|
this.config = config;
|
|
80
81
|
this.curator = curator;
|
|
81
82
|
this.owner = owner;
|
|
@@ -97,9 +98,6 @@ class Vault {
|
|
|
97
98
|
this.lastTotalAssets = lastTotalAssets;
|
|
98
99
|
this.publicAllocatorConfig = publicAllocatorConfig;
|
|
99
100
|
}
|
|
100
|
-
get address() {
|
|
101
|
-
return this.config.address;
|
|
102
|
-
}
|
|
103
101
|
get asset() {
|
|
104
102
|
return this.config.asset;
|
|
105
103
|
}
|
|
@@ -122,10 +120,6 @@ class AccrualVault extends Vault {
|
|
|
122
120
|
* The allocation of the vault on each market enabled.
|
|
123
121
|
*/
|
|
124
122
|
allocations;
|
|
125
|
-
/**
|
|
126
|
-
* The ERC4626 vault's share token.
|
|
127
|
-
*/
|
|
128
|
-
token;
|
|
129
123
|
/**
|
|
130
124
|
* The proportion of assets of the vault supplied to markets collateralized by each collateral asset.
|
|
131
125
|
*/
|
|
@@ -148,7 +142,6 @@ class AccrualVault extends Vault {
|
|
|
148
142
|
position,
|
|
149
143
|
}),
|
|
150
144
|
]));
|
|
151
|
-
this.token = new token_1.Token(this.config);
|
|
152
145
|
this.collateralAllocations = new Map();
|
|
153
146
|
for (const { marketId, position } of this.allocations.values()) {
|
|
154
147
|
const address = position.market.config.collateralToken;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChainId } from "../chain";
|
|
2
2
|
import { Address } from "../types";
|
|
3
|
-
interface InputVaultConfig {
|
|
3
|
+
export interface InputVaultConfig {
|
|
4
4
|
address: Address;
|
|
5
5
|
decimals: number;
|
|
6
6
|
decimalsOffset: bigint;
|
|
@@ -20,4 +20,3 @@ export declare class VaultConfig implements InputVaultConfig {
|
|
|
20
20
|
readonly asset: Address;
|
|
21
21
|
constructor({ address, decimals, decimalsOffset, symbol, name, asset, }: InputVaultConfig, chainId?: number | undefined);
|
|
22
22
|
}
|
|
23
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/blue-sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"author": "Morpho Association <contact@morpho.org>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"keccak256": "^1.0.6"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@morpho-org/morpho-test": "^1.4.
|
|
20
|
-
"@morpho-org/morpho-ts": "^1.4.
|
|
19
|
+
"@morpho-org/morpho-test": "^1.4.5",
|
|
20
|
+
"@morpho-org/morpho-ts": "^1.4.5",
|
|
21
21
|
"@types/jest": "^29.5.12",
|
|
22
22
|
"@types/node": "^22.0.0",
|
|
23
23
|
"jest": "^29.7.0",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"typescript": "^5.4.5"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@morpho-org/morpho-ts": "^1.4.
|
|
28
|
+
"@morpho-org/morpho-ts": "^1.4.5"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
],
|
|
50
50
|
"preset": "ts-jest"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "ccdff72b67bf77ef55d340d70106305bb8bbe4c2"
|
|
53
53
|
}
|