@morpho-org/blue-sdk 2.0.0-alpha.6 → 2.0.0-next.2
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/LICENSE +21 -0
- package/README.md +41 -21
- package/lib/addresses.d.ts +58 -54
- package/lib/addresses.js +60 -66
- package/lib/chain.d.ts +1 -1
- package/lib/chain.js +7 -10
- package/lib/constants.js +9 -12
- package/lib/errors.d.ts +1 -1
- package/lib/errors.js +9 -19
- package/lib/holding/AssetBalances.d.ts +1 -1
- package/lib/holding/AssetBalances.js +1 -5
- package/lib/holding/Holding.d.ts +1 -1
- package/lib/holding/Holding.js +5 -9
- package/lib/holding/index.d.ts +2 -2
- package/lib/holding/index.js +2 -18
- package/lib/index.d.ts +12 -23
- package/lib/index.js +12 -52
- package/lib/market/Market.d.ts +8 -6
- package/lib/market/Market.js +51 -53
- package/lib/market/MarketConfig.d.ts +1 -1
- package/lib/market/MarketConfig.js +10 -13
- package/lib/market/MarketUtils.d.ts +8 -7
- package/lib/market/MarketUtils.js +48 -54
- package/lib/market/index.d.ts +3 -3
- package/lib/market/index.js +3 -19
- package/lib/{maths → math}/AdaptiveCurveIrmLib.d.ts +1 -1
- package/lib/{maths → math}/AdaptiveCurveIrmLib.js +22 -25
- package/lib/{maths → math}/MathLib.d.ts +25 -28
- package/lib/{maths → math}/MathLib.js +51 -40
- package/lib/{maths → math}/SharesMath.d.ts +2 -2
- package/lib/{maths → math}/SharesMath.js +5 -8
- package/lib/math/index.d.ts +3 -0
- package/lib/math/index.js +3 -0
- package/lib/position/Position.d.ts +11 -10
- package/lib/position/Position.js +15 -19
- package/lib/position/index.d.ts +1 -1
- package/lib/position/index.js +1 -17
- package/lib/token/ConstantWrappedToken.d.ts +4 -4
- package/lib/token/ConstantWrappedToken.js +5 -9
- package/lib/token/ExchangeRateWrappedToken.d.ts +4 -4
- package/lib/token/ExchangeRateWrappedToken.js +5 -9
- package/lib/token/Token.d.ts +3 -3
- package/lib/token/Token.js +9 -14
- package/lib/token/VaultToken.d.ts +20 -11
- package/lib/token/VaultToken.js +14 -10
- package/lib/token/WrappedToken.d.ts +3 -3
- package/lib/token/WrappedToken.js +7 -11
- package/lib/token/index.d.ts +5 -5
- package/lib/token/index.js +5 -21
- package/lib/types.d.ts +1 -1
- package/lib/types.js +4 -9
- package/lib/user/User.d.ts +1 -1
- package/lib/user/User.js +1 -5
- package/lib/user/index.d.ts +1 -1
- package/lib/user/index.js +1 -17
- package/lib/vault/Vault.d.ts +8 -22
- package/lib/vault/Vault.js +38 -51
- package/lib/vault/VaultConfig.d.ts +2 -2
- package/lib/vault/VaultConfig.js +3 -7
- package/lib/vault/VaultMarketAllocation.d.ts +3 -3
- package/lib/vault/VaultMarketAllocation.js +4 -8
- package/lib/vault/VaultMarketConfig.d.ts +3 -3
- package/lib/vault/VaultMarketConfig.js +1 -5
- package/lib/vault/VaultMarketPublicAllocatorConfig.d.ts +1 -1
- package/lib/vault/VaultMarketPublicAllocatorConfig.js +1 -5
- package/lib/vault/VaultUser.d.ts +1 -1
- package/lib/vault/VaultUser.js +1 -5
- package/lib/vault/VaultUtils.d.ts +4 -6
- package/lib/vault/VaultUtils.js +8 -11
- package/lib/vault/index.d.ts +7 -7
- package/lib/vault/index.js +7 -23
- package/package.json +46 -33
- package/lib/helpers/format/format.d.ts +0 -122
- package/lib/helpers/format/format.js +0 -286
- package/lib/helpers/locale.d.ts +0 -46
- package/lib/helpers/locale.js +0 -96
- package/lib/maths/index.d.ts +0 -3
- package/lib/maths/index.js +0 -19
- package/lib/tests/mocks/markets.d.ts +0 -19
- package/lib/tests/mocks/markets.js +0 -121
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Morpho Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
# @morpho-org/blue-sdk
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
<a href="https://www.npmjs.com/package/@morpho-org/blue-sdk">
|
|
4
|
+
<picture>
|
|
5
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/@morpho-org/blue-sdk?colorA=21262d&colorB=21262d&style=flat">
|
|
6
|
+
<img src="https://img.shields.io/npm/v/@morpho-org/blue-sdk?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Version">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://github.com/morpho-org/blue-sdk/blob/main/LICENSE">
|
|
10
|
+
<picture>
|
|
11
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/l/@morpho-org/blue-sdk?colorA=21262d&colorB=21262d&style=flat">
|
|
12
|
+
<img src="https://img.shields.io/npm/l/@morpho-org/blue-sdk?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="MIT License">
|
|
13
|
+
</picture>
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://www.npmjs.com/package/@morpho-org/blue-sdk">
|
|
16
|
+
<picture>
|
|
17
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/dm/@morpho-org/blue-sdk?colorA=21262d&colorB=21262d&style=flat">
|
|
18
|
+
<img src="https://img.shields.io/npm/dm/@morpho-org/blue-sdk?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Downloads per month">
|
|
19
|
+
</picture>
|
|
20
|
+
</a>
|
|
21
|
+
<br />
|
|
22
|
+
<br />
|
|
23
|
+
|
|
24
|
+
Framework-agnostic package that defines Morpho-related entity classes:
|
|
25
|
+
|
|
26
|
+
- [**`MarketConfig`**](./src/market/MarketConfig.ts): represents the immutable configuration of a market on Morpho
|
|
27
|
+
- [**`Market`**](./src/market/Market.ts): represents the state of a market on Morpho
|
|
28
|
+
- [**`Token`**](./src/token/Token.ts): represents a ERC20 token
|
|
29
|
+
- [**`User`**](./src/user/User.ts): represents a user of Morpho
|
|
30
|
+
- [**`VaultConfig`**](./src/vault/VaultConfig.ts): represents the configuration of a Morpho Vault
|
|
31
|
+
- [**`Vault`**](./src/vault/Vault.ts): represents the state of a Morpho Vault
|
|
32
|
+
- [**`VaultUser`**](./src/vault/VaultUser.ts): represents the state of a user on a Morpho Vault
|
|
33
|
+
- [**`VaultMarketAllocation`**](./src/vault/VaultMarketAllocation.ts): represents the allocation (and configuration) of a Morpho Vault on a Morpho market
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
9
36
|
|
|
10
37
|
```bash
|
|
11
38
|
npm install @morpho-org/blue-sdk
|
|
@@ -15,8 +42,6 @@ npm install @morpho-org/blue-sdk
|
|
|
15
42
|
yarn add @morpho-org/blue-sdk
|
|
16
43
|
```
|
|
17
44
|
|
|
18
|
-
---
|
|
19
|
-
|
|
20
45
|
## Getting Started
|
|
21
46
|
|
|
22
47
|
### Instance of the immutable configuration of a specific market
|
|
@@ -27,11 +52,11 @@ Leverage the [`MarketConfig`](./src/market/MarketConfig.ts) class to manipulate
|
|
|
27
52
|
import { MarketConfig } from "@morpho-org/blue-sdk";
|
|
28
53
|
|
|
29
54
|
const config = new MarketConfig({
|
|
30
|
-
loanToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
55
|
+
loanToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
|
|
31
56
|
collateralToken: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", // wstETH
|
|
32
57
|
oracle: "0x2a01EB9496094dA03c4E364Def50f5aD1280AD72",
|
|
33
|
-
irm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
|
|
34
|
-
lltv: 94_5000000000000000n,
|
|
58
|
+
irm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC", // AdaptiveCurveIrm
|
|
59
|
+
lltv: 94_5000000000000000n, // 94.5%
|
|
35
60
|
});
|
|
36
61
|
|
|
37
62
|
config.liquidationIncentiveFactor; // e.g. 1_090000000000000000n (109%).
|
|
@@ -47,11 +72,11 @@ import { Time } from "@morpho-org/morpho-ts";
|
|
|
47
72
|
|
|
48
73
|
const market = new Market({
|
|
49
74
|
config: new MarketConfig({
|
|
50
|
-
loanToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
75
|
+
loanToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
|
|
51
76
|
collateralToken: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", // wstETH
|
|
52
77
|
oracle: "0x2a01EB9496094dA03c4E364Def50f5aD1280AD72",
|
|
53
|
-
irm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
|
|
54
|
-
lltv: 94_5000000000000000n,
|
|
78
|
+
irm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC", // AdaptiveCurveIrm
|
|
79
|
+
lltv: 94_5000000000000000n, // 94.5%
|
|
55
80
|
}),
|
|
56
81
|
totalSupplyAssets: 1000_000000000000000000n,
|
|
57
82
|
totalBorrowAssets: 920_000000000000000000n,
|
|
@@ -60,7 +85,7 @@ const market = new Market({
|
|
|
60
85
|
lastUpdate: 1721000000n,
|
|
61
86
|
fee: 0n,
|
|
62
87
|
price: 1_100000000000000000000000000000000000n,
|
|
63
|
-
rateAtTarget: 94850992095n
|
|
88
|
+
rateAtTarget: 94850992095n,
|
|
64
89
|
});
|
|
65
90
|
|
|
66
91
|
market.utilization; // e.g. 92_0000000000000000n (92%).
|
|
@@ -86,7 +111,7 @@ const position = new AccrualPosition(
|
|
|
86
111
|
marketId: market.id,
|
|
87
112
|
supplyShares: 0n,
|
|
88
113
|
borrowShares: 20_000000000000000000000000n,
|
|
89
|
-
collateral: 27_000000000000000000n
|
|
114
|
+
collateral: 27_000000000000000000n,
|
|
90
115
|
}),
|
|
91
116
|
market
|
|
92
117
|
);
|
|
@@ -99,8 +124,3 @@ const accruedPosition = position.accrueInterest(Time.timestamp()); // Accrue int
|
|
|
99
124
|
|
|
100
125
|
position.borrowAssets; // e.g. 20_400000000000000000n (in loan assets).
|
|
101
126
|
```
|
|
102
|
-
|
|
103
|
-
[downloads-img]: https://img.shields.io/npm/dt/@morpho-org/blue-sdk
|
|
104
|
-
[downloads-url]: https://www.npmtrends.com/@morpho-org/blue-sdk
|
|
105
|
-
[npm-img]: https://img.shields.io/npm/v/@morpho-org/blue-sdk
|
|
106
|
-
[npm-url]: https://www.npmjs.com/package/@morpho-org/blue-sdk
|
package/lib/addresses.d.ts
CHANGED
|
@@ -1,62 +1,65 @@
|
|
|
1
|
-
import { ChainId } from "./chain";
|
|
2
|
-
import { Address } from "./types";
|
|
1
|
+
import { ChainId } from "./chain.js";
|
|
2
|
+
import type { Address } from "./types.js";
|
|
3
3
|
/** Address used to replicate an erc20-behaviour for native token.
|
|
4
4
|
*
|
|
5
5
|
* NB: data might differ from expected onchain native token data
|
|
6
6
|
*/
|
|
7
7
|
export declare const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
8
8
|
export declare const addresses: {
|
|
9
|
-
1: {
|
|
10
|
-
morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
11
|
-
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
12
|
-
bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077";
|
|
13
|
-
aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c";
|
|
14
|
-
aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76";
|
|
15
|
-
aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC";
|
|
16
|
-
compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558";
|
|
17
|
-
compoundV2Bundler: "0x26bf52a84360ad3d01d7cdc28fc2ddc04d8c8647";
|
|
18
|
-
adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
19
|
-
publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
9
|
+
readonly 1: {
|
|
10
|
+
readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
11
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
12
|
+
readonly bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077";
|
|
13
|
+
readonly aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c";
|
|
14
|
+
readonly aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76";
|
|
15
|
+
readonly aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC";
|
|
16
|
+
readonly compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558";
|
|
17
|
+
readonly compoundV2Bundler: "0x26bf52a84360ad3d01d7cdc28fc2ddc04d8c8647";
|
|
18
|
+
readonly adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
19
|
+
readonly publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
|
|
20
|
+
readonly metaMorphoFactory: "0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101";
|
|
21
|
+
readonly wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
22
|
+
readonly morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999";
|
|
23
|
+
readonly dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F";
|
|
24
|
+
readonly sDai: "0x83F20F44975D03b1b09e64809B757c47f942BEeA";
|
|
25
|
+
readonly mkr: "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2";
|
|
26
|
+
readonly stEth: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84";
|
|
27
|
+
readonly wstEth: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0";
|
|
28
|
+
readonly osEth: "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38";
|
|
29
|
+
readonly bIB01: "0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5";
|
|
30
|
+
readonly wbIB01: "0xcA2A7068e551d5C4482eb34880b194E4b945712F";
|
|
31
|
+
readonly bC3M: "0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7";
|
|
32
|
+
readonly wbC3M: "0x95D7337d43340E2721960Dc402D9b9117f0d81a2";
|
|
33
|
+
readonly usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
34
|
+
readonly usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
|
|
35
|
+
readonly crvUsd: "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E";
|
|
36
|
+
readonly "stkcvxcrvUSDTWBTCWETH-morpho": "0xb0Ce26C88e4e7DCa51968b6047f44646f5064278";
|
|
37
|
+
readonly crvUSDTWBTCWETH: "0xf5f5B97624542D72A9E06f04804Bf81baA15e2B4";
|
|
38
|
+
readonly "stkcvxcrvUSDCWBTCWETH-morpho": "0x0ea1a65A2c255f24Ee8D81eA6AaC54Decd9d269e";
|
|
39
|
+
readonly crvUSDCWBTCWETH: "0x7F86Bf177Dd4F3494b841a37e810A34dD56c829B";
|
|
40
|
+
readonly "stkcvxcrvCRVUSDTBTCWSTETH-morpho": "0x3ce8Ec9f3d89aD0A2DdbCC3FDB8991BD241Fc82E";
|
|
41
|
+
readonly crvCRVUSDTBTCWSTETH: "0x2889302a794dA87fBF1D6Db415C1492194663D13";
|
|
42
|
+
readonly "stkcvxTryLSD-morpho": "0x6BA072F0d22806F2C52e9792AF47f2D59103BEBE";
|
|
43
|
+
readonly tryLSD: "0x2570f1bD5D2735314FC102eb12Fc1aFe9e6E7193";
|
|
44
|
+
readonly "stkcvxcrvUSDETHCRV-morpho": "0xAc904BAfBb5FB04Deb2b6198FdCEedE75a78Ce5a";
|
|
45
|
+
readonly crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14";
|
|
46
|
+
readonly "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e";
|
|
47
|
+
readonly "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726";
|
|
46
48
|
};
|
|
47
|
-
8453: {
|
|
48
|
-
morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
49
|
-
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
50
|
-
bundler: "0x23055618898e202386e6c13955a58D3C68200BFB";
|
|
51
|
-
compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223";
|
|
52
|
-
aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108";
|
|
53
|
-
compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA";
|
|
54
|
-
adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
|
|
55
|
-
publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
readonly 8453: {
|
|
50
|
+
readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
51
|
+
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
52
|
+
readonly bundler: "0x23055618898e202386e6c13955a58D3C68200BFB";
|
|
53
|
+
readonly compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223";
|
|
54
|
+
readonly aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108";
|
|
55
|
+
readonly compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA";
|
|
56
|
+
readonly adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
|
|
57
|
+
readonly publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
|
|
58
|
+
readonly metaMorphoFactory: "0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101";
|
|
59
|
+
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
60
|
+
readonly usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
61
|
+
readonly verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b";
|
|
62
|
+
readonly testUsdc: "0xBC77067f829979812d795d516E523C4033b66409";
|
|
60
63
|
};
|
|
61
64
|
};
|
|
62
65
|
export interface ChainAddresses {
|
|
@@ -68,8 +71,9 @@ export interface ChainAddresses {
|
|
|
68
71
|
aaveV3Bundler?: Address;
|
|
69
72
|
compoundV3Bundler?: Address;
|
|
70
73
|
compoundV2Bundler?: Address;
|
|
71
|
-
adaptiveCurveIrm
|
|
72
|
-
publicAllocator
|
|
74
|
+
adaptiveCurveIrm: Address;
|
|
75
|
+
publicAllocator: Address;
|
|
76
|
+
metaMorphoFactory: Address;
|
|
73
77
|
wNative: Address;
|
|
74
78
|
morphoToken?: Address;
|
|
75
79
|
dai?: Address;
|
package/lib/addresses.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.convexWrapperTokens = exports.permissionedCoinbaseTokens = exports.permissionedBackedTokens = exports.permissionedWrapperTokens = exports.erc20WrapperTokens = exports.unwrappedTokensMapping = exports.getChainAddresses = exports.addresses = exports.NATIVE_ADDRESS = void 0;
|
|
4
|
-
exports.getUnwrappedToken = getUnwrappedToken;
|
|
5
|
-
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
|
-
const chain_1 = require("./chain");
|
|
7
|
-
const errors_1 = require("./errors");
|
|
1
|
+
import { entries } from "@morpho-org/morpho-ts";
|
|
2
|
+
import { ChainId, ChainUtils } from "./chain.js";
|
|
8
3
|
/** Address used to replicate an erc20-behaviour for native token.
|
|
9
4
|
*
|
|
10
5
|
* NB: data might differ from expected onchain native token data
|
|
11
6
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[
|
|
7
|
+
export const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
8
|
+
export const addresses = {
|
|
9
|
+
[ChainId.EthMainnet]: {
|
|
15
10
|
morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
|
|
16
11
|
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
17
12
|
bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077",
|
|
@@ -22,6 +17,7 @@ exports.addresses = {
|
|
|
22
17
|
compoundV2Bundler: "0x26bf52a84360ad3d01d7cdc28fc2ddc04d8c8647",
|
|
23
18
|
adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
|
|
24
19
|
publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
|
|
20
|
+
metaMorphoFactory: "0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101",
|
|
25
21
|
wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
26
22
|
morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999",
|
|
27
23
|
dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
|
@@ -39,6 +35,7 @@ exports.addresses = {
|
|
|
39
35
|
// Currently, wbC3M is considered to have simple permit.
|
|
40
36
|
wbC3M: "0x95D7337d43340E2721960Dc402D9b9117f0d81a2",
|
|
41
37
|
usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
38
|
+
usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
42
39
|
crvUsd: "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E",
|
|
43
40
|
"stkcvxcrvUSDTWBTCWETH-morpho": "0xb0Ce26C88e4e7DCa51968b6047f44646f5064278",
|
|
44
41
|
crvUSDTWBTCWETH: "0xf5f5B97624542D72A9E06f04804Bf81baA15e2B4",
|
|
@@ -53,7 +50,7 @@ exports.addresses = {
|
|
|
53
50
|
"stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e",
|
|
54
51
|
"2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726",
|
|
55
52
|
},
|
|
56
|
-
[
|
|
53
|
+
[ChainId.BaseMainnet]: {
|
|
57
54
|
morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
|
|
58
55
|
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
59
56
|
bundler: "0x23055618898e202386e6c13955a58D3C68200BFB",
|
|
@@ -62,101 +59,98 @@ exports.addresses = {
|
|
|
62
59
|
compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA",
|
|
63
60
|
adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
|
|
64
61
|
publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
|
|
62
|
+
metaMorphoFactory: "0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101",
|
|
65
63
|
wNative: "0x4200000000000000000000000000000000000006",
|
|
66
64
|
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
67
65
|
verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b",
|
|
68
66
|
testUsdc: "0xBC77067f829979812d795d516E523C4033b66409",
|
|
69
67
|
},
|
|
70
68
|
};
|
|
71
|
-
|
|
72
|
-
const getChainAddresses = (chainId) => {
|
|
73
|
-
|
|
74
|
-
if (!chainAddresses)
|
|
75
|
-
throw new errors_1.UnsupportedChainIdError(chainId);
|
|
76
|
-
return chainAddresses;
|
|
69
|
+
export default addresses;
|
|
70
|
+
export const getChainAddresses = (chainId) => {
|
|
71
|
+
return addresses[ChainUtils.parseSupportedChainId(chainId)];
|
|
77
72
|
};
|
|
78
|
-
exports.getChainAddresses = getChainAddresses;
|
|
79
73
|
/**
|
|
80
74
|
* Assumptions:
|
|
81
75
|
* - unwrapped token has same number of decimals than wrapped tokens.
|
|
82
76
|
*/
|
|
83
|
-
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
88
|
-
[
|
|
89
|
-
[
|
|
90
|
-
[
|
|
91
|
-
[
|
|
92
|
-
[
|
|
93
|
-
[
|
|
94
|
-
[
|
|
95
|
-
[
|
|
77
|
+
export const unwrappedTokensMapping = {
|
|
78
|
+
[ChainId.EthMainnet]: {
|
|
79
|
+
[addresses[ChainId.EthMainnet].wbIB01]: addresses[ChainId.EthMainnet].bIB01,
|
|
80
|
+
[addresses[ChainId.EthMainnet].wbC3M]: addresses[ChainId.EthMainnet].bC3M,
|
|
81
|
+
[addresses[ChainId.EthMainnet].wNative]: NATIVE_ADDRESS,
|
|
82
|
+
[addresses[ChainId.EthMainnet].stEth]: NATIVE_ADDRESS,
|
|
83
|
+
[addresses[ChainId.EthMainnet].wstEth]: addresses[ChainId.EthMainnet].stEth,
|
|
84
|
+
[addresses[ChainId.EthMainnet]["stkcvxcrvUSDTWBTCWETH-morpho"]]: addresses[ChainId.EthMainnet].crvUSDTWBTCWETH,
|
|
85
|
+
[addresses[ChainId.EthMainnet]["stkcvxcrvUSDCWBTCWETH-morpho"]]: addresses[ChainId.EthMainnet].crvUSDCWBTCWETH,
|
|
86
|
+
[addresses[ChainId.EthMainnet]["stkcvxcrvCRVUSDTBTCWSTETH-morpho"]]: addresses[ChainId.EthMainnet].crvCRVUSDTBTCWSTETH,
|
|
87
|
+
[addresses[ChainId.EthMainnet]["stkcvxTryLSD-morpho"]]: addresses[ChainId.EthMainnet].tryLSD,
|
|
88
|
+
[addresses[ChainId.EthMainnet]["stkcvxcrvUSDETHCRV-morpho"]]: addresses[ChainId.EthMainnet].crvUSDETHCRV,
|
|
89
|
+
[addresses[ChainId.EthMainnet]["stkcvx2BTC-f-morpho"]]: addresses[ChainId.EthMainnet]["2BTC-f"],
|
|
96
90
|
},
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
[
|
|
100
|
-
[
|
|
91
|
+
[ChainId.BaseMainnet]: {
|
|
92
|
+
[addresses[ChainId.BaseMainnet].wNative]: NATIVE_ADDRESS,
|
|
93
|
+
[addresses[ChainId.BaseMainnet].verUsdc]: addresses[ChainId.BaseMainnet].usdc,
|
|
94
|
+
[addresses[ChainId.BaseMainnet].testUsdc]: addresses[ChainId.BaseMainnet].usdc,
|
|
101
95
|
},
|
|
102
96
|
};
|
|
103
|
-
function getUnwrappedToken(wrappedToken, chainId) {
|
|
104
|
-
return
|
|
97
|
+
export function getUnwrappedToken(wrappedToken, chainId) {
|
|
98
|
+
return unwrappedTokensMapping[chainId][wrappedToken];
|
|
105
99
|
}
|
|
106
100
|
/**
|
|
107
101
|
* The registry of all known ERC20Wrapper tokens.
|
|
108
102
|
*/
|
|
109
|
-
|
|
110
|
-
[
|
|
111
|
-
[
|
|
103
|
+
export const erc20WrapperTokens = {
|
|
104
|
+
[ChainId.EthMainnet]: new Set(),
|
|
105
|
+
[ChainId.BaseMainnet]: new Set(),
|
|
112
106
|
};
|
|
113
107
|
/**
|
|
114
108
|
* The registry of all known PermissionedERC20Wrapper with a `hasPermission` getter.
|
|
115
109
|
* All permissioned wrapper tokens are considered ERC20Wrapper and automatically added to the erc20WrapperTokens registry.
|
|
116
110
|
*/
|
|
117
|
-
|
|
118
|
-
[
|
|
119
|
-
[
|
|
111
|
+
export const permissionedWrapperTokens = {
|
|
112
|
+
[ChainId.EthMainnet]: new Set(),
|
|
113
|
+
[ChainId.BaseMainnet]: new Set([addresses[ChainId.BaseMainnet].testUsdc]),
|
|
120
114
|
};
|
|
121
115
|
/**
|
|
122
116
|
* The registry of all known permissioned wrapped Backed tokens.
|
|
123
117
|
* All permissioned Backed tokens are considered ERC20Wrapper and automatically added to the erc20WrapperTokens registry.
|
|
124
118
|
*/
|
|
125
|
-
|
|
126
|
-
[
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
export const permissionedBackedTokens = {
|
|
120
|
+
[ChainId.EthMainnet]: new Set([
|
|
121
|
+
addresses[ChainId.EthMainnet].wbIB01,
|
|
122
|
+
addresses[ChainId.EthMainnet].wbC3M,
|
|
129
123
|
]),
|
|
130
|
-
[
|
|
124
|
+
[ChainId.BaseMainnet]: new Set(),
|
|
131
125
|
};
|
|
132
126
|
/**
|
|
133
127
|
* The registry of all known permissioned wrapped tokens that require a Coinbase attestation.
|
|
134
128
|
* All permissioned Coinbase tokens are considered PermissionedERC20Wrapper and automatically added to the permissionedWrapperTokens registry.
|
|
135
129
|
*/
|
|
136
|
-
|
|
137
|
-
[
|
|
138
|
-
[
|
|
130
|
+
export const permissionedCoinbaseTokens = {
|
|
131
|
+
[ChainId.EthMainnet]: new Set(),
|
|
132
|
+
[ChainId.BaseMainnet]: new Set([addresses[ChainId.BaseMainnet].verUsdc]),
|
|
139
133
|
};
|
|
140
|
-
|
|
141
|
-
tokens.forEach((token) =>
|
|
134
|
+
entries(permissionedBackedTokens).forEach(([chainId, tokens]) => {
|
|
135
|
+
tokens.forEach((token) => erc20WrapperTokens[chainId].add(token));
|
|
142
136
|
});
|
|
143
|
-
|
|
144
|
-
tokens.forEach((token) =>
|
|
137
|
+
entries(permissionedCoinbaseTokens).forEach(([chainId, tokens]) => {
|
|
138
|
+
tokens.forEach((token) => permissionedWrapperTokens[chainId].add(token));
|
|
145
139
|
});
|
|
146
|
-
|
|
147
|
-
tokens.forEach((token) =>
|
|
140
|
+
entries(permissionedWrapperTokens).forEach(([chainId, tokens]) => {
|
|
141
|
+
tokens.forEach((token) => erc20WrapperTokens[chainId].add(token));
|
|
148
142
|
});
|
|
149
143
|
/** /!\ These tokens can not be listed in `erc20WrapperTokens` because the following specs are different:
|
|
150
144
|
* - calling `depositFor` supplies on blue instead of minting wrapped token to the user
|
|
151
145
|
*/
|
|
152
|
-
|
|
153
|
-
[
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
146
|
+
export const convexWrapperTokens = {
|
|
147
|
+
[ChainId.EthMainnet]: new Set([
|
|
148
|
+
addresses[ChainId.EthMainnet]["stkcvxcrvUSDTWBTCWETH-morpho"],
|
|
149
|
+
addresses[ChainId.EthMainnet]["stkcvxcrvUSDCWBTCWETH-morpho"],
|
|
150
|
+
addresses[ChainId.EthMainnet]["stkcvxcrvCRVUSDTBTCWSTETH-morpho"],
|
|
151
|
+
addresses[ChainId.EthMainnet]["stkcvxTryLSD-morpho"],
|
|
152
|
+
addresses[ChainId.EthMainnet]["stkcvxcrvUSDETHCRV-morpho"],
|
|
153
|
+
addresses[ChainId.EthMainnet]["stkcvx2BTC-f-morpho"],
|
|
160
154
|
]),
|
|
161
|
-
[
|
|
155
|
+
[ChainId.BaseMainnet]: new Set(),
|
|
162
156
|
};
|
package/lib/chain.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare namespace ChainUtils {
|
|
|
23
23
|
const getExplorerAddressUrl: (chainId: ChainId, address: string) => string;
|
|
24
24
|
const getExplorerTransactionUrl: (chainId: ChainId, tx: string) => string;
|
|
25
25
|
function isSupported(chainId: number): chainId is ChainId;
|
|
26
|
-
function parseSupportedChainId(candidate:
|
|
26
|
+
function parseSupportedChainId(candidate: unknown): ChainId;
|
|
27
27
|
const BLUE_AVAILABLE_CHAINS: [ChainId, ...ChainId[]];
|
|
28
28
|
const CHAIN_METADATA: Record<ChainId, ChainMetadata>;
|
|
29
29
|
}
|
package/lib/chain.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ChainUtils = exports.ChainId = void 0;
|
|
4
|
-
const errors_1 = require("./errors");
|
|
5
|
-
var ChainId;
|
|
1
|
+
import { UnsupportedChainIdError } from "./errors.js";
|
|
2
|
+
export var ChainId;
|
|
6
3
|
(function (ChainId) {
|
|
7
4
|
ChainId[ChainId["EthMainnet"] = 1] = "EthMainnet";
|
|
8
5
|
ChainId[ChainId["BaseMainnet"] = 8453] = "BaseMainnet";
|
|
@@ -28,8 +25,8 @@ var ChainId;
|
|
|
28
25
|
// AvalancheFujiTestnet = 43113,
|
|
29
26
|
// MoonbaseAlphaTestnet = 1287,
|
|
30
27
|
// BaseGoerliTestnet = 84531,
|
|
31
|
-
})(ChainId || (
|
|
32
|
-
var ChainUtils;
|
|
28
|
+
})(ChainId || (ChainId = {}));
|
|
29
|
+
export var ChainUtils;
|
|
33
30
|
(function (ChainUtils) {
|
|
34
31
|
ChainUtils.toHexChainId = (chainId) => {
|
|
35
32
|
return `0x${chainId.toString(16)}`;
|
|
@@ -48,9 +45,9 @@ var ChainUtils;
|
|
|
48
45
|
}
|
|
49
46
|
ChainUtils.isSupported = isSupported;
|
|
50
47
|
function parseSupportedChainId(candidate) {
|
|
51
|
-
const chainId = parseInt(candidate);
|
|
48
|
+
const chainId = Number.parseInt(candidate); // Force cast to string to silence TS because it works.
|
|
52
49
|
if (!isSupported(chainId))
|
|
53
|
-
throw new
|
|
50
|
+
throw new UnsupportedChainIdError(chainId);
|
|
54
51
|
return chainId;
|
|
55
52
|
}
|
|
56
53
|
ChainUtils.parseSupportedChainId = parseSupportedChainId;
|
|
@@ -286,4 +283,4 @@ var ChainUtils;
|
|
|
286
283
|
// isTestnet: true,
|
|
287
284
|
// },
|
|
288
285
|
};
|
|
289
|
-
})(ChainUtils || (
|
|
286
|
+
})(ChainUtils || (ChainUtils = {}));
|
package/lib/constants.js
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SECONDS_PER_YEAR = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SLIPPAGE_TOLERANCE = exports.ORACLE_PRICE_SCALE = exports.ORACLE_PRICE_OFFSET = exports.MAX_LIQUIDATION_INCENTIVE_FACTOR = exports.LIQUIDATION_CURSOR = void 0;
|
|
4
|
-
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
1
|
+
import { Time } from "@morpho-org/morpho-ts";
|
|
5
2
|
/**
|
|
6
3
|
* The liquidation cursor used to calculate the liquidation incentive. Hardcoded to 30%.
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
export const LIQUIDATION_CURSOR = 300000000000000000n;
|
|
9
6
|
/**
|
|
10
7
|
* The maximum liquidation incentive factor. Hardcoded to 115%.
|
|
11
8
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export const MAX_LIQUIDATION_INCENTIVE_FACTOR = 1150000000000000000n;
|
|
10
|
+
export const ORACLE_PRICE_OFFSET = 36;
|
|
14
11
|
/**
|
|
15
12
|
* The scale of the oracle price. Hardcoded to 1e36.
|
|
16
13
|
*/
|
|
17
|
-
|
|
14
|
+
export const ORACLE_PRICE_SCALE = 1000000000000000000000000000000000000n;
|
|
18
15
|
/**
|
|
19
16
|
* The default slippage tolerance used in the SDK. Hardcoded to 0.03%.
|
|
20
17
|
*/
|
|
21
|
-
|
|
18
|
+
export const DEFAULT_SLIPPAGE_TOLERANCE = 300000000000000n;
|
|
22
19
|
/**
|
|
23
20
|
* The default withdrawal target utilization used by the shared liquidity algorithm. Hardcoded to 92%.
|
|
24
21
|
*/
|
|
25
|
-
|
|
22
|
+
export const DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = 920000000000000000n;
|
|
26
23
|
/**
|
|
27
24
|
* The default supply target utilization used by the shared liquidity algorithm. Hardcoded to 90.5%.
|
|
28
25
|
*/
|
|
29
|
-
|
|
26
|
+
export const DEFAULT_SUPPLY_TARGET_UTILIZATION = 905000000000000000n;
|
|
30
27
|
/**
|
|
31
28
|
* The number of seconds in a year.
|
|
32
29
|
*/
|
|
33
|
-
|
|
30
|
+
export const SECONDS_PER_YEAR = Time.s.from.y(1n);
|
package/lib/errors.d.ts
CHANGED
package/lib/errors.js
CHANGED
|
@@ -1,51 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlueErrors = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownMarketConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownDataError = void 0;
|
|
4
|
-
exports._try = _try;
|
|
5
|
-
class UnknownDataError extends Error {
|
|
1
|
+
export class UnknownDataError extends Error {
|
|
6
2
|
}
|
|
7
|
-
|
|
8
|
-
class UnknownTokenError extends UnknownDataError {
|
|
3
|
+
export class UnknownTokenError extends UnknownDataError {
|
|
9
4
|
address;
|
|
10
5
|
constructor(address) {
|
|
11
6
|
super(`unknown token ${address}`);
|
|
12
7
|
this.address = address;
|
|
13
8
|
}
|
|
14
9
|
}
|
|
15
|
-
|
|
16
|
-
class UnknownTokenPriceError extends UnknownDataError {
|
|
10
|
+
export class UnknownTokenPriceError extends UnknownDataError {
|
|
17
11
|
address;
|
|
18
12
|
constructor(address) {
|
|
19
13
|
super(`unknown price of token ${address}`);
|
|
20
14
|
this.address = address;
|
|
21
15
|
}
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
class UnknownMarketConfigError extends UnknownDataError {
|
|
17
|
+
export class UnknownMarketConfigError extends UnknownDataError {
|
|
25
18
|
marketId;
|
|
26
19
|
constructor(marketId) {
|
|
27
20
|
super(`unknown config for market ${marketId}`);
|
|
28
21
|
this.marketId = marketId;
|
|
29
22
|
}
|
|
30
23
|
}
|
|
31
|
-
|
|
32
|
-
class UnknownVaultConfigError extends UnknownDataError {
|
|
24
|
+
export class UnknownVaultConfigError extends UnknownDataError {
|
|
33
25
|
vault;
|
|
34
26
|
constructor(vault) {
|
|
35
27
|
super(`unknown config for vault ${vault}`);
|
|
36
28
|
this.vault = vault;
|
|
37
29
|
}
|
|
38
30
|
}
|
|
39
|
-
|
|
40
|
-
class UnsupportedChainIdError extends Error {
|
|
31
|
+
export class UnsupportedChainIdError extends Error {
|
|
41
32
|
chainId;
|
|
42
33
|
constructor(chainId) {
|
|
43
34
|
super(`unsupported chain ${chainId}`);
|
|
44
35
|
this.chainId = chainId;
|
|
45
36
|
}
|
|
46
37
|
}
|
|
47
|
-
|
|
48
|
-
var BlueErrors;
|
|
38
|
+
export var BlueErrors;
|
|
49
39
|
(function (BlueErrors) {
|
|
50
40
|
class InvalidInterestAccrual extends Error {
|
|
51
41
|
marketId;
|
|
@@ -93,8 +83,8 @@ var BlueErrors;
|
|
|
93
83
|
}
|
|
94
84
|
}
|
|
95
85
|
BlueErrors.InsufficientCollateral = InsufficientCollateral;
|
|
96
|
-
})(BlueErrors || (
|
|
97
|
-
function _try(accessor, ...errorClasses) {
|
|
86
|
+
})(BlueErrors || (BlueErrors = {}));
|
|
87
|
+
export function _try(accessor, ...errorClasses) {
|
|
98
88
|
try {
|
|
99
89
|
return accessor();
|
|
100
90
|
}
|