@@ -85,7 +85,7 @@ abstract contract VaultCore is VaultInitializer {
8585 }
8686
8787 // Mint oTokens
88- oUSD .mint (msg .sender , scaledAmount);
88+ oToken .mint (msg .sender , scaledAmount);
8989
9090 IERC20 (asset).safeTransferFrom (msg .sender , address (this ), _amount);
9191
@@ -129,14 +129,13 @@ abstract contract VaultCore is VaultInitializer {
129129
130130 emit Mint (msg .sender , _amount);
131131 // Mint matching amount of OTokens
132- oUSD .mint (msg .sender , _amount);
132+ oToken .mint (msg .sender , _amount);
133133 }
134134
135135 /**
136136 * @notice Burn OTokens for an allowed Strategy
137137 * @param _amount Amount of OToken to burn
138138 *
139- * Todo: Maybe this is a comment that we can remove now?
140139 * @dev Notice: can't use `nonReentrant` modifier since the `redeem` function could
141140 * require withdrawal on an AMO strategy and that one can call `burnForStrategy`
142141 * while the execution of the `redeem` has not yet completed -> causing a `nonReentrant` collision.
@@ -163,7 +162,7 @@ abstract contract VaultCore is VaultInitializer {
163162 emit Redeem (msg .sender , _amount);
164163
165164 // Burn OTokens
166- oUSD .burn (msg .sender , _amount);
165+ oToken .burn (msg .sender , _amount);
167166 }
168167
169168 ////////////////////////////////////////////////////
@@ -215,7 +214,7 @@ abstract contract VaultCore is VaultInitializer {
215214 });
216215
217216 // Burn the user's OToken
218- oUSD .burn (msg .sender , _amount);
217+ oToken .burn (msg .sender , _amount);
219218
220219 // Prevent withdrawal if the vault is solvent by more than the allowed percentage
221220 _postRedeem (_amount);
@@ -362,7 +361,7 @@ abstract contract VaultCore is VaultInitializer {
362361
363362 // Allow a max difference of maxSupplyDiff% between
364363 // asset value and OUSD total supply
365- uint256 diff = oUSD .totalSupply ().divPrecisely (totalUnits);
364+ uint256 diff = oToken .totalSupply ().divPrecisely (totalUnits);
366365 require (
367366 (diff > 1e18 ? diff - 1e18 : 1e18 - diff) <= maxSupplyDiff,
368367 "Backing supply liquidity error "
@@ -396,7 +395,7 @@ abstract contract VaultCore is VaultInitializer {
396395 if (assetAvailableInVault == 0 ) return ;
397396
398397 // Calculate the target buffer for the vault using the total supply
399- uint256 totalSupply = oUSD .totalSupply ();
398+ uint256 totalSupply = oToken .totalSupply ();
400399 // Scaled to asset decimals
401400 uint256 targetBuffer = totalSupply.mulTruncate (vaultBuffer).scaleBy (
402401 assetDecimals,
@@ -432,7 +431,7 @@ abstract contract VaultCore is VaultInitializer {
432431 * @return totalUnits Total balance of Vault in units
433432 */
434433 function _rebase () internal whenNotRebasePaused returns (uint256 ) {
435- uint256 supply = oUSD .totalSupply ();
434+ uint256 supply = oToken .totalSupply ();
436435 uint256 vaultValue = _totalValue ();
437436 // If no supply yet, do not rebase
438437 if (supply == 0 ) {
@@ -457,15 +456,15 @@ abstract contract VaultCore is VaultInitializer {
457456 fee = (yield * trusteeFeeBps) / 1e4 ;
458457 if (fee > 0 ) {
459458 require (fee < yield, "Fee must not be greater than yield " );
460- oUSD .mint (_trusteeAddress, fee);
459+ oToken .mint (_trusteeAddress, fee);
461460 }
462461 }
463462 emit YieldDistribution (_trusteeAddress, yield, fee);
464463
465464 // Only ratchet OToken supply upwards
466465 // Final check uses latest totalSupply
467- if (newSupply > oUSD .totalSupply ()) {
468- oUSD .changeSupply (newSupply);
466+ if (newSupply > oToken .totalSupply ()) {
467+ oToken .changeSupply (newSupply);
469468 }
470469 return vaultValue;
471470 }
@@ -476,17 +475,22 @@ abstract contract VaultCore is VaultInitializer {
476475 * @return yield amount of expected yield
477476 */
478477 function previewYield () external view returns (uint256 yield ) {
479- (yield, ) = _nextYield (oUSD .totalSupply (), _totalValue ());
478+ (yield, ) = _nextYield (oToken .totalSupply (), _totalValue ());
480479 return yield;
481480 }
482481
482+ /**
483+ * @dev Calculates the amount that would rebase at next rebase.
484+ * See this Readme for detailed explanation:
485+ * contracts/contracts/vault/README - Yield Limits.md
486+ */
483487 function _nextYield (uint256 supply , uint256 vaultValue )
484488 internal
485489 view
486490 virtual
487491 returns (uint256 yield , uint256 targetRate )
488492 {
489- uint256 nonRebasing = oUSD .nonRebasingSupply ();
493+ uint256 nonRebasing = oToken .nonRebasingSupply ();
490494 uint256 rebasing = supply - nonRebasing;
491495 uint256 elapsed = block .timestamp - lastRebase;
492496 targetRate = rebasePerSecondTarget;
0 commit comments