@morpho-org/blue-sdk 5.16.0 → 5.18.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/{addresses.d.ts → cjs/addresses.d.ts} +12 -0
- package/lib/{addresses.js → cjs/addresses.js} +6 -0
- package/lib/cjs/package.json +1 -0
- package/lib/{position → cjs/position}/PreLiquidationPosition.d.ts +3 -3
- package/lib/{position → cjs/position}/PreLiquidationPosition.js +16 -16
- package/lib/{preLiquidation.d.ts → cjs/preLiquidation.d.ts} +1 -1
- package/lib/{preLiquidation.js → cjs/preLiquidation.js} +2 -2
- package/lib/{vault → cjs/vault}/index.d.ts +1 -1
- package/lib/{vault → cjs/vault}/index.js +1 -1
- package/lib/{vault → cjs/vault}/v2/VaultV2.d.ts +5 -5
- package/lib/{vault → cjs/vault}/v2/VaultV2.js +25 -25
- package/lib/{vault → cjs/vault}/v2/VaultV2Adapter.d.ts +2 -2
- package/lib/{vault → cjs/vault}/v2/VaultV2MorphoMarketV1Adapter.d.ts +7 -7
- package/lib/{vault → cjs/vault}/v2/VaultV2MorphoMarketV1Adapter.js +9 -9
- package/lib/{vault → cjs/vault}/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +6 -6
- package/lib/{vault → cjs/vault}/v2/VaultV2MorphoMarketV1AdapterV2.js +8 -8
- package/lib/{vault → cjs/vault}/v2/VaultV2MorphoVaultV1Adapter.d.ts +6 -6
- package/lib/{vault → cjs/vault}/v2/VaultV2MorphoVaultV1Adapter.js +2 -2
- package/lib/esm/addresses.d.ts +2243 -0
- package/lib/esm/addresses.js +1315 -0
- package/lib/esm/chain.d.ts +405 -0
- package/lib/esm/chain.js +276 -0
- package/lib/esm/constants.d.ts +20 -0
- package/lib/esm/constants.js +21 -0
- package/lib/esm/errors.d.ts +101 -0
- package/lib/esm/errors.js +192 -0
- package/lib/esm/holding/AssetBalances.d.ts +48 -0
- package/lib/esm/holding/AssetBalances.js +38 -0
- package/lib/esm/holding/Holding.d.ts +63 -0
- package/lib/esm/holding/Holding.js +63 -0
- package/lib/esm/holding/index.d.ts +2 -0
- package/lib/esm/holding/index.js +2 -0
- package/lib/esm/index.d.ts +14 -0
- package/lib/esm/index.js +14 -0
- package/lib/esm/market/Market.d.ts +424 -0
- package/lib/esm/market/Market.js +576 -0
- package/lib/esm/market/MarketParams.d.ts +74 -0
- package/lib/esm/market/MarketParams.js +91 -0
- package/lib/esm/market/MarketUtils.d.ts +273 -0
- package/lib/esm/market/MarketUtils.js +323 -0
- package/lib/esm/market/index.d.ts +3 -0
- package/lib/esm/market/index.js +3 -0
- package/lib/esm/math/AdaptiveCurveIrmLib.d.ts +40 -0
- package/lib/esm/math/AdaptiveCurveIrmLib.js +133 -0
- package/lib/esm/math/MathLib.d.ts +102 -0
- package/lib/esm/math/MathLib.js +168 -0
- package/lib/esm/math/SharesMath.d.ts +12 -0
- package/lib/esm/math/SharesMath.js +18 -0
- package/lib/esm/math/index.d.ts +3 -0
- package/lib/esm/math/index.js +3 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/position/Position.d.ts +147 -0
- package/lib/esm/position/Position.js +237 -0
- package/lib/esm/position/PreLiquidationPosition.d.ts +60 -0
- package/lib/esm/position/PreLiquidationPosition.js +97 -0
- package/lib/esm/position/index.d.ts +2 -0
- package/lib/esm/position/index.js +2 -0
- package/lib/esm/preLiquidation.d.ts +15 -0
- package/lib/esm/preLiquidation.js +91 -0
- package/lib/esm/token/ConstantWrappedToken.d.ts +17 -0
- package/lib/esm/token/ConstantWrappedToken.js +30 -0
- package/lib/esm/token/Eip5267Domain.d.ts +55 -0
- package/lib/esm/token/Eip5267Domain.js +66 -0
- package/lib/esm/token/ExchangeRateWrappedToken.d.ts +11 -0
- package/lib/esm/token/ExchangeRateWrappedToken.js +17 -0
- package/lib/esm/token/Token.d.ts +52 -0
- package/lib/esm/token/Token.js +62 -0
- package/lib/esm/token/VaultToken.d.ts +23 -0
- package/lib/esm/token/VaultToken.js +27 -0
- package/lib/esm/token/WrappedToken.d.ts +17 -0
- package/lib/esm/token/WrappedToken.js +29 -0
- package/lib/esm/token/index.d.ts +6 -0
- package/lib/esm/token/index.js +6 -0
- package/lib/esm/types.d.ts +26 -0
- package/lib/esm/types.js +13 -0
- package/lib/esm/user/User.d.ts +20 -0
- package/lib/esm/user/User.js +19 -0
- package/lib/esm/user/index.d.ts +1 -0
- package/lib/esm/user/index.js +1 -0
- package/lib/esm/utils.d.ts +13 -0
- package/lib/esm/utils.js +10 -0
- package/lib/esm/vault/Vault.d.ts +214 -0
- package/lib/esm/vault/Vault.js +289 -0
- package/lib/esm/vault/VaultConfig.d.ts +11 -0
- package/lib/esm/vault/VaultConfig.js +10 -0
- package/lib/esm/vault/VaultMarketAllocation.d.ts +20 -0
- package/lib/esm/vault/VaultMarketAllocation.js +27 -0
- package/lib/esm/vault/VaultMarketConfig.d.ts +43 -0
- package/lib/esm/vault/VaultMarketConfig.js +39 -0
- package/lib/esm/vault/VaultMarketPublicAllocatorConfig.d.ts +29 -0
- package/lib/esm/vault/VaultMarketPublicAllocatorConfig.js +24 -0
- package/lib/esm/vault/VaultUser.d.ts +26 -0
- package/lib/esm/vault/VaultUser.js +24 -0
- package/lib/esm/vault/VaultUtils.d.ts +16 -0
- package/lib/esm/vault/VaultUtils.js +17 -0
- package/lib/esm/vault/index.d.ts +8 -0
- package/lib/esm/vault/index.js +8 -0
- package/lib/esm/vault/v2/VaultV2.d.ts +87 -0
- package/lib/esm/vault/v2/VaultV2.js +154 -0
- package/lib/esm/vault/v2/VaultV2Adapter.d.ts +29 -0
- package/lib/esm/vault/v2/VaultV2Adapter.js +12 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1Adapter.d.ts +30 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1Adapter.js +54 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +33 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +63 -0
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +24 -0
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.js +36 -0
- package/lib/esm/vault/v2/index.d.ts +5 -0
- package/lib/esm/vault/v2/index.js +5 -0
- package/package.json +16 -7
- package/src/index.ts +14 -0
- /package/lib/{chain.d.ts → cjs/chain.d.ts} +0 -0
- /package/lib/{chain.js → cjs/chain.js} +0 -0
- /package/lib/{constants.d.ts → cjs/constants.d.ts} +0 -0
- /package/lib/{constants.js → cjs/constants.js} +0 -0
- /package/lib/{errors.d.ts → cjs/errors.d.ts} +0 -0
- /package/lib/{errors.js → cjs/errors.js} +0 -0
- /package/lib/{holding → cjs/holding}/AssetBalances.d.ts +0 -0
- /package/lib/{holding → cjs/holding}/AssetBalances.js +0 -0
- /package/lib/{holding → cjs/holding}/Holding.d.ts +0 -0
- /package/lib/{holding → cjs/holding}/Holding.js +0 -0
- /package/lib/{holding → cjs/holding}/index.d.ts +0 -0
- /package/lib/{holding → cjs/holding}/index.js +0 -0
- /package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/lib/{index.js → cjs/index.js} +0 -0
- /package/lib/{market → cjs/market}/Market.d.ts +0 -0
- /package/lib/{market → cjs/market}/Market.js +0 -0
- /package/lib/{market → cjs/market}/MarketParams.d.ts +0 -0
- /package/lib/{market → cjs/market}/MarketParams.js +0 -0
- /package/lib/{market → cjs/market}/MarketUtils.d.ts +0 -0
- /package/lib/{market → cjs/market}/MarketUtils.js +0 -0
- /package/lib/{market → cjs/market}/index.d.ts +0 -0
- /package/lib/{market → cjs/market}/index.js +0 -0
- /package/lib/{math → cjs/math}/AdaptiveCurveIrmLib.d.ts +0 -0
- /package/lib/{math → cjs/math}/AdaptiveCurveIrmLib.js +0 -0
- /package/lib/{math → cjs/math}/MathLib.d.ts +0 -0
- /package/lib/{math → cjs/math}/MathLib.js +0 -0
- /package/lib/{math → cjs/math}/SharesMath.d.ts +0 -0
- /package/lib/{math → cjs/math}/SharesMath.js +0 -0
- /package/lib/{math → cjs/math}/index.d.ts +0 -0
- /package/lib/{math → cjs/math}/index.js +0 -0
- /package/lib/{position → cjs/position}/Position.d.ts +0 -0
- /package/lib/{position → cjs/position}/Position.js +0 -0
- /package/lib/{position → cjs/position}/index.d.ts +0 -0
- /package/lib/{position → cjs/position}/index.js +0 -0
- /package/lib/{token → cjs/token}/ConstantWrappedToken.d.ts +0 -0
- /package/lib/{token → cjs/token}/ConstantWrappedToken.js +0 -0
- /package/lib/{token → cjs/token}/Eip5267Domain.d.ts +0 -0
- /package/lib/{token → cjs/token}/Eip5267Domain.js +0 -0
- /package/lib/{token → cjs/token}/ExchangeRateWrappedToken.d.ts +0 -0
- /package/lib/{token → cjs/token}/ExchangeRateWrappedToken.js +0 -0
- /package/lib/{token → cjs/token}/Token.d.ts +0 -0
- /package/lib/{token → cjs/token}/Token.js +0 -0
- /package/lib/{token → cjs/token}/VaultToken.d.ts +0 -0
- /package/lib/{token → cjs/token}/VaultToken.js +0 -0
- /package/lib/{token → cjs/token}/WrappedToken.d.ts +0 -0
- /package/lib/{token → cjs/token}/WrappedToken.js +0 -0
- /package/lib/{token → cjs/token}/index.d.ts +0 -0
- /package/lib/{token → cjs/token}/index.js +0 -0
- /package/lib/{types.d.ts → cjs/types.d.ts} +0 -0
- /package/lib/{types.js → cjs/types.js} +0 -0
- /package/lib/{user → cjs/user}/User.d.ts +0 -0
- /package/lib/{user → cjs/user}/User.js +0 -0
- /package/lib/{user → cjs/user}/index.d.ts +0 -0
- /package/lib/{user → cjs/user}/index.js +0 -0
- /package/lib/{utils.d.ts → cjs/utils.d.ts} +0 -0
- /package/lib/{utils.js → cjs/utils.js} +0 -0
- /package/lib/{vault → cjs/vault}/Vault.d.ts +0 -0
- /package/lib/{vault → cjs/vault}/Vault.js +0 -0
- /package/lib/{vault → cjs/vault}/VaultConfig.d.ts +0 -0
- /package/lib/{vault → cjs/vault}/VaultConfig.js +0 -0
- /package/lib/{vault → cjs/vault}/VaultMarketAllocation.d.ts +0 -0
- /package/lib/{vault → cjs/vault}/VaultMarketAllocation.js +0 -0
- /package/lib/{vault → cjs/vault}/VaultMarketConfig.d.ts +0 -0
- /package/lib/{vault → cjs/vault}/VaultMarketConfig.js +0 -0
- /package/lib/{vault → cjs/vault}/VaultMarketPublicAllocatorConfig.d.ts +0 -0
- /package/lib/{vault → cjs/vault}/VaultMarketPublicAllocatorConfig.js +0 -0
- /package/lib/{vault → cjs/vault}/VaultUser.d.ts +0 -0
- /package/lib/{vault → cjs/vault}/VaultUser.js +0 -0
- /package/lib/{vault → cjs/vault}/VaultUtils.d.ts +0 -0
- /package/lib/{vault → cjs/vault}/VaultUtils.js +0 -0
- /package/lib/{vault → cjs/vault}/v2/VaultV2Adapter.js +0 -0
- /package/lib/{vault → cjs/vault}/v2/index.d.ts +0 -0
- /package/lib/{vault → cjs/vault}/v2/index.js +0 -0
|
@@ -505,6 +505,7 @@ declare const _addressesRegistry: {
|
|
|
505
505
|
readonly metaMorphoFactory: "0x33f20973275B2F574488b18929cd7DCBf1AbF275";
|
|
506
506
|
readonly vaultV2Factory: "0x8B2F922162FBb60A6a072cC784A2E4168fB0bb0c";
|
|
507
507
|
readonly morphoMarketV1AdapterFactory: "0x8Da54fbF89B3D6fC6DCC92F31CF75a211ACF3d46";
|
|
508
|
+
readonly morphoMarketV1AdapterV2Factory: "0xa00666E86C7e2FA8d2c78d9481E687e098340180";
|
|
508
509
|
readonly morphoVaultV1AdapterFactory: "0x9f3c0999425656fD189C69a8aD68cB64986D644A";
|
|
509
510
|
readonly registryList: "0x6a42f8b46224baA4DbBBc2F860F4675eeA7bd52B";
|
|
510
511
|
readonly chainlinkOracleFactory: "0xC8659Bcd5279DB664Be973aEFd752a5326653739";
|
|
@@ -523,6 +524,7 @@ declare const _addressesRegistry: {
|
|
|
523
524
|
readonly metaMorphoFactory: "0xb4ae5673c48621189E2bEfBA96F31912032DD1AE";
|
|
524
525
|
readonly vaultV2Factory: "0x7fc35488803D49D00a94b206A223f7661898BE3a";
|
|
525
526
|
readonly morphoMarketV1AdapterFactory: "0x2A5F218FE4Dac3b1f4E096e8ae83074bB1713833";
|
|
527
|
+
readonly morphoMarketV1AdapterV2Factory: "0x9282DBa3d1788f4f02B5DdFc4fc5985e70197620";
|
|
526
528
|
readonly morphoVaultV1AdapterFactory: "0x4EF83ACD552598a1196c1aBDD0bA2EdE6f2237B4";
|
|
527
529
|
readonly registryList: "0xCe93fcB2849EB886F1e81d45D2747dF803f843C3";
|
|
528
530
|
readonly chainlinkOracleFactory: "0xF24C6eAB91e43EacE18a4e893a48565C09132505";
|
|
@@ -539,6 +541,7 @@ declare const _addressesRegistry: {
|
|
|
539
541
|
readonly metaMorphoFactory: "0xEA67e5566Ca2c0176d9db172A7f9A1e1F22E9D3A";
|
|
540
542
|
readonly vaultV2Factory: "0x05519a0835a1bFD90f110aA7ca46e9A5F81Ed3b4";
|
|
541
543
|
readonly morphoMarketV1AdapterFactory: "0xaCFf4ad3B357F5A43A20570cF3eb9Ba0086d4e9a";
|
|
544
|
+
readonly morphoMarketV1AdapterV2Factory: "0xE39f6B5Dd03F4ce8C201b946E662E653d94fA121";
|
|
542
545
|
readonly morphoVaultV1AdapterFactory: "0x8840F99Bb2D4f69fb02b2d019384C5c98a11746c";
|
|
543
546
|
readonly registryList: "0x295e0aB80f8234398cd0E51C85D873ee69E5F0DD";
|
|
544
547
|
readonly chainlinkOracleFactory: "0x44b2c8e4474751EF2BBC57B92928aFB99DA785De";
|
|
@@ -1006,6 +1009,7 @@ declare const _deployments: {
|
|
|
1006
1009
|
readonly metaMorphoFactory: 32320327n;
|
|
1007
1010
|
readonly vaultV2Factory: 32321811n;
|
|
1008
1011
|
readonly morphoMarketV1AdapterFactory: 32321811n;
|
|
1012
|
+
readonly morphoMarketV1AdapterV2Factory: 41103883n;
|
|
1009
1013
|
readonly morphoVaultV1AdapterFactory: 32321811n;
|
|
1010
1014
|
readonly registryList: 32322465n;
|
|
1011
1015
|
readonly chainlinkOracleFactory: 32320327n;
|
|
@@ -1024,6 +1028,7 @@ declare const _deployments: {
|
|
|
1024
1028
|
readonly vaultV2Factory: 1506182n;
|
|
1025
1029
|
readonly morphoMarketV1AdapterFactory: 1506182n;
|
|
1026
1030
|
readonly morphoVaultV1AdapterFactory: 1506182n;
|
|
1031
|
+
readonly morphoMarketV1AdapterV2Factory: 5110812n;
|
|
1027
1032
|
readonly registryList: 1506877n;
|
|
1028
1033
|
readonly chainlinkOracleFactory: 1504774n;
|
|
1029
1034
|
readonly preLiquidationFactory: 1741861n;
|
|
@@ -1039,6 +1044,7 @@ declare const _deployments: {
|
|
|
1039
1044
|
readonly metaMorphoFactory: 38459727n;
|
|
1040
1045
|
readonly vaultV2Factory: 38461643n;
|
|
1041
1046
|
readonly morphoMarketV1AdapterFactory: 38461643n;
|
|
1047
|
+
readonly morphoMarketV1AdapterV2Factory: 44236918n;
|
|
1042
1048
|
readonly morphoVaultV1AdapterFactory: 38461643n;
|
|
1043
1049
|
readonly registryList: 38461812n;
|
|
1044
1050
|
readonly chainlinkOracleFactory: 38459727n;
|
|
@@ -1592,6 +1598,7 @@ export declare let addressesRegistry: {
|
|
|
1592
1598
|
readonly metaMorphoFactory: "0x33f20973275B2F574488b18929cd7DCBf1AbF275";
|
|
1593
1599
|
readonly vaultV2Factory: "0x8B2F922162FBb60A6a072cC784A2E4168fB0bb0c";
|
|
1594
1600
|
readonly morphoMarketV1AdapterFactory: "0x8Da54fbF89B3D6fC6DCC92F31CF75a211ACF3d46";
|
|
1601
|
+
readonly morphoMarketV1AdapterV2Factory: "0xa00666E86C7e2FA8d2c78d9481E687e098340180";
|
|
1595
1602
|
readonly morphoVaultV1AdapterFactory: "0x9f3c0999425656fD189C69a8aD68cB64986D644A";
|
|
1596
1603
|
readonly registryList: "0x6a42f8b46224baA4DbBBc2F860F4675eeA7bd52B";
|
|
1597
1604
|
readonly chainlinkOracleFactory: "0xC8659Bcd5279DB664Be973aEFd752a5326653739";
|
|
@@ -1610,6 +1617,7 @@ export declare let addressesRegistry: {
|
|
|
1610
1617
|
readonly metaMorphoFactory: "0xb4ae5673c48621189E2bEfBA96F31912032DD1AE";
|
|
1611
1618
|
readonly vaultV2Factory: "0x7fc35488803D49D00a94b206A223f7661898BE3a";
|
|
1612
1619
|
readonly morphoMarketV1AdapterFactory: "0x2A5F218FE4Dac3b1f4E096e8ae83074bB1713833";
|
|
1620
|
+
readonly morphoMarketV1AdapterV2Factory: "0x9282DBa3d1788f4f02B5DdFc4fc5985e70197620";
|
|
1613
1621
|
readonly morphoVaultV1AdapterFactory: "0x4EF83ACD552598a1196c1aBDD0bA2EdE6f2237B4";
|
|
1614
1622
|
readonly registryList: "0xCe93fcB2849EB886F1e81d45D2747dF803f843C3";
|
|
1615
1623
|
readonly chainlinkOracleFactory: "0xF24C6eAB91e43EacE18a4e893a48565C09132505";
|
|
@@ -1626,6 +1634,7 @@ export declare let addressesRegistry: {
|
|
|
1626
1634
|
readonly metaMorphoFactory: "0xEA67e5566Ca2c0176d9db172A7f9A1e1F22E9D3A";
|
|
1627
1635
|
readonly vaultV2Factory: "0x05519a0835a1bFD90f110aA7ca46e9A5F81Ed3b4";
|
|
1628
1636
|
readonly morphoMarketV1AdapterFactory: "0xaCFf4ad3B357F5A43A20570cF3eb9Ba0086d4e9a";
|
|
1637
|
+
readonly morphoMarketV1AdapterV2Factory: "0xE39f6B5Dd03F4ce8C201b946E662E653d94fA121";
|
|
1629
1638
|
readonly morphoVaultV1AdapterFactory: "0x8840F99Bb2D4f69fb02b2d019384C5c98a11746c";
|
|
1630
1639
|
readonly registryList: "0x295e0aB80f8234398cd0E51C85D873ee69E5F0DD";
|
|
1631
1640
|
readonly chainlinkOracleFactory: "0x44b2c8e4474751EF2BBC57B92928aFB99DA785De";
|
|
@@ -2091,6 +2100,7 @@ export declare let deployments: {
|
|
|
2091
2100
|
readonly metaMorphoFactory: 32320327n;
|
|
2092
2101
|
readonly vaultV2Factory: 32321811n;
|
|
2093
2102
|
readonly morphoMarketV1AdapterFactory: 32321811n;
|
|
2103
|
+
readonly morphoMarketV1AdapterV2Factory: 41103883n;
|
|
2094
2104
|
readonly morphoVaultV1AdapterFactory: 32321811n;
|
|
2095
2105
|
readonly registryList: 32322465n;
|
|
2096
2106
|
readonly chainlinkOracleFactory: 32320327n;
|
|
@@ -2109,6 +2119,7 @@ export declare let deployments: {
|
|
|
2109
2119
|
readonly vaultV2Factory: 1506182n;
|
|
2110
2120
|
readonly morphoMarketV1AdapterFactory: 1506182n;
|
|
2111
2121
|
readonly morphoVaultV1AdapterFactory: 1506182n;
|
|
2122
|
+
readonly morphoMarketV1AdapterV2Factory: 5110812n;
|
|
2112
2123
|
readonly registryList: 1506877n;
|
|
2113
2124
|
readonly chainlinkOracleFactory: 1504774n;
|
|
2114
2125
|
readonly preLiquidationFactory: 1741861n;
|
|
@@ -2124,6 +2135,7 @@ export declare let deployments: {
|
|
|
2124
2135
|
readonly metaMorphoFactory: 38459727n;
|
|
2125
2136
|
readonly vaultV2Factory: 38461643n;
|
|
2126
2137
|
readonly morphoMarketV1AdapterFactory: 38461643n;
|
|
2138
|
+
readonly morphoMarketV1AdapterV2Factory: 44236918n;
|
|
2127
2139
|
readonly morphoVaultV1AdapterFactory: 38461643n;
|
|
2128
2140
|
readonly registryList: 38461812n;
|
|
2129
2141
|
readonly chainlinkOracleFactory: 38459727n;
|
|
@@ -492,6 +492,7 @@ const _addressesRegistry = {
|
|
|
492
492
|
metaMorphoFactory: "0x33f20973275B2F574488b18929cd7DCBf1AbF275",
|
|
493
493
|
vaultV2Factory: "0x8B2F922162FBb60A6a072cC784A2E4168fB0bb0c",
|
|
494
494
|
morphoMarketV1AdapterFactory: "0x8Da54fbF89B3D6fC6DCC92F31CF75a211ACF3d46",
|
|
495
|
+
morphoMarketV1AdapterV2Factory: "0xa00666E86C7e2FA8d2c78d9481E687e098340180",
|
|
495
496
|
morphoVaultV1AdapterFactory: "0x9f3c0999425656fD189C69a8aD68cB64986D644A",
|
|
496
497
|
registryList: "0x6a42f8b46224baA4DbBBc2F860F4675eeA7bd52B",
|
|
497
498
|
chainlinkOracleFactory: "0xC8659Bcd5279DB664Be973aEFd752a5326653739",
|
|
@@ -510,6 +511,7 @@ const _addressesRegistry = {
|
|
|
510
511
|
metaMorphoFactory: "0xb4ae5673c48621189E2bEfBA96F31912032DD1AE",
|
|
511
512
|
vaultV2Factory: "0x7fc35488803D49D00a94b206A223f7661898BE3a",
|
|
512
513
|
morphoMarketV1AdapterFactory: "0x2A5F218FE4Dac3b1f4E096e8ae83074bB1713833",
|
|
514
|
+
morphoMarketV1AdapterV2Factory: "0x9282DBa3d1788f4f02B5DdFc4fc5985e70197620",
|
|
513
515
|
morphoVaultV1AdapterFactory: "0x4EF83ACD552598a1196c1aBDD0bA2EdE6f2237B4",
|
|
514
516
|
registryList: "0xCe93fcB2849EB886F1e81d45D2747dF803f843C3",
|
|
515
517
|
chainlinkOracleFactory: "0xF24C6eAB91e43EacE18a4e893a48565C09132505",
|
|
@@ -527,6 +529,7 @@ const _addressesRegistry = {
|
|
|
527
529
|
metaMorphoFactory: "0xEA67e5566Ca2c0176d9db172A7f9A1e1F22E9D3A",
|
|
528
530
|
vaultV2Factory: "0x05519a0835a1bFD90f110aA7ca46e9A5F81Ed3b4",
|
|
529
531
|
morphoMarketV1AdapterFactory: "0xaCFf4ad3B357F5A43A20570cF3eb9Ba0086d4e9a",
|
|
532
|
+
morphoMarketV1AdapterV2Factory: "0xE39f6B5Dd03F4ce8C201b946E662E653d94fA121",
|
|
530
533
|
morphoVaultV1AdapterFactory: "0x8840F99Bb2D4f69fb02b2d019384C5c98a11746c",
|
|
531
534
|
registryList: "0x295e0aB80f8234398cd0E51C85D873ee69E5F0DD",
|
|
532
535
|
chainlinkOracleFactory: "0x44b2c8e4474751EF2BBC57B92928aFB99DA785De",
|
|
@@ -995,6 +998,7 @@ const _deployments = {
|
|
|
995
998
|
metaMorphoFactory: 32320327n,
|
|
996
999
|
vaultV2Factory: 32321811n,
|
|
997
1000
|
morphoMarketV1AdapterFactory: 32321811n,
|
|
1001
|
+
morphoMarketV1AdapterV2Factory: 41103883n,
|
|
998
1002
|
morphoVaultV1AdapterFactory: 32321811n,
|
|
999
1003
|
registryList: 32322465n,
|
|
1000
1004
|
chainlinkOracleFactory: 32320327n,
|
|
@@ -1013,6 +1017,7 @@ const _deployments = {
|
|
|
1013
1017
|
vaultV2Factory: 1506182n,
|
|
1014
1018
|
morphoMarketV1AdapterFactory: 1506182n,
|
|
1015
1019
|
morphoVaultV1AdapterFactory: 1506182n,
|
|
1020
|
+
morphoMarketV1AdapterV2Factory: 5110812n,
|
|
1016
1021
|
registryList: 1506877n,
|
|
1017
1022
|
chainlinkOracleFactory: 1504774n,
|
|
1018
1023
|
preLiquidationFactory: 1741861n,
|
|
@@ -1028,6 +1033,7 @@ const _deployments = {
|
|
|
1028
1033
|
metaMorphoFactory: 38459727n,
|
|
1029
1034
|
vaultV2Factory: 38461643n,
|
|
1030
1035
|
morphoMarketV1AdapterFactory: 38461643n,
|
|
1036
|
+
morphoMarketV1AdapterV2Factory: 44236918n,
|
|
1031
1037
|
morphoVaultV1AdapterFactory: 38461643n,
|
|
1032
1038
|
registryList: 38461812n,
|
|
1033
1039
|
chainlinkOracleFactory: 38459727n,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import { type IMarket, Market } from "../market";
|
|
3
|
-
import type { BigIntish } from "../types";
|
|
4
|
-
import { AccrualPosition, type IAccrualPosition } from "./Position";
|
|
2
|
+
import { type IMarket, Market } from "../market/index.js";
|
|
3
|
+
import type { BigIntish } from "../types.js";
|
|
4
|
+
import { AccrualPosition, type IAccrualPosition } from "./Position.js";
|
|
5
5
|
export interface IPreLiquidationParams {
|
|
6
6
|
preLltv: BigIntish;
|
|
7
7
|
preLCF1: BigIntish;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PreLiquidationPosition = exports.PreLiquidationParams = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const index_js_1 = require("../market/index.js");
|
|
6
|
+
const index_js_2 = require("../math/index.js");
|
|
7
|
+
const Position_js_1 = require("./Position.js");
|
|
8
8
|
class PreLiquidationParams {
|
|
9
9
|
preLltv;
|
|
10
10
|
preLCF1;
|
|
@@ -21,14 +21,14 @@ class PreLiquidationParams {
|
|
|
21
21
|
this.preLiquidationOracle = preLiquidationOracle;
|
|
22
22
|
}
|
|
23
23
|
getCloseFactor(quotient) {
|
|
24
|
-
return (this.preLCF1 +
|
|
24
|
+
return (this.preLCF1 + index_js_2.MathLib.wMulDown(quotient, this.preLCF2 - this.preLCF1));
|
|
25
25
|
}
|
|
26
26
|
getIncentiveFactor(quotient) {
|
|
27
|
-
return (this.preLIF1 +
|
|
27
|
+
return (this.preLIF1 + index_js_2.MathLib.wMulDown(quotient, this.preLIF2 - this.preLIF1));
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.PreLiquidationParams = PreLiquidationParams;
|
|
31
|
-
class PreLiquidationPosition extends
|
|
31
|
+
class PreLiquidationPosition extends Position_js_1.AccrualPosition {
|
|
32
32
|
preLiquidationParams;
|
|
33
33
|
preLiquidation;
|
|
34
34
|
preLiquidationOraclePrice;
|
|
@@ -48,7 +48,7 @@ class PreLiquidationPosition extends Position_1.AccrualPosition {
|
|
|
48
48
|
this.preLiquidation = preLiquidation;
|
|
49
49
|
if (preLiquidationOraclePrice != null)
|
|
50
50
|
this.preLiquidationOraclePrice = BigInt(preLiquidationOraclePrice);
|
|
51
|
-
this._baseMarket = new
|
|
51
|
+
this._baseMarket = new index_js_1.Market(market);
|
|
52
52
|
}
|
|
53
53
|
get market() {
|
|
54
54
|
return this._baseMarket;
|
|
@@ -65,10 +65,10 @@ class PreLiquidationPosition extends Position_1.AccrualPosition {
|
|
|
65
65
|
if (collateralValue == null)
|
|
66
66
|
return;
|
|
67
67
|
const { borrowAssets } = this;
|
|
68
|
-
if (borrowAssets >
|
|
68
|
+
if (borrowAssets > index_js_2.MathLib.wMulDown(collateralValue, this._lltv))
|
|
69
69
|
return;
|
|
70
70
|
return (borrowAssets <=
|
|
71
|
-
|
|
71
|
+
index_js_2.MathLib.wMulDown(collateralValue, this.preLiquidationParams.preLltv));
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* @inheritdoc `undefined` if the pre-liquidation's oracle reverts.
|
|
@@ -79,8 +79,8 @@ class PreLiquidationPosition extends Position_1.AccrualPosition {
|
|
|
79
79
|
return;
|
|
80
80
|
const { borrowAssets } = this;
|
|
81
81
|
return (borrowAssets >
|
|
82
|
-
|
|
83
|
-
borrowAssets <=
|
|
82
|
+
index_js_2.MathLib.wMulDown(collateralValue, this.preLiquidationParams.preLltv) &&
|
|
83
|
+
borrowAssets <= index_js_2.MathLib.wMulDown(collateralValue, this._lltv));
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* @inheritdoc `undefined` if the pre-liquidation's oracle reverts.
|
|
@@ -93,10 +93,10 @@ class PreLiquidationPosition extends Position_1.AccrualPosition {
|
|
|
93
93
|
const { ltv } = this;
|
|
94
94
|
if (ltv == null)
|
|
95
95
|
return;
|
|
96
|
-
const quotient =
|
|
97
|
-
const repayableShares =
|
|
98
|
-
const repayableAssets =
|
|
99
|
-
return
|
|
96
|
+
const quotient = index_js_2.MathLib.wDivDown(ltv - this.preLiquidationParams.preLltv, this._lltv - this.preLiquidationParams.preLltv);
|
|
97
|
+
const repayableShares = index_js_2.MathLib.wMulDown(this.borrowShares, this.preLiquidationParams.getCloseFactor(quotient));
|
|
98
|
+
const repayableAssets = index_js_2.MathLib.wMulDown(index_js_2.SharesMath.toAssets(repayableShares, this._market.totalBorrowAssets, this._market.totalBorrowShares, "Down"), this.preLiquidationParams.getIncentiveFactor(quotient));
|
|
99
|
+
return index_js_2.MathLib.mulDivDown(repayableAssets, constants_js_1.ORACLE_PRICE_SCALE, this._market.price);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
exports.PreLiquidationPosition = PreLiquidationPosition;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefaultPreLiquidationParams = exports.defaultPreLiquidationParamsRegistry = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
|
-
const
|
|
5
|
+
const errors_js_1 = require("./errors.js");
|
|
6
6
|
exports.defaultPreLiquidationParamsRegistry = new Map([
|
|
7
7
|
[
|
|
8
8
|
(0, viem_1.parseEther)("0.385"),
|
|
@@ -89,7 +89,7 @@ const getDefaultPreLiquidationParams = (lltv) => {
|
|
|
89
89
|
lltv = BigInt(lltv);
|
|
90
90
|
const defaultParams = exports.defaultPreLiquidationParamsRegistry.get(lltv);
|
|
91
91
|
if (defaultParams == null)
|
|
92
|
-
throw new
|
|
92
|
+
throw new errors_js_1.UnsupportedPreLiquidationParamsError(lltv);
|
|
93
93
|
return defaultParams;
|
|
94
94
|
};
|
|
95
95
|
exports.getDefaultPreLiquidationParams = getDefaultPreLiquidationParams;
|
|
@@ -21,4 +21,4 @@ __exportStar(require("./VaultMarketConfig.js"), exports);
|
|
|
21
21
|
__exportStar(require("./VaultMarketPublicAllocatorConfig.js"), exports);
|
|
22
22
|
__exportStar(require("./VaultUser.js"), exports);
|
|
23
23
|
__exportStar(require("./Vault.js"), exports);
|
|
24
|
-
__exportStar(require("./v2"), exports);
|
|
24
|
+
__exportStar(require("./v2/index.js"), exports);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Address, type Hash, type Hex } from "viem";
|
|
2
|
-
import { type RoundingDirection } from "../../math";
|
|
3
|
-
import { type IToken, WrappedToken } from "../../token";
|
|
4
|
-
import type { BigIntish } from "../../types";
|
|
5
|
-
import { type CapacityLimit } from "../../utils";
|
|
6
|
-
import type { IAccrualVaultV2Adapter } from "./VaultV2Adapter";
|
|
2
|
+
import { type RoundingDirection } from "../../math/index.js";
|
|
3
|
+
import { type IToken, WrappedToken } from "../../token/index.js";
|
|
4
|
+
import type { BigIntish } from "../../types.js";
|
|
5
|
+
import { type CapacityLimit } from "../../utils.js";
|
|
6
|
+
import type { IAccrualVaultV2Adapter } from "./VaultV2Adapter.js";
|
|
7
7
|
export interface IVaultV2Allocation {
|
|
8
8
|
id: Hash;
|
|
9
9
|
absoluteCap: bigint;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AccrualVaultV2 = exports.VaultV2 = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
class VaultV2 extends
|
|
5
|
+
const errors_js_1 = require("../../errors.js");
|
|
6
|
+
const index_js_1 = require("../../math/index.js");
|
|
7
|
+
const index_js_2 = require("../../token/index.js");
|
|
8
|
+
const utils_js_1 = require("../../utils.js");
|
|
9
|
+
class VaultV2 extends index_js_2.WrappedToken {
|
|
10
10
|
asset;
|
|
11
11
|
totalAssets;
|
|
12
12
|
_totalAssets;
|
|
@@ -47,10 +47,10 @@ class VaultV2 extends token_1.WrappedToken {
|
|
|
47
47
|
return this._wrap(assets, "Down");
|
|
48
48
|
}
|
|
49
49
|
_wrap(amount, rounding) {
|
|
50
|
-
return
|
|
50
|
+
return index_js_1.MathLib.mulDiv(amount, this.totalSupply + this.virtualShares, this.totalAssets + 1n, rounding);
|
|
51
51
|
}
|
|
52
52
|
_unwrap(amount, rounding) {
|
|
53
|
-
return
|
|
53
|
+
return index_js_1.MathLib.mulDiv(amount, this.totalAssets + 1n, this.totalSupply + this.virtualShares, rounding);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
exports.VaultV2 = VaultV2;
|
|
@@ -70,29 +70,29 @@ class AccrualVaultV2 extends VaultV2 {
|
|
|
70
70
|
*/
|
|
71
71
|
maxDeposit(assets) {
|
|
72
72
|
if (this.liquidityAdapter === viem_1.zeroAddress)
|
|
73
|
-
return { value: BigInt(assets), limiter:
|
|
73
|
+
return { value: BigInt(assets), limiter: utils_js_1.CapacityLimitReason.balance };
|
|
74
74
|
let liquidityAdapterLimit;
|
|
75
75
|
if (this.accrualLiquidityAdapter != null)
|
|
76
76
|
liquidityAdapterLimit = this.accrualLiquidityAdapter.maxDeposit(this.liquidityData, assets);
|
|
77
77
|
if (this.liquidityAllocations == null || liquidityAdapterLimit == null)
|
|
78
|
-
throw new
|
|
78
|
+
throw new errors_js_1.VaultV2Errors.UnsupportedLiquidityAdapter(this.liquidityAdapter);
|
|
79
79
|
// At this stage: `liquidityAdapterLimit.value <= assets`
|
|
80
80
|
for (const { absoluteCap, relativeCap, allocation } of this
|
|
81
81
|
.liquidityAllocations) {
|
|
82
82
|
// `absoluteCap` can be set lower than `allocation`.
|
|
83
|
-
const absoluteMaxDeposit =
|
|
83
|
+
const absoluteMaxDeposit = index_js_1.MathLib.zeroFloorSub(absoluteCap, allocation);
|
|
84
84
|
if (liquidityAdapterLimit.value > absoluteMaxDeposit)
|
|
85
85
|
liquidityAdapterLimit = {
|
|
86
86
|
value: absoluteMaxDeposit,
|
|
87
|
-
limiter:
|
|
87
|
+
limiter: utils_js_1.CapacityLimitReason.vaultV2_absoluteCap,
|
|
88
88
|
};
|
|
89
|
-
if (relativeCap !==
|
|
89
|
+
if (relativeCap !== index_js_1.MathLib.WAD) {
|
|
90
90
|
// `relativeCap` can be set lower than `allocation / totalAssets`.
|
|
91
|
-
const relativeMaxDeposit =
|
|
91
|
+
const relativeMaxDeposit = index_js_1.MathLib.zeroFloorSub(index_js_1.MathLib.wMulDown(this.totalAssets, relativeCap), allocation);
|
|
92
92
|
if (liquidityAdapterLimit.value > relativeMaxDeposit)
|
|
93
93
|
liquidityAdapterLimit = {
|
|
94
94
|
value: relativeMaxDeposit,
|
|
95
|
-
limiter:
|
|
95
|
+
limiter: utils_js_1.CapacityLimitReason.vaultV2_relativeCap,
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -105,18 +105,18 @@ class AccrualVaultV2 extends VaultV2 {
|
|
|
105
105
|
maxWithdraw(shares) {
|
|
106
106
|
const assets = this.toAssets(shares);
|
|
107
107
|
if (this.liquidityAdapter === viem_1.zeroAddress)
|
|
108
|
-
return { value: BigInt(assets), limiter:
|
|
108
|
+
return { value: BigInt(assets), limiter: utils_js_1.CapacityLimitReason.balance };
|
|
109
109
|
let liquidity = this.assetBalance;
|
|
110
110
|
if (this.accrualLiquidityAdapter != null)
|
|
111
111
|
liquidity += this.accrualLiquidityAdapter.maxWithdraw(this.liquidityData).value;
|
|
112
112
|
if (assets > liquidity)
|
|
113
113
|
return {
|
|
114
114
|
value: liquidity,
|
|
115
|
-
limiter:
|
|
115
|
+
limiter: utils_js_1.CapacityLimitReason.liquidity,
|
|
116
116
|
};
|
|
117
117
|
return {
|
|
118
118
|
value: assets,
|
|
119
|
-
limiter:
|
|
119
|
+
limiter: utils_js_1.CapacityLimitReason.balance,
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
@@ -128,24 +128,24 @@ class AccrualVaultV2 extends VaultV2 {
|
|
|
128
128
|
timestamp = BigInt(timestamp);
|
|
129
129
|
const elapsed = timestamp - this.lastUpdate;
|
|
130
130
|
if (elapsed < 0n)
|
|
131
|
-
throw new
|
|
131
|
+
throw new errors_js_1.VaultV2Errors.InvalidInterestAccrual(this.address, timestamp, this.lastUpdate);
|
|
132
132
|
// Corresponds to the `firstTotalAssets == 0` onchain check.
|
|
133
133
|
if (elapsed === 0n)
|
|
134
134
|
return { vault, performanceFeeShares: 0n, managementFeeShares: 0n };
|
|
135
135
|
const realAssets = vault.accrualAdapters.reduce((curr, adapter) => curr + adapter.realAssets(timestamp), vault.assetBalance);
|
|
136
136
|
const maxTotalAssets = vault._totalAssets +
|
|
137
|
-
|
|
138
|
-
const newTotalAssets =
|
|
139
|
-
const interest =
|
|
137
|
+
index_js_1.MathLib.wMulDown(vault._totalAssets * elapsed, vault.maxRate);
|
|
138
|
+
const newTotalAssets = index_js_1.MathLib.min(realAssets, maxTotalAssets);
|
|
139
|
+
const interest = index_js_1.MathLib.zeroFloorSub(newTotalAssets, vault._totalAssets);
|
|
140
140
|
const performanceFeeAssets = interest > 0n && vault.performanceFee > 0n
|
|
141
|
-
?
|
|
141
|
+
? index_js_1.MathLib.wMulDown(interest, vault.performanceFee)
|
|
142
142
|
: 0n;
|
|
143
143
|
const managementFeeAssets = elapsed > 0n && vault.managementFee > 0n
|
|
144
|
-
?
|
|
144
|
+
? index_js_1.MathLib.wMulDown(newTotalAssets * elapsed, vault.managementFee)
|
|
145
145
|
: 0n;
|
|
146
146
|
const newTotalAssetsWithoutFees = newTotalAssets - performanceFeeAssets - managementFeeAssets;
|
|
147
|
-
const performanceFeeShares =
|
|
148
|
-
const managementFeeShares =
|
|
147
|
+
const performanceFeeShares = index_js_1.MathLib.mulDivDown(performanceFeeAssets, vault.totalSupply + vault.virtualShares, newTotalAssetsWithoutFees + 1n);
|
|
148
|
+
const managementFeeShares = index_js_1.MathLib.mulDivDown(managementFeeAssets, vault.totalSupply + vault.virtualShares, newTotalAssetsWithoutFees + 1n);
|
|
149
149
|
vault.totalAssets = newTotalAssets;
|
|
150
150
|
vault._totalAssets = newTotalAssets;
|
|
151
151
|
if (performanceFeeShares)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, Hash, Hex } from "viem";
|
|
2
|
-
import type { BigIntish } from "../../types";
|
|
3
|
-
import type { CapacityLimit } from "../../utils";
|
|
2
|
+
import type { BigIntish } from "../../types.js";
|
|
3
|
+
import type { CapacityLimit } from "../../utils.js";
|
|
4
4
|
export interface IVaultV2Adapter {
|
|
5
5
|
address: Address;
|
|
6
6
|
parentVault: Address;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
|
-
import { type IMarketParams, MarketParams } from "../../market";
|
|
3
|
-
import type { AccrualPosition } from "../../position";
|
|
4
|
-
import type { BigIntish } from "../../types";
|
|
5
|
-
import { CapacityLimitReason } from "../../utils";
|
|
6
|
-
import { VaultV2Adapter } from "./VaultV2Adapter";
|
|
7
|
-
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter";
|
|
2
|
+
import { type IMarketParams, MarketParams } from "../../market/index.js";
|
|
3
|
+
import type { AccrualPosition } from "../../position/index.js";
|
|
4
|
+
import type { BigIntish } from "../../types.js";
|
|
5
|
+
import { CapacityLimitReason } from "../../utils.js";
|
|
6
|
+
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
7
|
+
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter.js";
|
|
8
8
|
export interface IVaultV2MorphoMarketV1Adapter extends Omit<IVaultV2Adapter, "adapterId"> {
|
|
9
9
|
marketParamsList: IMarketParams[];
|
|
10
10
|
}
|
|
@@ -26,5 +26,5 @@ export declare class AccrualVaultV2MorphoMarketV1Adapter extends VaultV2MorphoMa
|
|
|
26
26
|
value: bigint;
|
|
27
27
|
limiter: CapacityLimitReason;
|
|
28
28
|
};
|
|
29
|
-
maxWithdraw(data: Hex): import("../../utils").CapacityLimit;
|
|
29
|
+
maxWithdraw(data: Hex): import("../../utils.js").CapacityLimit;
|
|
30
30
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AccrualVaultV2MorphoMarketV1Adapter = exports.VaultV2MorphoMarketV1Adapter = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
class VaultV2MorphoMarketV1Adapter extends
|
|
5
|
+
const index_js_1 = require("../../market/index.js");
|
|
6
|
+
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
const VaultV2Adapter_js_1 = require("./VaultV2Adapter.js");
|
|
8
|
+
class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter_js_1.VaultV2Adapter {
|
|
9
9
|
static adapterId(address) {
|
|
10
10
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
11
11
|
}
|
|
@@ -13,7 +13,7 @@ class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter_1.VaultV2Adapter {
|
|
|
13
13
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["collateralToken", address]));
|
|
14
14
|
}
|
|
15
15
|
static marketParamsId(address, params) {
|
|
16
|
-
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" },
|
|
16
|
+
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }, index_js_1.marketParamsAbi], ["this/marketParams", address, params]));
|
|
17
17
|
}
|
|
18
18
|
marketParamsList;
|
|
19
19
|
constructor({ marketParamsList, ...vaultV2Adapter }) {
|
|
@@ -21,7 +21,7 @@ class VaultV2MorphoMarketV1Adapter extends VaultV2Adapter_1.VaultV2Adapter {
|
|
|
21
21
|
...vaultV2Adapter,
|
|
22
22
|
adapterId: VaultV2MorphoMarketV1Adapter.adapterId(vaultV2Adapter.address),
|
|
23
23
|
});
|
|
24
|
-
this.marketParamsList = marketParamsList.map((params) => new
|
|
24
|
+
this.marketParamsList = marketParamsList.map((params) => new index_js_1.MarketParams(params));
|
|
25
25
|
}
|
|
26
26
|
ids(params) {
|
|
27
27
|
return [
|
|
@@ -44,15 +44,15 @@ class AccrualVaultV2MorphoMarketV1Adapter extends VaultV2MorphoMarketV1Adapter {
|
|
|
44
44
|
maxDeposit(_data, assets) {
|
|
45
45
|
return {
|
|
46
46
|
value: BigInt(assets),
|
|
47
|
-
limiter:
|
|
47
|
+
limiter: utils_js_1.CapacityLimitReason.balance,
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
maxWithdraw(data) {
|
|
51
|
-
const marketId =
|
|
51
|
+
const marketId = index_js_1.MarketParams.fromHex(data).id;
|
|
52
52
|
const position = this.positions.find((position) => position.marketId === marketId);
|
|
53
53
|
return (position?.market?.getWithdrawCapacityLimit(position) ?? {
|
|
54
54
|
value: 0n,
|
|
55
|
-
limiter:
|
|
55
|
+
limiter: utils_js_1.CapacityLimitReason.position,
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
|
-
import { type Market, MarketParams } from "../../market";
|
|
3
|
-
import type { BigIntish, MarketId } from "../../types";
|
|
4
|
-
import { CapacityLimitReason } from "../../utils";
|
|
5
|
-
import { VaultV2Adapter } from "./VaultV2Adapter";
|
|
6
|
-
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter";
|
|
2
|
+
import { type Market, MarketParams } from "../../market/index.js";
|
|
3
|
+
import type { BigIntish, MarketId } from "../../types.js";
|
|
4
|
+
import { CapacityLimitReason } from "../../utils.js";
|
|
5
|
+
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
6
|
+
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter.js";
|
|
7
7
|
export interface IVaultV2MorphoMarketV1AdapterV2 extends Omit<IVaultV2Adapter, "adapterId"> {
|
|
8
8
|
marketIds: MarketId[];
|
|
9
9
|
adaptiveCurveIrm: Address;
|
|
@@ -29,5 +29,5 @@ export declare class AccrualVaultV2MorphoMarketV1AdapterV2 extends VaultV2Morpho
|
|
|
29
29
|
value: bigint;
|
|
30
30
|
limiter: CapacityLimitReason;
|
|
31
31
|
};
|
|
32
|
-
maxWithdraw(data: Hex): import("../../utils").CapacityLimit;
|
|
32
|
+
maxWithdraw(data: Hex): import("../../utils.js").CapacityLimit;
|
|
33
33
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AccrualVaultV2MorphoMarketV1AdapterV2 = exports.VaultV2MorphoMarketV1AdapterV2 = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
class VaultV2MorphoMarketV1AdapterV2 extends
|
|
5
|
+
const index_js_1 = require("../../market/index.js");
|
|
6
|
+
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
const VaultV2Adapter_js_1 = require("./VaultV2Adapter.js");
|
|
8
|
+
class VaultV2MorphoMarketV1AdapterV2 extends VaultV2Adapter_js_1.VaultV2Adapter {
|
|
9
9
|
static adapterId(address) {
|
|
10
10
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
11
11
|
}
|
|
@@ -13,7 +13,7 @@ class VaultV2MorphoMarketV1AdapterV2 extends VaultV2Adapter_1.VaultV2Adapter {
|
|
|
13
13
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["collateralToken", address]));
|
|
14
14
|
}
|
|
15
15
|
static marketParamsId(address, params) {
|
|
16
|
-
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" },
|
|
16
|
+
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }, index_js_1.marketParamsAbi], ["this/marketParams", address, params]));
|
|
17
17
|
}
|
|
18
18
|
marketIds;
|
|
19
19
|
adaptiveCurveIrm;
|
|
@@ -51,17 +51,17 @@ class AccrualVaultV2MorphoMarketV1AdapterV2 extends VaultV2MorphoMarketV1Adapter
|
|
|
51
51
|
maxDeposit(_data, assets) {
|
|
52
52
|
return {
|
|
53
53
|
value: BigInt(assets),
|
|
54
|
-
limiter:
|
|
54
|
+
limiter: utils_js_1.CapacityLimitReason.balance,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
maxWithdraw(data) {
|
|
58
|
-
const marketId =
|
|
58
|
+
const marketId = index_js_1.MarketParams.fromHex(data).id;
|
|
59
59
|
const market = this.markets.find((market) => market.id === marketId);
|
|
60
60
|
return (market?.getWithdrawCapacityLimit({
|
|
61
61
|
supplyShares: this.supplyShares[marketId] ?? 0n,
|
|
62
62
|
}) ?? {
|
|
63
63
|
value: 0n,
|
|
64
|
-
limiter:
|
|
64
|
+
limiter: utils_js_1.CapacityLimitReason.position,
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Address, type Hex } from "viem";
|
|
2
|
-
import { VaultV2Adapter } from "./VaultV2Adapter";
|
|
2
|
+
import { VaultV2Adapter } from "./VaultV2Adapter.js";
|
|
3
3
|
export interface IVaultV2MorphoVaultV1Adapter extends Omit<IVaultV2Adapter, "adapterId"> {
|
|
4
4
|
morphoVaultV1: Address;
|
|
5
5
|
}
|
|
6
|
-
import type { BigIntish } from "../../types";
|
|
7
|
-
import type { AccrualVault } from "../Vault";
|
|
8
|
-
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter";
|
|
6
|
+
import type { BigIntish } from "../../types.js";
|
|
7
|
+
import type { AccrualVault } from "../Vault.js";
|
|
8
|
+
import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter.js";
|
|
9
9
|
export declare class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter implements IVaultV2MorphoVaultV1Adapter {
|
|
10
10
|
static adapterId(address: Address): `0x${string}`;
|
|
11
11
|
readonly morphoVaultV1: Address;
|
|
@@ -19,6 +19,6 @@ export declare class AccrualVaultV2MorphoVaultV1Adapter extends VaultV2MorphoVau
|
|
|
19
19
|
shares: bigint;
|
|
20
20
|
constructor(adapter: IAccrualVaultV2MorphoVaultV1Adapter, accrualVaultV1: AccrualVault, shares: bigint);
|
|
21
21
|
realAssets(timestamp?: BigIntish): bigint;
|
|
22
|
-
maxDeposit(_data: Hex, assets: BigIntish): import("
|
|
23
|
-
maxWithdraw(_data: Hex): import("
|
|
22
|
+
maxDeposit(_data: Hex, assets: BigIntish): import("../../utils.js").CapacityLimit;
|
|
23
|
+
maxWithdraw(_data: Hex): import("../../utils.js").CapacityLimit;
|
|
24
24
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AccrualVaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoVaultV1Adapter = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
|
-
const
|
|
6
|
-
class VaultV2MorphoVaultV1Adapter extends
|
|
5
|
+
const VaultV2Adapter_js_1 = require("./VaultV2Adapter.js");
|
|
6
|
+
class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter_js_1.VaultV2Adapter {
|
|
7
7
|
static adapterId(address) {
|
|
8
8
|
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)([{ type: "string" }, { type: "address" }], ["this", address]));
|
|
9
9
|
}
|