@@ -14,6 +14,7 @@ import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
1414import {ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol " ;
1515import {IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol " ;
1616import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol " ;
17+ import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol " ;
1718import {Math} from "@openzeppelin/contracts/utils/math/Math.sol " ;
1819import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol " ;
1920
@@ -32,7 +33,7 @@ import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
3233/// - External Rebalancing: Exposes a external rebalance() function to adjust LTV, preserve 100% net collateral
3334/// exposure, maximize yield spread, and keep the position clear of liquidation thresholds.
3435/// - ERC-4626 Tokenized Vault: Yield is auto-compounded directly into share price appreciation.
35- contract FCMVault is IFCMVault , ERC20 , Ownable2Step , IMorphoFlashLoanCallback {
36+ contract FCMVault is IFCMVault , ERC20 , Ownable2Step , ReentrancyGuard , IMorphoFlashLoanCallback {
3637 using SafeERC20 for IERC20 ;
3738 using Math for uint256 ;
3839 using MorphoLib for IMorpho;
@@ -228,19 +229,19 @@ contract FCMVault is IFCMVault, ERC20, Ownable2Step, IMorphoFlashLoanCallback {
228229 }
229230
230231 /// @inheritdoc IFCMVault
231- function accrueFees () external {
232+ function accrueFees () external nonReentrant {
232233 _accrueFees ();
233234 }
234235
235236 /// @inheritdoc IFCMVault
236- function rebalance () external logsVaultState {
237+ function rebalance () external nonReentrant logsVaultState {
237238 require (! emergencyRecovered, EmergencyRecoveryActive ());
238239 _accrueFees ();
239240 _adjustLeverage ();
240241 }
241242
242243 /// @inheritdoc IFCMVault
243- function harvest (uint256 maximumYield ) external notInRecovery logsVaultState {
244+ function harvest (uint256 maximumYield ) external nonReentrant notInRecovery logsVaultState {
244245 _accrueFees ();
245246 _harvest (maximumYield);
246247 }
@@ -291,6 +292,7 @@ contract FCMVault is IFCMVault, ERC20, Ownable2Step, IMorphoFlashLoanCallback {
291292 function deposit (uint256 assets , address receiver )
292293 external
293294 override
295+ nonReentrant
294296 notInRecovery
295297 logsVaultState
296298 returns (uint256 shares )
@@ -332,6 +334,7 @@ contract FCMVault is IFCMVault, ERC20, Ownable2Step, IMorphoFlashLoanCallback {
332334 function redeem (uint256 shares , address receiver , address owner )
333335 external
334336 override
337+ nonReentrant
335338 logsVaultState
336339 returns (uint256 assets )
337340 {
@@ -357,6 +360,7 @@ contract FCMVault is IFCMVault, ERC20, Ownable2Step, IMorphoFlashLoanCallback {
357360 /// @inheritdoc IFCMVault
358361 function redeemInKind (uint256 shares , address receiver , address owner )
359362 external
363+ nonReentrant
360364 logsVaultState
361365 returns (uint256 collateralOut , uint256 yieldOut )
362366 {
0 commit comments