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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +32 -13
  2. package/package.json +34 -29
  3. package/src/index.ts +12 -0
  4. package/lib/addresses.d.ts +0 -113
  5. package/lib/addresses.js +0 -162
  6. package/lib/chain.d.ts +0 -29
  7. package/lib/chain.js +0 -289
  8. package/lib/constants.d.ts +0 -29
  9. package/lib/constants.js +0 -33
  10. package/lib/errors.d.ts +0 -52
  11. package/lib/errors.js +0 -107
  12. package/lib/helpers/format/format.d.ts +0 -122
  13. package/lib/helpers/format/format.js +0 -286
  14. package/lib/helpers/locale.d.ts +0 -46
  15. package/lib/helpers/locale.js +0 -96
  16. package/lib/holding/AssetBalances.d.ts +0 -48
  17. package/lib/holding/AssetBalances.js +0 -42
  18. package/lib/holding/Holding.d.ts +0 -64
  19. package/lib/holding/Holding.js +0 -69
  20. package/lib/holding/index.d.ts +0 -2
  21. package/lib/holding/index.js +0 -18
  22. package/lib/index.d.ts +0 -23
  23. package/lib/index.js +0 -52
  24. package/lib/market/Market.d.ts +0 -330
  25. package/lib/market/Market.js +0 -461
  26. package/lib/market/MarketConfig.d.ts +0 -52
  27. package/lib/market/MarketConfig.js +0 -76
  28. package/lib/market/MarketUtils.d.ts +0 -232
  29. package/lib/market/MarketUtils.js +0 -263
  30. package/lib/market/index.d.ts +0 -3
  31. package/lib/market/index.js +0 -19
  32. package/lib/maths/AdaptiveCurveIrmLib.d.ts +0 -39
  33. package/lib/maths/AdaptiveCurveIrmLib.js +0 -134
  34. package/lib/maths/MathLib.d.ts +0 -114
  35. package/lib/maths/MathLib.js +0 -174
  36. package/lib/maths/SharesMath.d.ts +0 -12
  37. package/lib/maths/SharesMath.js +0 -21
  38. package/lib/maths/index.d.ts +0 -3
  39. package/lib/maths/index.js +0 -19
  40. package/lib/position/Position.d.ts +0 -126
  41. package/lib/position/Position.js +0 -203
  42. package/lib/position/index.d.ts +0 -1
  43. package/lib/position/index.js +0 -17
  44. package/lib/tests/mocks/markets.d.ts +0 -19
  45. package/lib/tests/mocks/markets.js +0 -121
  46. package/lib/token/ConstantWrappedToken.d.ts +0 -17
  47. package/lib/token/ConstantWrappedToken.js +0 -34
  48. package/lib/token/ExchangeRateWrappedToken.d.ts +0 -11
  49. package/lib/token/ExchangeRateWrappedToken.js +0 -21
  50. package/lib/token/Token.d.ts +0 -46
  51. package/lib/token/Token.js +0 -64
  52. package/lib/token/VaultToken.d.ts +0 -14
  53. package/lib/token/VaultToken.js +0 -23
  54. package/lib/token/WrappedToken.d.ts +0 -17
  55. package/lib/token/WrappedToken.js +0 -33
  56. package/lib/token/index.d.ts +0 -5
  57. package/lib/token/index.js +0 -21
  58. package/lib/types.d.ts +0 -27
  59. package/lib/types.js +0 -22
  60. package/lib/user/User.d.ts +0 -20
  61. package/lib/user/User.js +0 -23
  62. package/lib/user/index.d.ts +0 -1
  63. package/lib/user/index.js +0 -17
  64. package/lib/vault/Vault.d.ts +0 -166
  65. package/lib/vault/Vault.js +0 -234
  66. package/lib/vault/VaultConfig.d.ts +0 -22
  67. package/lib/vault/VaultConfig.js +0 -32
  68. package/lib/vault/VaultMarketAllocation.d.ts +0 -20
  69. package/lib/vault/VaultMarketAllocation.js +0 -30
  70. package/lib/vault/VaultMarketConfig.d.ts +0 -43
  71. package/lib/vault/VaultMarketConfig.js +0 -43
  72. package/lib/vault/VaultMarketPublicAllocatorConfig.d.ts +0 -29
  73. package/lib/vault/VaultMarketPublicAllocatorConfig.js +0 -28
  74. package/lib/vault/VaultUser.d.ts +0 -26
  75. package/lib/vault/VaultUser.js +0 -28
  76. package/lib/vault/VaultUtils.d.ts +0 -18
  77. package/lib/vault/VaultUtils.js +0 -20
  78. package/lib/vault/index.d.ts +0 -7
  79. package/lib/vault/index.js +0 -23
package/README.md CHANGED
@@ -1,11 +1,37 @@
1
1
  # @morpho-org/blue-sdk
2
2
 
3
- [![npm package][npm-img]][npm-url]
4
- [![Downloads][downloads-img]][downloads-url]
5
-
6
- Framework-agnostic SDK foundational to Morpho Blue's offchain ecosystem, useful to fetch and interact with Morpho Blue and MetaMorpho.
7
-
8
- ## Install
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/wevm/@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
+ - [**`MarketConfig`**](./src/market/MarketConfig.ts): represents the immutable configuration of a market on Morpho
26
+ - [**`Market`**](./src/market/Market.ts): represents the state of a market on Morpho
27
+ - [**`Token`**](./src/token/Token.ts): represents a ERC20 token
28
+ - [**`User`**](./src/user/User.ts): represents a user of Morpho
29
+ - [**`VaultConfig`**](./src/vault/VaultConfig.ts): represents the configuration of a Morpho Vault
30
+ - [**`Vault`**](./src/vault/Vault.ts): represents the state of a Morpho Vault
31
+ - [**`VaultUser`**](./src/vault/VaultUser.ts): represents the state of a user on a Morpho Vault
32
+ - [**`VaultMarketAllocation`**](./src/vault/VaultMarketAllocation.ts): represents the allocation (and configuration) of a Morpho Vault on a Morpho market
33
+
34
+ ## Installation
9
35
 
10
36
  ```bash
11
37
  npm install @morpho-org/blue-sdk
@@ -15,8 +41,6 @@ npm install @morpho-org/blue-sdk
15
41
  yarn add @morpho-org/blue-sdk
16
42
  ```
17
43
 
18
- ---
19
-
20
44
  ## Getting Started
21
45
 
22
46
  ### Instance of the immutable configuration of a specific market
@@ -99,8 +123,3 @@ const accruedPosition = position.accrueInterest(Time.timestamp()); // Accrue int
99
123
 
100
124
  position.borrowAssets; // e.g. 20_400000000000000000n (in loan assets).
101
125
  ```
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/package.json CHANGED
@@ -1,48 +1,53 @@
1
1
  {
2
2
  "name": "@morpho-org/blue-sdk",
3
- "version": "2.0.0-alpha.6",
4
- "author": "Morpho Association <contact@morpho.org>",
3
+ "version": "2.0.0-next.1",
4
+ "author": "Morpho Labs <contact@morpho.org>",
5
5
  "license": "MIT",
6
- "main": "lib/index.js",
6
+ "type": "module",
7
+ "main": "src/index.ts",
7
8
  "files": [
8
9
  "lib"
9
10
  ],
10
11
  "scripts": {
11
- "prepublish": "yarn build",
12
+ "prepublish": "$npm_execpath build",
12
13
  "build": "tsc --build tsconfig.build.json",
13
- "test": "hardhat test"
14
+ "test": "vitest"
14
15
  },
15
16
  "dependencies": {
16
17
  "keccak256": "^1.0.6"
17
18
  },
19
+ "peerDependencies": {
20
+ "@morpho-org/morpho-ts": "workspace:^"
21
+ },
18
22
  "devDependencies": {
19
- "@morpho-org/morpho-test": "^2.0.0-alpha.6",
20
- "@morpho-org/morpho-ts": "^2.0.0-alpha.6",
21
- "@nomicfoundation/hardhat-ethers": "^3.0.6",
22
- "@nomicfoundation/hardhat-network-helpers": "^1.0.11",
23
- "@types/chai": "^4.3.14",
24
- "@types/chai-as-promised": "^7.1.2",
25
- "@types/mocha": "^10.0.6",
23
+ "@morpho-org/morpho-ts": "workspace:^",
24
+ "@morpho-org/test": "workspace:^",
25
+ "@morpho-org/test-viem": "workspace:^",
26
26
  "@types/node": "^22.1.0",
27
- "chai": "^4.3.10",
28
- "chai-as-promised": "^7.1.2",
29
- "chai-ts": "^0.0.3",
30
- "dotenv": "^16.4.5",
31
- "ethers": "^6.13.2",
32
- "ethers-types": "^3.17.0",
33
- "hardhat": "^2.22.6",
34
- "hardhat-deal": "^3.1.0",
35
- "hardhat-tracer": "^3.1.0",
36
- "mocha": "^10.4.0",
37
- "ts-node": "^10.9.2",
38
- "typescript": "^5.6.2",
39
- "vitest": "^2.1.1"
40
- },
41
- "peerDependencies": {
42
- "@morpho-org/morpho-ts": "^2.0.0-alpha.6"
27
+ "typescript": "^5.6.3",
28
+ "viem": "^2.21.19",
29
+ "viem-deal": "^2.0.0",
30
+ "vitest": "^2.1.3"
43
31
  },
44
32
  "publishConfig": {
33
+ "main": "lib/index.js",
34
+ "types": "lib/index.d.ts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./lib/index.d.ts",
38
+ "default": "./lib/index.js"
39
+ }
40
+ },
45
41
  "access": "public"
46
42
  },
47
- "gitHead": "24debc694152770f88775a2edb09cb9f4e2c1246"
43
+ "release": {
44
+ "branches": [
45
+ "main",
46
+ {
47
+ "name": "next",
48
+ "prerelease": true
49
+ }
50
+ ],
51
+ "extends": "semantic-release-monorepo"
52
+ }
48
53
  }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ export * from "./addresses.js";
2
+ export * from "./constants.js";
3
+ export * from "./errors.js";
4
+ export * from "./market/index.js";
5
+ export * from "./chain.js";
6
+ export * from "./token/index.js";
7
+ export * from "./types.js";
8
+ export * from "./math/index.js";
9
+ export * from "./user/index.js";
10
+ export * from "./holding/index.js";
11
+ export * from "./position/index.js";
12
+ export * from "./vault/index.js";
@@ -1,113 +0,0 @@
1
- import { ChainId } from "./chain";
2
- import { Address } from "./types";
3
- /** Address used to replicate an erc20-behaviour for native token.
4
- *
5
- * NB: data might differ from expected onchain native token data
6
- */
7
- export declare const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
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
- wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
21
- morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999";
22
- dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F";
23
- sDai: "0x83F20F44975D03b1b09e64809B757c47f942BEeA";
24
- mkr: "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2";
25
- stEth: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84";
26
- wstEth: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0";
27
- osEth: "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38";
28
- bIB01: "0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5";
29
- wbIB01: "0xcA2A7068e551d5C4482eb34880b194E4b945712F";
30
- bC3M: "0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7";
31
- wbC3M: "0x95D7337d43340E2721960Dc402D9b9117f0d81a2";
32
- usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
33
- crvUsd: "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E";
34
- "stkcvxcrvUSDTWBTCWETH-morpho": "0xb0Ce26C88e4e7DCa51968b6047f44646f5064278";
35
- crvUSDTWBTCWETH: "0xf5f5B97624542D72A9E06f04804Bf81baA15e2B4";
36
- "stkcvxcrvUSDCWBTCWETH-morpho": "0x0ea1a65A2c255f24Ee8D81eA6AaC54Decd9d269e";
37
- crvUSDCWBTCWETH: "0x7F86Bf177Dd4F3494b841a37e810A34dD56c829B";
38
- "stkcvxcrvCRVUSDTBTCWSTETH-morpho": "0x3ce8Ec9f3d89aD0A2DdbCC3FDB8991BD241Fc82E";
39
- crvCRVUSDTBTCWSTETH: "0x2889302a794dA87fBF1D6Db415C1492194663D13";
40
- "stkcvxTryLSD-morpho": "0x6BA072F0d22806F2C52e9792AF47f2D59103BEBE";
41
- tryLSD: "0x2570f1bD5D2735314FC102eb12Fc1aFe9e6E7193";
42
- "stkcvxcrvUSDETHCRV-morpho": "0xAc904BAfBb5FB04Deb2b6198FdCEedE75a78Ce5a";
43
- crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14";
44
- "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e";
45
- "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726";
46
- };
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
- wNative: "0x4200000000000000000000000000000000000006";
57
- usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
58
- verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b";
59
- testUsdc: "0xBC77067f829979812d795d516E523C4033b66409";
60
- };
61
- };
62
- export interface ChainAddresses {
63
- morpho: Address;
64
- permit2: Address;
65
- bundler: Address;
66
- aaveV3OptimizerBundler?: Address;
67
- aaveV2Bundler?: Address;
68
- aaveV3Bundler?: Address;
69
- compoundV3Bundler?: Address;
70
- compoundV2Bundler?: Address;
71
- adaptiveCurveIrm?: Address;
72
- publicAllocator?: Address;
73
- wNative: Address;
74
- morphoToken?: Address;
75
- dai?: Address;
76
- mkr?: Address;
77
- usdc?: Address;
78
- stEth?: Address;
79
- wstEth?: Address;
80
- }
81
- export type AddressLabel = keyof (typeof addresses)[ChainId];
82
- declare const _default: { [n in ChainId]: ChainAddresses; };
83
- export default _default;
84
- export declare const getChainAddresses: (chainId: number) => ChainAddresses;
85
- /**
86
- * Assumptions:
87
- * - unwrapped token has same number of decimals than wrapped tokens.
88
- */
89
- export declare const unwrappedTokensMapping: Record<ChainId, Record<Address, Address>>;
90
- export declare function getUnwrappedToken(wrappedToken: Address, chainId: ChainId): `0x${string}` | undefined;
91
- /**
92
- * The registry of all known ERC20Wrapper tokens.
93
- */
94
- export declare const erc20WrapperTokens: Record<ChainId, Set<Address>>;
95
- /**
96
- * The registry of all known PermissionedERC20Wrapper with a `hasPermission` getter.
97
- * All permissioned wrapper tokens are considered ERC20Wrapper and automatically added to the erc20WrapperTokens registry.
98
- */
99
- export declare const permissionedWrapperTokens: Record<ChainId, Set<Address>>;
100
- /**
101
- * The registry of all known permissioned wrapped Backed tokens.
102
- * All permissioned Backed tokens are considered ERC20Wrapper and automatically added to the erc20WrapperTokens registry.
103
- */
104
- export declare const permissionedBackedTokens: Record<ChainId, Set<Address>>;
105
- /**
106
- * The registry of all known permissioned wrapped tokens that require a Coinbase attestation.
107
- * All permissioned Coinbase tokens are considered PermissionedERC20Wrapper and automatically added to the permissionedWrapperTokens registry.
108
- */
109
- export declare const permissionedCoinbaseTokens: Record<ChainId, Set<Address>>;
110
- /** /!\ These tokens can not be listed in `erc20WrapperTokens` because the following specs are different:
111
- * - calling `depositFor` supplies on blue instead of minting wrapped token to the user
112
- */
113
- export declare const convexWrapperTokens: Record<ChainId, Set<Address>>;
package/lib/addresses.js DELETED
@@ -1,162 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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");
8
- /** Address used to replicate an erc20-behaviour for native token.
9
- *
10
- * NB: data might differ from expected onchain native token data
11
- */
12
- exports.NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
13
- exports.addresses = {
14
- [chain_1.ChainId.EthMainnet]: {
15
- morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
16
- permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
17
- bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077",
18
- aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c",
19
- aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76",
20
- aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC",
21
- compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558",
22
- compoundV2Bundler: "0x26bf52a84360ad3d01d7cdc28fc2ddc04d8c8647",
23
- adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
24
- publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
25
- wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
26
- morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999",
27
- dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
28
- sDai: "0x83F20F44975D03b1b09e64809B757c47f942BEeA",
29
- mkr: "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2",
30
- stEth: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
31
- wstEth: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
32
- osEth: "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38",
33
- bIB01: "0xCA30c93B02514f86d5C86a6e375E3A330B435Fb5",
34
- // If we want to change the wbIB01 address, we have to check if the new one has simple permit or not.
35
- // Currently, wbIB01 is considered to have simple permit.
36
- wbIB01: "0xcA2A7068e551d5C4482eb34880b194E4b945712F",
37
- bC3M: "0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7",
38
- // If we want to change the wbC3M address, we have to check if the new one has simple permit or not.
39
- // Currently, wbC3M is considered to have simple permit.
40
- wbC3M: "0x95D7337d43340E2721960Dc402D9b9117f0d81a2",
41
- usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
42
- crvUsd: "0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E",
43
- "stkcvxcrvUSDTWBTCWETH-morpho": "0xb0Ce26C88e4e7DCa51968b6047f44646f5064278",
44
- crvUSDTWBTCWETH: "0xf5f5B97624542D72A9E06f04804Bf81baA15e2B4",
45
- "stkcvxcrvUSDCWBTCWETH-morpho": "0x0ea1a65A2c255f24Ee8D81eA6AaC54Decd9d269e",
46
- crvUSDCWBTCWETH: "0x7F86Bf177Dd4F3494b841a37e810A34dD56c829B",
47
- "stkcvxcrvCRVUSDTBTCWSTETH-morpho": "0x3ce8Ec9f3d89aD0A2DdbCC3FDB8991BD241Fc82E",
48
- crvCRVUSDTBTCWSTETH: "0x2889302a794dA87fBF1D6Db415C1492194663D13",
49
- "stkcvxTryLSD-morpho": "0x6BA072F0d22806F2C52e9792AF47f2D59103BEBE",
50
- tryLSD: "0x2570f1bD5D2735314FC102eb12Fc1aFe9e6E7193",
51
- "stkcvxcrvUSDETHCRV-morpho": "0xAc904BAfBb5FB04Deb2b6198FdCEedE75a78Ce5a",
52
- crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14",
53
- "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e",
54
- "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726",
55
- },
56
- [chain_1.ChainId.BaseMainnet]: {
57
- morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
58
- permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
59
- bundler: "0x23055618898e202386e6c13955a58D3C68200BFB",
60
- compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223",
61
- aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108",
62
- compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA",
63
- adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
64
- publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
65
- wNative: "0x4200000000000000000000000000000000000006",
66
- usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
67
- verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b",
68
- testUsdc: "0xBC77067f829979812d795d516E523C4033b66409",
69
- },
70
- };
71
- exports.default = exports.addresses;
72
- const getChainAddresses = (chainId) => {
73
- const chainAddresses = exports.addresses[chainId];
74
- if (!chainAddresses)
75
- throw new errors_1.UnsupportedChainIdError(chainId);
76
- return chainAddresses;
77
- };
78
- exports.getChainAddresses = getChainAddresses;
79
- /**
80
- * Assumptions:
81
- * - unwrapped token has same number of decimals than wrapped tokens.
82
- */
83
- exports.unwrappedTokensMapping = {
84
- [chain_1.ChainId.EthMainnet]: {
85
- [exports.addresses[chain_1.ChainId.EthMainnet].wbIB01]: exports.addresses[chain_1.ChainId.EthMainnet].bIB01,
86
- [exports.addresses[chain_1.ChainId.EthMainnet].wbC3M]: exports.addresses[chain_1.ChainId.EthMainnet].bC3M,
87
- [exports.addresses[chain_1.ChainId.EthMainnet].wNative]: exports.NATIVE_ADDRESS,
88
- [exports.addresses[chain_1.ChainId.EthMainnet].stEth]: exports.NATIVE_ADDRESS,
89
- [exports.addresses[chain_1.ChainId.EthMainnet].wstEth]: exports.addresses[chain_1.ChainId.EthMainnet].stEth,
90
- [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDTWBTCWETH-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].crvUSDTWBTCWETH,
91
- [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDCWBTCWETH-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].crvUSDCWBTCWETH,
92
- [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvCRVUSDTBTCWSTETH-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].crvCRVUSDTBTCWSTETH,
93
- [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxTryLSD-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].tryLSD,
94
- [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDETHCRV-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet].crvUSDETHCRV,
95
- [exports.addresses[chain_1.ChainId.EthMainnet]["stkcvx2BTC-f-morpho"]]: exports.addresses[chain_1.ChainId.EthMainnet]["2BTC-f"],
96
- },
97
- [chain_1.ChainId.BaseMainnet]: {
98
- [exports.addresses[chain_1.ChainId.BaseMainnet].wNative]: exports.NATIVE_ADDRESS,
99
- [exports.addresses[chain_1.ChainId.BaseMainnet].verUsdc]: exports.addresses[chain_1.ChainId.BaseMainnet].usdc,
100
- [exports.addresses[chain_1.ChainId.BaseMainnet].testUsdc]: exports.addresses[chain_1.ChainId.BaseMainnet].usdc,
101
- },
102
- };
103
- function getUnwrappedToken(wrappedToken, chainId) {
104
- return exports.unwrappedTokensMapping[chainId][wrappedToken];
105
- }
106
- /**
107
- * The registry of all known ERC20Wrapper tokens.
108
- */
109
- exports.erc20WrapperTokens = {
110
- [chain_1.ChainId.EthMainnet]: new Set(),
111
- [chain_1.ChainId.BaseMainnet]: new Set(),
112
- };
113
- /**
114
- * The registry of all known PermissionedERC20Wrapper with a `hasPermission` getter.
115
- * All permissioned wrapper tokens are considered ERC20Wrapper and automatically added to the erc20WrapperTokens registry.
116
- */
117
- exports.permissionedWrapperTokens = {
118
- [chain_1.ChainId.EthMainnet]: new Set(),
119
- [chain_1.ChainId.BaseMainnet]: new Set([exports.addresses[chain_1.ChainId.BaseMainnet].testUsdc]),
120
- };
121
- /**
122
- * The registry of all known permissioned wrapped Backed tokens.
123
- * All permissioned Backed tokens are considered ERC20Wrapper and automatically added to the erc20WrapperTokens registry.
124
- */
125
- exports.permissionedBackedTokens = {
126
- [chain_1.ChainId.EthMainnet]: new Set([
127
- exports.addresses[chain_1.ChainId.EthMainnet].wbIB01,
128
- exports.addresses[chain_1.ChainId.EthMainnet].wbC3M,
129
- ]),
130
- [chain_1.ChainId.BaseMainnet]: new Set(),
131
- };
132
- /**
133
- * The registry of all known permissioned wrapped tokens that require a Coinbase attestation.
134
- * All permissioned Coinbase tokens are considered PermissionedERC20Wrapper and automatically added to the permissionedWrapperTokens registry.
135
- */
136
- exports.permissionedCoinbaseTokens = {
137
- [chain_1.ChainId.EthMainnet]: new Set(),
138
- [chain_1.ChainId.BaseMainnet]: new Set([exports.addresses[chain_1.ChainId.BaseMainnet].verUsdc]),
139
- };
140
- (0, morpho_ts_1.entries)(exports.permissionedBackedTokens).forEach(([chainId, tokens]) => {
141
- tokens.forEach((token) => exports.erc20WrapperTokens[chainId].add(token));
142
- });
143
- (0, morpho_ts_1.entries)(exports.permissionedCoinbaseTokens).forEach(([chainId, tokens]) => {
144
- tokens.forEach((token) => exports.permissionedWrapperTokens[chainId].add(token));
145
- });
146
- (0, morpho_ts_1.entries)(exports.permissionedWrapperTokens).forEach(([chainId, tokens]) => {
147
- tokens.forEach((token) => exports.erc20WrapperTokens[chainId].add(token));
148
- });
149
- /** /!\ These tokens can not be listed in `erc20WrapperTokens` because the following specs are different:
150
- * - calling `depositFor` supplies on blue instead of minting wrapped token to the user
151
- */
152
- exports.convexWrapperTokens = {
153
- [chain_1.ChainId.EthMainnet]: new Set([
154
- exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDTWBTCWETH-morpho"],
155
- exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDCWBTCWETH-morpho"],
156
- exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvCRVUSDTBTCWSTETH-morpho"],
157
- exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxTryLSD-morpho"],
158
- exports.addresses[chain_1.ChainId.EthMainnet]["stkcvxcrvUSDETHCRV-morpho"],
159
- exports.addresses[chain_1.ChainId.EthMainnet]["stkcvx2BTC-f-morpho"],
160
- ]),
161
- [chain_1.ChainId.BaseMainnet]: new Set(),
162
- };
package/lib/chain.d.ts DELETED
@@ -1,29 +0,0 @@
1
- export declare enum ChainId {
2
- EthMainnet = 1,
3
- BaseMainnet = 8453
4
- }
5
- export interface ChainMetadata {
6
- readonly name: string;
7
- readonly id: ChainId;
8
- readonly defaultRpcUrl: string;
9
- readonly explorerUrl: string;
10
- readonly nativeCurrency: {
11
- readonly name: string;
12
- readonly symbol: string;
13
- readonly decimals: number;
14
- };
15
- readonly isTestnet: boolean;
16
- readonly shortName: string;
17
- readonly identifier: string;
18
- readonly logoSrc: string;
19
- }
20
- export declare namespace ChainUtils {
21
- const toHexChainId: (chainId: ChainId) => string;
22
- const getExplorerUrl: (chainId: ChainId) => string;
23
- const getExplorerAddressUrl: (chainId: ChainId, address: string) => string;
24
- const getExplorerTransactionUrl: (chainId: ChainId, tx: string) => string;
25
- function isSupported(chainId: number): chainId is ChainId;
26
- function parseSupportedChainId(candidate: any): ChainId;
27
- const BLUE_AVAILABLE_CHAINS: [ChainId, ...ChainId[]];
28
- const CHAIN_METADATA: Record<ChainId, ChainMetadata>;
29
- }