@harvest-finance/harvest-strategy-arbitrum 0.0.1-security → 1.0.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.

Potentially problematic release.


This version of @harvest-finance/harvest-strategy-arbitrum might be problematic. Click here for more details.

Files changed (199) hide show
  1. package/README.md +127 -5
  2. package/contracts/base/Controller.sol +358 -0
  3. package/contracts/base/Drip.sol +86 -0
  4. package/contracts/base/PotPool.sol +367 -0
  5. package/contracts/base/ProfitSharingReceiver.sol +38 -0
  6. package/contracts/base/Reader.sol +54 -0
  7. package/contracts/base/RewardForwarder.sol +109 -0
  8. package/contracts/base/VaultProxy.sol +34 -0
  9. package/contracts/base/VaultStorage.sol +205 -0
  10. package/contracts/base/VaultV1.sol +371 -0
  11. package/contracts/base/VaultV1GMX.sol +465 -0
  12. package/contracts/base/VaultV2.sol +111 -0
  13. package/contracts/base/VaultV2GMX.sol +111 -0
  14. package/contracts/base/factory/MegaFactory.sol +120 -0
  15. package/contracts/base/factory/interface/IPoolFactory.sol +6 -0
  16. package/contracts/base/factory/interface/IStrategyFactory.sol +6 -0
  17. package/contracts/base/factory/interface/IVaultFactory.sol +7 -0
  18. package/contracts/base/factory/pool/PotPoolFactory.sol +41 -0
  19. package/contracts/base/factory/strategy/UpgradableStrategyFactory.sol +19 -0
  20. package/contracts/base/factory/vault/RegularVaultFactory.sol +34 -0
  21. package/contracts/base/incentives/GlobalIncentivesExecutor.sol +85 -0
  22. package/contracts/base/incentives/GlobalIncentivesHelper.sol +174 -0
  23. package/contracts/base/incentives/NotifyHelperGeneric.sol +61 -0
  24. package/contracts/base/incentives/NotifyHelperStateful.sol +290 -0
  25. package/contracts/base/incentives/ViewerNotifyHelperStateful.sol +25 -0
  26. package/contracts/base/inheritance/Controllable.sol +25 -0
  27. package/contracts/base/inheritance/ControllableInit.sol +30 -0
  28. package/contracts/base/inheritance/Governable.sol +28 -0
  29. package/contracts/base/inheritance/GovernableInit.sol +50 -0
  30. package/contracts/base/inheritance/IUpgradeSource.sol +7 -0
  31. package/contracts/base/inheritance/OwnableWhitelist.sol +17 -0
  32. package/contracts/base/inheritance/Storage.sol +35 -0
  33. package/contracts/base/interface/IBalDex.sol +7 -0
  34. package/contracts/base/interface/IController.sol +132 -0
  35. package/contracts/base/interface/IDex.sol +9 -0
  36. package/contracts/base/interface/IERC4626.sol +261 -0
  37. package/contracts/base/interface/IGMXStrategy.sol +37 -0
  38. package/contracts/base/interface/IGlobalIncentivesHelper.sol +6 -0
  39. package/contracts/base/interface/IPotPool.sol +70 -0
  40. package/contracts/base/interface/IProfitSharingReceiver.sol +9 -0
  41. package/contracts/base/interface/IRewardForwarder.sol +57 -0
  42. package/contracts/base/interface/IStrategy.sol +37 -0
  43. package/contracts/base/interface/IUniversalLiquidator.sol +21 -0
  44. package/contracts/base/interface/IUniversalLiquidatorRegistry.sol +20 -0
  45. package/contracts/base/interface/IUpgradeSource.sol +9 -0
  46. package/contracts/base/interface/IVault.sol +58 -0
  47. package/contracts/base/interface/IVaultGMX.sol +71 -0
  48. package/contracts/base/interface/aura/IAuraBaseRewardPool.sol +25 -0
  49. package/contracts/base/interface/aura/IAuraBooster.sol +17 -0
  50. package/contracts/base/interface/aura/IAuraDepositor.sol +7 -0
  51. package/contracts/base/interface/balancer/Gauge.sol +22 -0
  52. package/contracts/base/interface/balancer/IBVault.sol +580 -0
  53. package/contracts/base/interface/balancer/IBalancerMinter.sol +114 -0
  54. package/contracts/base/interface/balancer/IGyroPool.sol +7 -0
  55. package/contracts/base/interface/balancer/linearPool/ILinearPool.sol +184 -0
  56. package/contracts/base/interface/balancer/linearPool/ILinearPoolFactory.sol +16 -0
  57. package/contracts/base/interface/balancer/linearPool/ILinearPoolRebalancer.sol +8 -0
  58. package/contracts/base/interface/balancer/linearPool/IPoolSwapStructs.sol +56 -0
  59. package/contracts/base/interface/compound/CTokenInterface.sol +29 -0
  60. package/contracts/base/interface/compound/IComptroller.sol +9 -0
  61. package/contracts/base/interface/dolomite/IDepositWithdraw.sol +13 -0
  62. package/contracts/base/interface/dolomite/IDolomiteMargin.sol +15 -0
  63. package/contracts/base/interface/dolomite/IRewardsDistributor.sol +11 -0
  64. package/contracts/base/interface/gamma/IClearing.sol +7 -0
  65. package/contracts/base/interface/gamma/IHypervisor.sol +9 -0
  66. package/contracts/base/interface/gamma/IUniProxy.sol +14 -0
  67. package/contracts/base/interface/gmx/EventUtils.sol +253 -0
  68. package/contracts/base/interface/gmx/ICallbackReceiver.sol +119 -0
  69. package/contracts/base/interface/gmx/IDataStore.sol +7 -0
  70. package/contracts/base/interface/gmx/IExchangeRouter.sol +38 -0
  71. package/contracts/base/interface/gmx/IGMXViewer.sol +7 -0
  72. package/contracts/base/interface/gmx/IHandler.sol +12 -0
  73. package/contracts/base/interface/gmx/IMarket.sol +7 -0
  74. package/contracts/base/interface/gmx/IOracle.sol +6 -0
  75. package/contracts/base/interface/gmx/IPriceFeed.sol +12 -0
  76. package/contracts/base/interface/gmx/IReader.sol +49 -0
  77. package/contracts/base/interface/gmx/IRoleStore.sol +6 -0
  78. package/contracts/base/interface/ipor/Errors.sol +20 -0
  79. package/contracts/base/interface/ipor/FuseStorageLib.sol +71 -0
  80. package/contracts/base/interface/ipor/FusesLib.sol +149 -0
  81. package/contracts/base/interface/ipor/IFuseCommon.sol +9 -0
  82. package/contracts/base/interface/ipor/IFuseInstantWithdraw.sol +14 -0
  83. package/contracts/base/interface/ipor/IMarketBalanceFuse.sol +10 -0
  84. package/contracts/base/interface/ipor/IPriceOracleMiddleware.sol +42 -0
  85. package/contracts/base/interface/ipor/IporMath.sol +110 -0
  86. package/contracts/base/interface/ipor/PlasmaVaultConfigLib.sol +106 -0
  87. package/contracts/base/interface/ipor/PlasmaVaultLib.sol +293 -0
  88. package/contracts/base/interface/ipor/PlasmaVaultStorageLib.sol +352 -0
  89. package/contracts/base/interface/merkl/IDistributor.sol +6 -0
  90. package/contracts/base/interface/notional/INProxy.sol +44 -0
  91. package/contracts/base/interface/notional/IPrimeToken.sol +6 -0
  92. package/contracts/base/interface/venus/IRewardsDistributor.sol +6 -0
  93. package/contracts/base/interface/weth/IWETH.sol +39 -0
  94. package/contracts/base/ipor/Erc4626BalanceFuse.sol +54 -0
  95. package/contracts/base/ipor/Erc4626SupplyFuse.sol +134 -0
  96. package/contracts/base/noop/NoopStrategyUpgradeable.sol +90 -0
  97. package/contracts/base/upgradability/BaseUpgradeabilityProxy.sol +60 -0
  98. package/contracts/base/upgradability/BaseUpgradeableStrategy.sol +144 -0
  99. package/contracts/base/upgradability/BaseUpgradeableStrategyStorage.sol +284 -0
  100. package/contracts/base/upgradability/IUpgradable.sol +7 -0
  101. package/contracts/base/upgradability/ReentrancyGuardUpgradeable.sol +51 -0
  102. package/contracts/base/upgradability/StrategyProxy.sol +34 -0
  103. package/contracts/strategies/aura/AuraStrategy.sol +403 -0
  104. package/contracts/strategies/aura/AuraStrategyMainnet_MORE_GYD.sol +32 -0
  105. package/contracts/strategies/aura/AuraStrategyMainnet_sUSDe_GYD.sol +31 -0
  106. package/contracts/strategies/aura/AuraStrategyMainnet_waFRAX_sFRAX.sol +31 -0
  107. package/contracts/strategies/aura/AuraStrategyMainnet_waGHO_GYD.sol +31 -0
  108. package/contracts/strategies/aura/AuraStrategyMainnet_waUSDC_GHO.sol +32 -0
  109. package/contracts/strategies/aura/AuraStrategyMainnet_waUSDC_GYD.sol +31 -0
  110. package/contracts/strategies/aura/AuraStrategyMainnet_waUSDT_GYD.sol +31 -0
  111. package/contracts/strategies/aura/AuraStrategyMainnet_wstETH_GYD.sol +31 -0
  112. package/contracts/strategies/camelot/CamelotV3Strategy.sol +304 -0
  113. package/contracts/strategies/camelot/CamelotV3StrategyMainnet_ARB_USDC.sol +28 -0
  114. package/contracts/strategies/camelot/CamelotV3StrategyMainnet_ETH_USDC.sol +28 -0
  115. package/contracts/strategies/camelot/CamelotV3StrategyMainnet_ETH_USDT.sol +28 -0
  116. package/contracts/strategies/camelot/CamelotV3StrategyMainnet_GMX_ETH.sol +28 -0
  117. package/contracts/strategies/camelot/CamelotV3StrategyMainnet_GRAIL_ETH.sol +28 -0
  118. package/contracts/strategies/camelot/CamelotV3StrategyMainnet_USDC_USDT.sol +28 -0
  119. package/contracts/strategies/camelot/CamelotV3StrategyMainnet_WBTC_ETH.sol +28 -0
  120. package/contracts/strategies/dolomite/DolomiteLendStrategy.sol +273 -0
  121. package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_DAI.sol +26 -0
  122. package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_GMX.sol +26 -0
  123. package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_USDC.sol +26 -0
  124. package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_USDCe.sol +26 -0
  125. package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_USDT.sol +26 -0
  126. package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_WBTC.sol +26 -0
  127. package/contracts/strategies/dolomite/DolomiteLendStrategyMainnet_WETH.sol +26 -0
  128. package/contracts/strategies/fluid/FluidLendStrategy.sol +241 -0
  129. package/contracts/strategies/fluid/FluidLendStrategyMainnet_ETH.sol +25 -0
  130. package/contracts/strategies/fluid/FluidLendStrategyMainnet_USDC.sol +25 -0
  131. package/contracts/strategies/fluid/FluidLendStrategyMainnet_USDT.sol +25 -0
  132. package/contracts/strategies/gmx/GMXStrategy.sol +472 -0
  133. package/contracts/strategies/gmx/GMXStrategyMainnet_WBTC.sol +25 -0
  134. package/contracts/strategies/gmx/GMXViewer.sol +110 -0
  135. package/contracts/strategies/notional/NotionalStrategy.sol +223 -0
  136. package/contracts/strategies/notional/NotionalStrategyMainnet_nETH.sol +27 -0
  137. package/contracts/strategies/notional/NotionalStrategyMainnet_nUSDC.sol +27 -0
  138. package/contracts/strategies/notional/NotionalStrategyMainnet_nUSDT.sol +27 -0
  139. package/contracts/strategies/notional/NotionalStrategyMainnet_nwstETH.sol +27 -0
  140. package/contracts/strategies/venus/VenusFoldStrategy.sol +591 -0
  141. package/contracts/strategies/venus/VenusFoldStrategyMainnet_ARB.sol +32 -0
  142. package/contracts/strategies/venus/VenusFoldStrategyMainnet_ETH_core.sol +32 -0
  143. package/contracts/strategies/venus/VenusFoldStrategyMainnet_ETH_lsd.sol +32 -0
  144. package/contracts/strategies/venus/VenusFoldStrategyMainnet_USDC.sol +32 -0
  145. package/contracts/strategies/venus/VenusFoldStrategyMainnet_USDT.sol +32 -0
  146. package/contracts/strategies/venus/VenusFoldStrategyMainnet_WBTC.sol +32 -0
  147. package/hardhat.config.js +60 -0
  148. package/index.js +42 -0
  149. package/package.json +38 -6
  150. package/scripts/01-deploy-vault-regular-with-upgradable-strategy.js +41 -0
  151. package/scripts/02-deploy-vault-regular.js +35 -0
  152. package/scripts/03-deploy-upgradable-strategy.js +40 -0
  153. package/scripts/04-deploy-new-implementation.js +24 -0
  154. package/scripts/05-deploy-GMXViewer.js +17 -0
  155. package/scripts/06-deploy-GMXVault.js +49 -0
  156. package/scripts/07-deploy-ipor-fuses.js +29 -0
  157. package/scripts/08-deploy-drip.js +20 -0
  158. package/scripts/README.md +55 -0
  159. package/scripts/utils.js +22 -0
  160. package/test/aura/more-gyd.js +140 -0
  161. package/test/aura/susde-gyd.js +140 -0
  162. package/test/aura/wafrax-sfrax.js +140 -0
  163. package/test/aura/wagho-gyd.js +140 -0
  164. package/test/aura/wausdc-gho.js +141 -0
  165. package/test/aura/wausdc-gyd.js +140 -0
  166. package/test/aura/wausdt-gyd.js +140 -0
  167. package/test/aura/wsteth-gyd.js +138 -0
  168. package/test/camelot/arb-usdc.js +125 -0
  169. package/test/camelot/eth-usdc.js +125 -0
  170. package/test/camelot/eth-usdt.js +125 -0
  171. package/test/camelot/gmx-eth.js +125 -0
  172. package/test/camelot/grail-eth.js +125 -0
  173. package/test/camelot/usdc-usdt.js +125 -0
  174. package/test/camelot/wbtc-eth.js +125 -0
  175. package/test/dolomite/dai.js +127 -0
  176. package/test/dolomite/gmx.js +134 -0
  177. package/test/dolomite/usdc.js +127 -0
  178. package/test/dolomite/usdce.js +127 -0
  179. package/test/dolomite/usdt.js +127 -0
  180. package/test/dolomite/wbtc.js +127 -0
  181. package/test/dolomite/weth.js +127 -0
  182. package/test/fluid/eth.js +127 -0
  183. package/test/fluid/usdc.js +134 -0
  184. package/test/fluid/usdt.js +134 -0
  185. package/test/gmx/wbtc.js +184 -0
  186. package/test/notional/neth.js +133 -0
  187. package/test/notional/nusdc.js +133 -0
  188. package/test/notional/nusdt.js +133 -0
  189. package/test/notional/nwsteth.js +133 -0
  190. package/test/test-config.js +28 -0
  191. package/test/utilities/Utils.js +96 -0
  192. package/test/utilities/hh-utils.js +248 -0
  193. package/test/utilities/make-vault.js +16 -0
  194. package/test/venus/arb.js +135 -0
  195. package/test/venus/eth-core.js +133 -0
  196. package/test/venus/eth-lsd.js +133 -0
  197. package/test/venus/usdc.js +133 -0
  198. package/test/venus/usdt.js +133 -0
  199. package/test/venus/wbtc.js +133 -0
@@ -0,0 +1,293 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ pragma solidity 0.8.26;
3
+
4
+ import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
5
+ import {Errors} from "./Errors.sol";
6
+ import {PlasmaVaultStorageLib} from "./PlasmaVaultStorageLib.sol";
7
+ import {FusesLib} from "./FusesLib.sol";
8
+
9
+ /// @notice Technical struct used to pass parameters in the `updateInstantWithdrawalFuses` function
10
+ struct InstantWithdrawalFusesParamsStruct {
11
+ /// @notice The address of the fuse
12
+ address fuse;
13
+ /// @notice The parameters of the fuse, first element is an amount, second element is an address of the asset or a market id or other substrate specific for the fuse
14
+ /// @dev Notice! Always first param is the asset value in underlying, next params are specific for the Fuse
15
+ bytes32[] params;
16
+ }
17
+
18
+ /// @title Plasma Vault Library responsible for managing the Plasma Vault
19
+ library PlasmaVaultLib {
20
+ using SafeCast for uint256;
21
+ using SafeCast for int256;
22
+
23
+ /// @dev Hard CAP for the performance fee in percentage - 50%
24
+ uint256 public constant PERFORMANCE_MAX_FEE_IN_PERCENTAGE = 5000;
25
+
26
+ /// @dev Hard CAP for the management fee in percentage - 5%
27
+ uint256 public constant MANAGEMENT_MAX_FEE_IN_PERCENTAGE = 500;
28
+
29
+ /// @dev The offset for the underlying asset decimals in the Plasma Vault
30
+ uint8 public constant DECIMALS_OFFSET = 2;
31
+
32
+ error InvalidPerformanceFee(uint256 feeInPercentage);
33
+ error InvalidManagementFee(uint256 feeInPercentage);
34
+
35
+ event InstantWithdrawalFusesConfigured(InstantWithdrawalFusesParamsStruct[] fuses);
36
+ event PriceOracleMiddlewareChanged(address newPriceOracleMiddleware);
37
+ event PerformanceFeeDataConfigured(address feeAccount, uint256 feeInPercentage);
38
+ event ManagementFeeDataConfigured(address feeAccount, uint256 feeInPercentage);
39
+ event RewardsClaimManagerAddressChanged(address newRewardsClaimManagerAddress);
40
+ event DependencyBalanceGraphChanged(uint256 marketId, uint256[] newDependenceGraph);
41
+ event WithdrawManagerChanged(address newWithdrawManager);
42
+
43
+ /// @notice Gets the total assets in the vault for all markets
44
+ /// @return The total assets in the vault for all markets, represented in decimals of the underlying asset
45
+ //solhint-disable-next-line
46
+ function getTotalAssetsInAllMarkets() internal view returns (uint256) {
47
+ return PlasmaVaultStorageLib.getTotalAssets().value;
48
+ }
49
+
50
+ /// @notice Gets the total assets in the vault for a specific market
51
+ /// @param marketId_ The market id
52
+ /// @return The total assets in the vault for the market, represented in decimals of the underlying asset
53
+ //solhint-disable-next-line
54
+ function getTotalAssetsInMarket(uint256 marketId_) internal view returns (uint256) {
55
+ return PlasmaVaultStorageLib.getMarketTotalAssets().value[marketId_];
56
+ }
57
+
58
+ /// @notice Gets the dependency balance graph for a specific market
59
+ /// @param marketId_ The market id
60
+ /// @return The dependency balance graph for the market
61
+ /// @dev The dependency balance graph is used to update appropriate balance markets when Plasma Vault interact with a given marketId_
62
+ function getDependencyBalanceGraph(uint256 marketId_) internal view returns (uint256[] memory) {
63
+ return PlasmaVaultStorageLib.getDependencyBalanceGraph().dependencyGraph[marketId_];
64
+ }
65
+
66
+ /// @notice Updates the dependency balance graph for a specific market
67
+ /// @param marketId_ The market id
68
+ /// @param newDependenceGraph_ The new dependency balance graph for the market
69
+ function updateDependencyBalanceGraph(uint256 marketId_, uint256[] memory newDependenceGraph_) internal {
70
+ PlasmaVaultStorageLib.getDependencyBalanceGraph().dependencyGraph[marketId_] = newDependenceGraph_;
71
+ emit DependencyBalanceGraphChanged(marketId_, newDependenceGraph_);
72
+ }
73
+
74
+ /// @notice Adds an amount to the total assets in the Plasma Vault for all markets
75
+ /// @param amount_ The amount to add, represented in decimals of the underlying asset
76
+ function addToTotalAssetsInAllMarkets(int256 amount_) internal {
77
+ if (amount_ < 0) {
78
+ PlasmaVaultStorageLib.getTotalAssets().value -= (-amount_).toUint256();
79
+ } else {
80
+ PlasmaVaultStorageLib.getTotalAssets().value += amount_.toUint256();
81
+ }
82
+ }
83
+
84
+ /// @notice Updates the total assets in the Plasma Vault for a specific market
85
+ /// @param marketId_ The market id
86
+ /// @param newTotalAssetsInUnderlying_ The new total assets in the vault for the market, represented in decimals of the underlying asset
87
+ /// @return deltaInUnderlying The difference between the old and the new total assets in the vault for the market
88
+ function updateTotalAssetsInMarket(
89
+ uint256 marketId_,
90
+ uint256 newTotalAssetsInUnderlying_
91
+ ) internal returns (int256 deltaInUnderlying) {
92
+ uint256 oldTotalAssetsInUnderlying = PlasmaVaultStorageLib.getMarketTotalAssets().value[marketId_];
93
+ PlasmaVaultStorageLib.getMarketTotalAssets().value[marketId_] = newTotalAssetsInUnderlying_;
94
+ deltaInUnderlying = newTotalAssetsInUnderlying_.toInt256() - oldTotalAssetsInUnderlying.toInt256();
95
+ }
96
+
97
+ /// @notice Gets the management fee data
98
+ /// @return managementFeeData The management fee data, like the fee manager and the fee in percentage
99
+ //solhint-disable-next-line
100
+ function getManagementFeeData()
101
+ internal
102
+ view
103
+ returns (PlasmaVaultStorageLib.ManagementFeeData memory managementFeeData)
104
+ {
105
+ return PlasmaVaultStorageLib.getManagementFeeData();
106
+ }
107
+
108
+ /// @notice Configures the management fee data like the fee manager and the fee in percentage
109
+ /// @param feeAccount_ The address of the fee manager responsible for managing the management fee
110
+ /// @param feeInPercentage_ The fee in percentage, represented in 2 decimals, example: 100% = 10000, 1% = 100, 0.01% = 1
111
+ function configureManagementFee(address feeAccount_, uint256 feeInPercentage_) internal {
112
+ if (feeAccount_ == address(0)) {
113
+ revert Errors.WrongAddress();
114
+ }
115
+ if (feeInPercentage_ > MANAGEMENT_MAX_FEE_IN_PERCENTAGE) {
116
+ revert InvalidManagementFee(feeInPercentage_);
117
+ }
118
+
119
+ PlasmaVaultStorageLib.ManagementFeeData storage managementFeeData = PlasmaVaultStorageLib
120
+ .getManagementFeeData();
121
+
122
+ managementFeeData.feeAccount = feeAccount_;
123
+ managementFeeData.feeInPercentage = feeInPercentage_.toUint16();
124
+
125
+ emit ManagementFeeDataConfigured(feeAccount_, feeInPercentage_);
126
+ }
127
+
128
+ /// @notice Gets the performance fee data
129
+ /// @return performanceFeeData The performance fee data, like the fee manager and the fee in percentage
130
+ //solhint-disable-next-line
131
+ function getPerformanceFeeData()
132
+ internal
133
+ view
134
+ returns (PlasmaVaultStorageLib.PerformanceFeeData memory performanceFeeData)
135
+ {
136
+ return PlasmaVaultStorageLib.getPerformanceFeeData();
137
+ }
138
+
139
+ /// @notice Configures the performance fee data like the fee manager and the fee in percentage
140
+ /// @param feeAccount_ The address of the fee manager responsible for managing the performance fee
141
+ /// @param feeInPercentage_ The fee in percentage, represented in 2 decimals, example: 100% = 10000, 1% = 100, 0.01% = 1
142
+ function configurePerformanceFee(address feeAccount_, uint256 feeInPercentage_) internal {
143
+ if (feeAccount_ == address(0)) {
144
+ revert Errors.WrongAddress();
145
+ }
146
+ if (feeInPercentage_ > PERFORMANCE_MAX_FEE_IN_PERCENTAGE) {
147
+ revert InvalidPerformanceFee(feeInPercentage_);
148
+ }
149
+
150
+ PlasmaVaultStorageLib.PerformanceFeeData storage performanceFeeData = PlasmaVaultStorageLib
151
+ .getPerformanceFeeData();
152
+
153
+ performanceFeeData.feeAccount = feeAccount_;
154
+ performanceFeeData.feeInPercentage = feeInPercentage_.toUint16();
155
+
156
+ emit PerformanceFeeDataConfigured(feeAccount_, feeInPercentage_);
157
+ }
158
+
159
+ /// @notice Updates the management fee data with the current timestamp
160
+ /// @dev lastUpdateTimestamp is used to calculate unrealized management fees
161
+ function updateManagementFeeData() internal {
162
+ PlasmaVaultStorageLib.ManagementFeeData storage feeData = PlasmaVaultStorageLib.getManagementFeeData();
163
+ feeData.lastUpdateTimestamp = block.timestamp.toUint32();
164
+ }
165
+
166
+ /// @notice Gets instant withdrawal fuses
167
+ /// @return The instant withdrawal fuses, the order of the fuses is important
168
+ function getInstantWithdrawalFuses() internal view returns (address[] memory) {
169
+ return PlasmaVaultStorageLib.getInstantWithdrawalFusesArray().value;
170
+ }
171
+
172
+ /// @notice Gets the instant withdrawal fuses parameters for a specific fuse
173
+ /// @param fuse_ The fuse address
174
+ /// @param index_ The index of the Fuse in the fuses array
175
+ /// @return The instant withdrawal fuses parameters
176
+ function getInstantWithdrawalFusesParams(address fuse_, uint256 index_) internal view returns (bytes32[] memory) {
177
+ return
178
+ PlasmaVaultStorageLib.getInstantWithdrawalFusesParams().value[keccak256(abi.encodePacked(fuse_, index_))];
179
+ }
180
+
181
+ /// @notice Configures order of the instant withdrawal fuses. Order of the fuse is important, as it will be used in the same order during the instant withdrawal process
182
+ /// @param fuses_ The fuses to configure
183
+ /// @dev Order of the fuses is important, the same fuse can be used multiple times with different parameters (for example different assets, markets or any other substrate specific for the fuse)
184
+ function configureInstantWithdrawalFuses(InstantWithdrawalFusesParamsStruct[] calldata fuses_) internal {
185
+ address[] memory fusesList = new address[](fuses_.length);
186
+
187
+ PlasmaVaultStorageLib.InstantWithdrawalFusesParams storage instantWithdrawalFusesParams = PlasmaVaultStorageLib
188
+ .getInstantWithdrawalFusesParams();
189
+
190
+ bytes32 key;
191
+
192
+ for (uint256 i; i < fuses_.length; ++i) {
193
+ if (!FusesLib.isFuseSupported(fuses_[i].fuse)) {
194
+ revert FusesLib.FuseUnsupported(fuses_[i].fuse);
195
+ }
196
+
197
+ fusesList[i] = fuses_[i].fuse;
198
+ key = keccak256(abi.encodePacked(fuses_[i].fuse, i));
199
+
200
+ delete instantWithdrawalFusesParams.value[key];
201
+
202
+ for (uint256 j; j < fuses_[i].params.length; ++j) {
203
+ instantWithdrawalFusesParams.value[key].push(fuses_[i].params[j]);
204
+ }
205
+ }
206
+
207
+ delete PlasmaVaultStorageLib.getInstantWithdrawalFusesArray().value;
208
+
209
+ PlasmaVaultStorageLib.getInstantWithdrawalFusesArray().value = fusesList;
210
+
211
+ emit InstantWithdrawalFusesConfigured(fuses_);
212
+ }
213
+
214
+ /// @notice Gets the Price Oracle Middleware address
215
+ /// @return The Price Oracle Middleware address
216
+ function getPriceOracleMiddleware() internal view returns (address) {
217
+ return PlasmaVaultStorageLib.getPriceOracleMiddleware().value;
218
+ }
219
+
220
+ /// @notice Sets the Price Oracle Middleware address
221
+ /// @param priceOracleMiddleware_ The Price Oracle Middleware address
222
+ function setPriceOracleMiddleware(address priceOracleMiddleware_) internal {
223
+ PlasmaVaultStorageLib.getPriceOracleMiddleware().value = priceOracleMiddleware_;
224
+ emit PriceOracleMiddlewareChanged(priceOracleMiddleware_);
225
+ }
226
+
227
+ /// @notice Gets the Rewards Claim Manager address
228
+ /// @return The Rewards Claim Manager address
229
+ function getRewardsClaimManagerAddress() internal view returns (address) {
230
+ return PlasmaVaultStorageLib.getRewardsClaimManagerAddress().value;
231
+ }
232
+
233
+ /// @notice Sets the Rewards Claim Manager address
234
+ /// @param rewardsClaimManagerAddress_ The rewards claim manager address
235
+ function setRewardsClaimManagerAddress(address rewardsClaimManagerAddress_) internal {
236
+ PlasmaVaultStorageLib.getRewardsClaimManagerAddress().value = rewardsClaimManagerAddress_;
237
+ emit RewardsClaimManagerAddressChanged(rewardsClaimManagerAddress_);
238
+ }
239
+
240
+ /// @notice Gets the total supply cap
241
+ /// @return The total supply cap, represented in decimals of the underlying asset
242
+ function getTotalSupplyCap() internal view returns (uint256) {
243
+ return PlasmaVaultStorageLib.getERC20CappedStorage().cap;
244
+ }
245
+
246
+ /// @notice Sets the total supply cap
247
+ /// @param cap_ The total supply cap, represented in decimals of the underlying asset
248
+ function setTotalSupplyCap(uint256 cap_) internal {
249
+ if (cap_ == 0) {
250
+ revert Errors.WrongValue();
251
+ }
252
+ PlasmaVaultStorageLib.getERC20CappedStorage().cap = cap_;
253
+ }
254
+
255
+ /// @notice Sets the total supply cap validation
256
+ /// @param flag_ The total supply cap validation flag
257
+ /// @dev 1 - no validation, 0 - validation, total supply validation cap is disabled when performance fee or management fee is minted.
258
+ /// By default, the total supply cap validation is enabled (flag_ = 0)
259
+ function setTotalSupplyCapValidation(uint256 flag_) internal {
260
+ PlasmaVaultStorageLib.getERC20CappedValidationFlag().value = flag_;
261
+ }
262
+
263
+ /// @notice Checks if the total supply cap validation is enabled
264
+ /// @return true if the total supply cap validation is enabled, false otherwise
265
+ function isTotalSupplyCapValidationEnabled() internal view returns (bool) {
266
+ return PlasmaVaultStorageLib.getERC20CappedValidationFlag().value == 0;
267
+ }
268
+
269
+ /// @notice Sets the execution state to started, used in the execute function called by Alpha
270
+ /// @dev Alpha can do interaction with the Plasma Vault using more than one FuseAction
271
+ function executeStarted() internal {
272
+ PlasmaVaultStorageLib.getExecutionState().value = 1;
273
+ }
274
+
275
+ /// @notice Sets the execution state to finished, used in the execute function called by Alpha
276
+ /// @dev Alpha can do interaction with the Plasma Vault using more than one FuseAction
277
+ function executeFinished() internal {
278
+ PlasmaVaultStorageLib.getExecutionState().value = 0;
279
+ }
280
+
281
+ /// @notice Checks if the execution is started
282
+ /// @return true if the execution is started
283
+ function isExecutionStarted() internal view returns (bool) {
284
+ return PlasmaVaultStorageLib.getExecutionState().value == 1;
285
+ }
286
+
287
+ /// @notice Updates the Withdraw Manager address. If the address is zero, it means that scheduled withdrawals are turned off.
288
+ function updateWithdrawManager(address newWithdrawManager_) internal {
289
+ PlasmaVaultStorageLib.getWithdrawManager().manager = newWithdrawManager_;
290
+
291
+ emit WithdrawManagerChanged(newWithdrawManager_);
292
+ }
293
+ }
@@ -0,0 +1,352 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
2
+ pragma solidity 0.8.26;
3
+
4
+ /// @title Library responsible for managing access to the storage of the PlasmaVault contract using the ERC-7201 standard
5
+ library PlasmaVaultStorageLib {
6
+ /// @dev value taken from ERC4626 contract, don't change it!
7
+ // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC4626")) - 1)) & ~bytes32(uint256(0xff))
8
+ bytes32 private constant ERC4626_STORAGE_LOCATION =
9
+ 0x0773e532dfede91f04b12a73d3d2acd361424f41f76b4fb79f090161e36b4e00;
10
+
11
+ /// @dev value taken from ERC20CappedUpgradeable contract, don't change it!
12
+ // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20Capped")) - 1)) & ~bytes32(uint256(0xff))
13
+ bytes32 private constant ERC20_CAPPED_STORAGE_LOCATION =
14
+ 0x0f070392f17d5f958cc1ac31867dabecfc5c9758b4a419a200803226d7155d00;
15
+
16
+ /// @dev storage pointer location for a flag which indicates if the Total Supply Cap validation is enabled
17
+ // keccak256(abi.encode(uint256(keccak256("io.ipor.Erc20CappedValidationFlag")) - 1)) & ~bytes32(uint256(0xff))
18
+ bytes32 private constant ERC20_CAPPED_VALIDATION_FLAG =
19
+ 0xaef487a7a52e82ae7bbc470b42be72a1d3c066fb83773bf99cce7e6a7df2f900;
20
+
21
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.PlasmaVaultTotalAssetsInAllMarkets")) - 1)) & ~bytes32(uint256(0xff));
22
+ bytes32 private constant PLASMA_VAULT_TOTAL_ASSETS_IN_ALL_MARKETS =
23
+ 0x24e02552e88772b8e8fd15f3e6699ba530635ffc6b52322da922b0b497a77300;
24
+
25
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.PlasmaVaultTotalAssetsInMarket")) - 1)) & ~bytes32(uint256(0xff));
26
+ bytes32 private constant PLASMA_VAULT_TOTAL_ASSETS_IN_MARKET =
27
+ 0x656f5ca8c676f20b936e991a840e1130bdd664385322f33b6642ec86729ee600;
28
+
29
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.CfgPlasmaVaultMarketSubstrates")) - 1)) & ~bytes32(uint256(0xff));
30
+ bytes32 private constant CFG_PLASMA_VAULT_MARKET_SUBSTRATES =
31
+ 0x78e40624004925a4ef6749756748b1deddc674477302d5b7fe18e5335cde3900;
32
+
33
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.CfgPlasmaVaultBalanceFuses")) - 1)) & ~bytes32(uint256(0xff));
34
+ bytes32 private constant CFG_PLASMA_VAULT_BALANCE_FUSES =
35
+ 0x150144dd6af711bac4392499881ec6649090601bd196a5ece5174c1400b1f700;
36
+
37
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.CfgPlasmaVaultInstantWithdrawalFusesArray")) - 1)) & ~bytes32(uint256(0xff));
38
+ bytes32 private constant CFG_PLASMA_VAULT_INSTANT_WITHDRAWAL_FUSES_ARRAY =
39
+ 0xd243afa3da07e6bdec20fdd573a17f99411aa8a62ae64ca2c426d3a86ae0ac00;
40
+
41
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.PriceOracleMiddleware")) - 1)) & ~bytes32(uint256(0xff));
42
+ bytes32 private constant PRICE_ORACLE_MIDDLEWARE =
43
+ 0x0d761ae54d86fc3be4f1f2b44ade677efb1c84a85fc6bb1d087dc42f1e319a00;
44
+
45
+ /// @notice Every fuse has a list of parameters used for instant withdrawal
46
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.CfgPlasmaVaultInstantWithdrawalFusesParams")) - 1)) & ~bytes32(uint256(0xff));
47
+ bytes32 private constant CFG_PLASMA_VAULT_INSTANT_WITHDRAWAL_FUSES_PARAMS =
48
+ 0x45a704819a9dcb1bb5b8cff129eda642cf0e926a9ef104e27aa53f1d1fa47b00;
49
+
50
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.CfgPlasmaVaultFeeConfig")) - 1)) & ~bytes32(uint256(0xff));
51
+ bytes32 private constant CFG_PLASMA_VAULT_FEE_CONFIG =
52
+ 0x78b5ce597bdb64d5aa30a201c7580beefe408ff13963b5d5f3dce2dc09e89c00;
53
+
54
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.PlasmaVaultPerformanceFeeData")) - 1)) & ~bytes32(uint256(0xff));
55
+ bytes32 private constant PLASMA_VAULT_PERFORMANCE_FEE_DATA =
56
+ 0x9399757a27831a6cfb6cf4cd5c97a908a2f8f41e95a5952fbf83a04e05288400;
57
+
58
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.PlasmaVaultManagementFeeData")) - 1)) & ~bytes32(uint256(0xff));
59
+ bytes32 private constant PLASMA_VAULT_MANAGEMENT_FEE_DATA =
60
+ 0x239dd7e43331d2af55e2a25a6908f3bcec2957025f1459db97dcdc37c0003f00;
61
+
62
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.RewardsClaimManagerAddress")) - 1)) & ~bytes32(uint256(0xff));
63
+ bytes32 private constant REWARDS_CLAIM_MANAGER_ADDRESS =
64
+ 0x08c469289c3f85d9b575f3ae9be6831541ff770a06ea135aa343a4de7c962d00;
65
+
66
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.MarketLimits")) - 1)) & ~bytes32(uint256(0xff));
67
+ bytes32 private constant MARKET_LIMITS = 0xc2733c187287f795e2e6e84d35552a190e774125367241c3e99e955f4babf000;
68
+
69
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.DependencyBalanceGraph")) - 1)) & ~bytes32(uint256(0xff));
70
+ bytes32 private constant DEPENDENCY_BALANCE_GRAPH =
71
+ 0x82411e549329f2815579116a6c5e60bff72686c93ab5dba4d06242cfaf968900;
72
+
73
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.executeRunning")) - 1)) & ~bytes32(uint256(0xff));
74
+ bytes32 private constant EXECUTE_RUNNING = 0x054644eb87255c1c6a2d10801735f52fa3b9d6e4477dbed74914d03844ab6600;
75
+
76
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.callbackHandler")) - 1)) & ~bytes32(uint256(0xff));
77
+ bytes32 private constant CALLBACK_HANDLER = 0xb37e8684757599da669b8aea811ee2b3693b2582d2c730fab3f4965fa2ec3e00;
78
+
79
+ /// @dev keccak256(abi.encode(uint256(keccak256("io.ipor.WithdrawManager")) - 1)) & ~bytes32(uint256(0xff));
80
+ bytes32 private constant WITHDRAW_MANAGER = 0xb37e8684757599da669b8aea811ee2b3693b2582d2c730fab3f4965fa2ec3e11;
81
+
82
+ /// @dev Value taken from ERC20VotesUpgradeable contract, don't change it!
83
+ /// @custom:storage-location erc7201:openzeppelin.storage.ERC4626
84
+ struct ERC4626Storage {
85
+ /// @dev underlying asset in Plasma Vault
86
+ address asset;
87
+ /// @dev underlying asset decimals in Plasma Vault
88
+ uint8 underlyingDecimals;
89
+ }
90
+
91
+ /// @dev Value taken from ERC20VotesUpgradeable contract, don't change it!
92
+ /// @custom:storage-location erc7201:openzeppelin.storage.ERC20Capped
93
+ struct ERC20CappedStorage {
94
+ uint256 cap;
95
+ }
96
+
97
+ /// @notice ERC20CappedValidationFlag is used to enable or disable the total supply cap validation during execution
98
+ /// Required for situation when performance fee or management fee is minted for fee managers
99
+ /// @custom:storage-location erc7201:io.ipor.Erc20CappedValidationFlag
100
+ struct ERC20CappedValidationFlag {
101
+ uint256 value;
102
+ }
103
+
104
+ /// @custom:storage-location erc7201:io.ipor.RewardsClaimManagerAddress
105
+ struct RewardsClaimManagerAddress {
106
+ /// @dev total assets in the Plasma Vault
107
+ address value;
108
+ }
109
+
110
+ /// @custom:storage-location erc7201:io.ipor.PlasmaVaultTotalAssetsInAllMarkets
111
+ struct TotalAssets {
112
+ /// @dev total assets in the Plasma Vault
113
+ uint256 value;
114
+ }
115
+
116
+ /// @custom:storage-location erc7201:io.ipor.PlasmaVaultTotalAssetsInMarket
117
+ struct MarketTotalAssets {
118
+ /// @dev marketId => total assets in the vault in the market
119
+ mapping(uint256 => uint256) value;
120
+ }
121
+
122
+ /// @notice Market Substrates configuration
123
+ /// @dev Substrate - abstract item in the market, could be asset or sub market in the external protocol, it could be any item required to calculate balance in the market
124
+ struct MarketSubstratesStruct {
125
+ /// @notice Define which substrates are allowed and supported in the market
126
+ /// @dev key can be specific asset or sub market in a specific external protocol (market), value - 1 - granted, otherwise - not granted
127
+ mapping(bytes32 => uint256) substrateAllowances;
128
+ /// @dev it could be list of assets or sub markets in a specific protocol or any other ids required to calculate balance in the market (external protocol)
129
+ bytes32[] substrates;
130
+ }
131
+
132
+ /// @custom:storage-location erc7201:io.ipor.CfgPlasmaVaultMarketSubstrates
133
+ struct MarketSubstrates {
134
+ /// @dev marketId => MarketSubstratesStruct
135
+ mapping(uint256 => MarketSubstratesStruct) value;
136
+ }
137
+
138
+ /// @custom:storage-location erc7201:io.ipor.CfgPlasmaVaultBalanceFuses
139
+ struct BalanceFuses {
140
+ /// @dev marketId => balance fuse address
141
+ mapping(uint256 => address) value;
142
+ }
143
+
144
+ /// @custom:storage-location erc7201:io.ipor.BalanceDependenceGraph
145
+ struct DependencyBalanceGraph {
146
+ mapping(uint256 marketId => uint256[] marketIds) dependencyGraph;
147
+ }
148
+
149
+ /// @custom:storage-location erc7201:io.ipor.callbackHandler
150
+ struct CallbackHandler {
151
+ /// @dev key: keccak256(abi.encodePacked(sender, sig)), value: handler address
152
+ mapping(bytes32 key => address handler) callbackHandler;
153
+ }
154
+
155
+ /// @custom:storage-location erc7201:io.ipor.CfgPlasmaVaultInstantWithdrawalFusesArray
156
+ struct InstantWithdrawalFuses {
157
+ /// @dev value is a Fuse address used for instant withdrawal
158
+ address[] value;
159
+ }
160
+
161
+ /// @custom:storage-location erc7201:io.ipor.CfgPlasmaVaultInstantWithdrawalFusesParams
162
+ struct InstantWithdrawalFusesParams {
163
+ /// @dev key: fuse address and index in InstantWithdrawalFuses array, value: list of parameters used for instant withdrawal
164
+ /// @dev first param always amount in underlying asset of PlasmaVault, second and next params are specific for the fuse and market
165
+ mapping(bytes32 => bytes32[]) value;
166
+ }
167
+
168
+ /// @custom:storage-location erc7201:io.ipor.PlasmaVaultPerformanceFeeData
169
+ struct PerformanceFeeData {
170
+ address feeAccount;
171
+ uint16 feeInPercentage;
172
+ }
173
+
174
+ /// @custom:storage-location erc7201:io.ipor.PlasmaVaultManagementFeeData
175
+ struct ManagementFeeData {
176
+ address feeAccount;
177
+ uint16 feeInPercentage;
178
+ uint32 lastUpdateTimestamp;
179
+ }
180
+
181
+ /// @custom:storage-location erc7201:io.ipor.PriceOracleMiddleware
182
+ struct PriceOracleMiddleware {
183
+ address value;
184
+ }
185
+
186
+ /// @custom:storage-location erc7201:io.ipor.executeRunning
187
+ struct ExecuteState {
188
+ uint256 value;
189
+ }
190
+
191
+ /// @custom:storage-location erc7201:io.ipor.WithdrawManager
192
+ struct WithdrawManager {
193
+ address manager;
194
+ }
195
+
196
+ /// @dev limit is percentage of total assets in the market in 18 decimals, 1e18 is 100%
197
+ /// @deb if limit for zero marketId is greater than 0, then limits are activated
198
+ /// @custom:storage-location erc7201:io.ipor.MarketLimits
199
+ struct MarketLimits {
200
+ mapping(uint256 marketId => uint256 limit) limitInPercentage;
201
+ }
202
+
203
+ function getERC4626Storage() internal pure returns (ERC4626Storage storage $) {
204
+ assembly {
205
+ $.slot := ERC4626_STORAGE_LOCATION
206
+ }
207
+ }
208
+
209
+ function getERC20CappedStorage() internal pure returns (ERC20CappedStorage storage $) {
210
+ assembly {
211
+ $.slot := ERC20_CAPPED_STORAGE_LOCATION
212
+ }
213
+ }
214
+
215
+ function getERC20CappedValidationFlag() internal pure returns (ERC20CappedValidationFlag storage $) {
216
+ assembly {
217
+ $.slot := ERC20_CAPPED_VALIDATION_FLAG
218
+ }
219
+ }
220
+
221
+ /// @notice Gets the total assets storage pointer
222
+ /// @return totalAssets storage pointer
223
+ function getTotalAssets() internal pure returns (TotalAssets storage totalAssets) {
224
+ assembly {
225
+ totalAssets.slot := PLASMA_VAULT_TOTAL_ASSETS_IN_ALL_MARKETS
226
+ }
227
+ }
228
+
229
+ /// @notice Gets execution state storage pointer
230
+ /// @return executeRunning storage pointer
231
+ function getExecutionState() internal pure returns (ExecuteState storage executeRunning) {
232
+ assembly {
233
+ executeRunning.slot := EXECUTE_RUNNING
234
+ }
235
+ }
236
+
237
+ /// @notice Gets the callback handler storage pointer
238
+ /// @return handler storage pointer
239
+ function getCallbackHandler() internal pure returns (CallbackHandler storage handler) {
240
+ assembly {
241
+ handler.slot := CALLBACK_HANDLER
242
+ }
243
+ }
244
+
245
+ /// @notice Gets the dependency balance graph storage pointer
246
+ /// @return dependencyBalanceGraph storage pointer
247
+ function getDependencyBalanceGraph() internal pure returns (DependencyBalanceGraph storage dependencyBalanceGraph) {
248
+ assembly {
249
+ dependencyBalanceGraph.slot := DEPENDENCY_BALANCE_GRAPH
250
+ }
251
+ }
252
+
253
+ /// @notice Gets the market total assets storage pointer
254
+ /// @return marketTotalAssets storage pointer
255
+ function getMarketTotalAssets() internal pure returns (MarketTotalAssets storage marketTotalAssets) {
256
+ assembly {
257
+ marketTotalAssets.slot := PLASMA_VAULT_TOTAL_ASSETS_IN_MARKET
258
+ }
259
+ }
260
+
261
+ /// @notice Gets the market substrates storage pointer
262
+ /// @return marketSubstrates storage pointer
263
+ function getMarketSubstrates() internal pure returns (MarketSubstrates storage marketSubstrates) {
264
+ assembly {
265
+ marketSubstrates.slot := CFG_PLASMA_VAULT_MARKET_SUBSTRATES
266
+ }
267
+ }
268
+
269
+ /// @notice Gets the balance fuses storage pointer
270
+ /// @return balanceFuses storage pointer
271
+ function getBalanceFuses() internal pure returns (BalanceFuses storage balanceFuses) {
272
+ assembly {
273
+ balanceFuses.slot := CFG_PLASMA_VAULT_BALANCE_FUSES
274
+ }
275
+ }
276
+
277
+ /// @notice Gets the instant withdrawal fuses storage pointer
278
+ /// @return instantWithdrawalFuses storage pointer
279
+ function getInstantWithdrawalFusesArray()
280
+ internal
281
+ pure
282
+ returns (InstantWithdrawalFuses storage instantWithdrawalFuses)
283
+ {
284
+ assembly {
285
+ instantWithdrawalFuses.slot := CFG_PLASMA_VAULT_INSTANT_WITHDRAWAL_FUSES_ARRAY
286
+ }
287
+ }
288
+
289
+ /// @notice Gets the instant withdrawal fuses params storage pointer
290
+ /// @return instantWithdrawalFusesParams storage pointer
291
+ function getInstantWithdrawalFusesParams()
292
+ internal
293
+ pure
294
+ returns (InstantWithdrawalFusesParams storage instantWithdrawalFusesParams)
295
+ {
296
+ assembly {
297
+ instantWithdrawalFusesParams.slot := CFG_PLASMA_VAULT_INSTANT_WITHDRAWAL_FUSES_PARAMS
298
+ }
299
+ }
300
+
301
+ /// @notice Gets the PriceOracleMiddleware storage pointer
302
+ /// @return oracle storage pointer
303
+ function getPriceOracleMiddleware() internal pure returns (PriceOracleMiddleware storage oracle) {
304
+ assembly {
305
+ oracle.slot := PRICE_ORACLE_MIDDLEWARE
306
+ }
307
+ }
308
+
309
+ /// @notice Gets performance fee config storage pointer
310
+ /// @return performanceFeeData storage pointer
311
+ function getPerformanceFeeData() internal pure returns (PerformanceFeeData storage performanceFeeData) {
312
+ assembly {
313
+ performanceFeeData.slot := PLASMA_VAULT_PERFORMANCE_FEE_DATA
314
+ }
315
+ }
316
+
317
+ /// @notice Gets management fee config storage pointer
318
+ /// @return managementFeeData storage pointer
319
+ function getManagementFeeData() internal pure returns (ManagementFeeData storage managementFeeData) {
320
+ assembly {
321
+ managementFeeData.slot := PLASMA_VAULT_MANAGEMENT_FEE_DATA
322
+ }
323
+ }
324
+
325
+ /// @notice Gets the Rewards Claim Manager address storage pointer
326
+ /// @return rewardsClaimManagerAddress storage pointer
327
+ function getRewardsClaimManagerAddress()
328
+ internal
329
+ pure
330
+ returns (RewardsClaimManagerAddress storage rewardsClaimManagerAddress)
331
+ {
332
+ assembly {
333
+ rewardsClaimManagerAddress.slot := REWARDS_CLAIM_MANAGER_ADDRESS
334
+ }
335
+ }
336
+
337
+ /// @notice Gets the MarketLimits storage pointer
338
+ /// @return marketLimits storage pointer
339
+ function getMarketsLimits() internal pure returns (MarketLimits storage marketLimits) {
340
+ assembly {
341
+ marketLimits.slot := MARKET_LIMITS
342
+ }
343
+ }
344
+
345
+ /// @notice Gets the WithdrawManager storage pointer
346
+ /// @return withdrawManager storage pointer
347
+ function getWithdrawManager() internal pure returns (WithdrawManager storage withdrawManager) {
348
+ assembly {
349
+ withdrawManager.slot := WITHDRAW_MANAGER
350
+ }
351
+ }
352
+ }
@@ -0,0 +1,6 @@
1
+ //SPDX-License-Identifier: Unlicense
2
+ pragma solidity 0.8.26;
3
+
4
+ interface IDistributor {
5
+ function toggleOperator(address user, address operator) external;
6
+ }