@@ -79,11 +79,6 @@ abstract contract VaultCore is VaultInitializer {
7979
8080 emit Mint (msg .sender , scaledAmount);
8181
82- // Rebase must happen before any transfers occur.
83- if (! rebasePaused && scaledAmount >= rebaseThreshold) {
84- _rebase ();
85- }
86-
8782 // Mint oTokens
8883 oToken.mint (msg .sender , scaledAmount);
8984
@@ -218,7 +213,7 @@ abstract contract VaultCore is VaultInitializer {
218213 oToken.burn (msg .sender , _amount);
219214
220215 // Prevent withdrawal if the vault is solvent by more than the allowed percentage
221- _postRedeem (_amount );
216+ _postRedeem ();
222217
223218 emit WithdrawalRequested (msg .sender , requestId, _amount, queued);
224219 }
@@ -262,7 +257,7 @@ abstract contract VaultCore is VaultInitializer {
262257 IERC20 (asset).safeTransfer (msg .sender , amount);
263258
264259 // Prevent insolvency
265- _postRedeem (amount. scaleBy ( 18 , assetDecimals) );
260+ _postRedeem ();
266261 }
267262
268263 // slither-disable-end reentrancy-no-eth
@@ -303,7 +298,7 @@ abstract contract VaultCore is VaultInitializer {
303298 IERC20 (asset).safeTransfer (msg .sender , totalAmount);
304299
305300 // Prevent insolvency
306- _postRedeem (totalAmount. scaleBy ( 18 , assetDecimals) );
301+ _postRedeem ();
307302
308303 return (amounts, totalAmount);
309304 }
@@ -341,17 +336,12 @@ abstract contract VaultCore is VaultInitializer {
341336 return StableMath.scaleBy (request.amount, assetDecimals, 18 );
342337 }
343338
344- function _postRedeem (uint256 _amount ) internal {
339+ function _postRedeem () internal view {
345340 // Until we can prove that we won't affect the prices of our asset
346341 // by withdrawing them, this should be here.
347342 // It's possible that a strategy was off on its asset total, perhaps
348343 // a reward token sold for more or for less than anticipated.
349- uint256 totalUnits = 0 ;
350- if (_amount >= rebaseThreshold && ! rebasePaused) {
351- totalUnits = _rebase ();
352- } else {
353- totalUnits = _totalValue ();
354- }
344+ uint256 totalUnits = _totalValue ();
355345
356346 // Check that the OTokens are backed by enough asset
357347 if (maxSupplyDiff > 0 ) {
@@ -420,8 +410,15 @@ abstract contract VaultCore is VaultInitializer {
420410 /**
421411 * @notice Calculate the total value of asset held by the Vault and all
422412 * strategies and update the supply of OTokens.
413+ * @dev Restricted to the Operator, Strategist or Governor.
423414 */
424415 function rebase () external virtual nonReentrant {
416+ require (
417+ msg .sender == operatorAddr ||
418+ msg .sender == strategistAddr ||
419+ isGovernor (),
420+ "Caller not authorized "
421+ );
425422 _rebase ();
426423 }
427424
0 commit comments