Browse Source

Rename `_isVaultCollateralized` to `_isVaultHealthy` for clarity (#3796)

Hadrien Croubois 2 years ago
parent
commit
d5ca39e9a2
1 changed files with 7 additions and 7 deletions
  1. 7 7
      contracts/token/ERC20/extensions/ERC4626.sol

+ 7 - 7
contracts/token/ERC20/extensions/ERC4626.sol

@@ -75,18 +75,18 @@ abstract contract ERC4626 is ERC20, IERC4626 {
     }
 
     /** @dev See {IERC4626-convertToShares}. */
-    function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {
+    function convertToShares(uint256 assets) public view virtual override returns (uint256) {
         return _convertToShares(assets, Math.Rounding.Down);
     }
 
     /** @dev See {IERC4626-convertToAssets}. */
-    function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {
+    function convertToAssets(uint256 shares) public view virtual override returns (uint256) {
         return _convertToAssets(shares, Math.Rounding.Down);
     }
 
     /** @dev See {IERC4626-maxDeposit}. */
     function maxDeposit(address) public view virtual override returns (uint256) {
-        return _isVaultCollateralized() ? type(uint256).max : 0;
+        return _isVaultHealthy() ? type(uint256).max : 0;
     }
 
     /** @dev See {IERC4626-maxMint}. */
@@ -178,7 +178,7 @@ abstract contract ERC4626 is ERC20, IERC4626 {
      * Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset
      * would represent an infinite amount of shares.
      */
-    function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256 shares) {
+    function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256) {
         uint256 supply = totalSupply();
         return
             (assets == 0 || supply == 0)
@@ -201,7 +201,7 @@ abstract contract ERC4626 is ERC20, IERC4626 {
     /**
      * @dev Internal conversion function (from shares to assets) with support for rounding direction.
      */
-    function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256 assets) {
+    function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256) {
         uint256 supply = totalSupply();
         return
             (supply == 0) ? _initialConvertToAssets(shares, rounding) : shares.mulDiv(totalAssets(), supply, rounding);
@@ -215,7 +215,7 @@ abstract contract ERC4626 is ERC20, IERC4626 {
     function _initialConvertToAssets(
         uint256 shares,
         Math.Rounding /*rounding*/
-    ) internal view virtual returns (uint256 assets) {
+    ) internal view virtual returns (uint256) {
         return shares;
     }
 
@@ -267,7 +267,7 @@ abstract contract ERC4626 is ERC20, IERC4626 {
         emit Withdraw(caller, receiver, owner, assets, shares);
     }
 
-    function _isVaultCollateralized() private view returns (bool) {
+    function _isVaultHealthy() private view returns (bool) {
         return totalAssets() > 0 || totalSupply() == 0;
     }
 }