Rename rounding modes and complete with fourth (#4455)
Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
@ -119,12 +119,12 @@ abstract contract ERC4626 is ERC20, IERC4626 {
|
||||
|
||||
/** @dev See {IERC4626-convertToShares}. */
|
||||
function convertToShares(uint256 assets) public view virtual returns (uint256) {
|
||||
return _convertToShares(assets, Math.Rounding.Down);
|
||||
return _convertToShares(assets, Math.Rounding.Floor);
|
||||
}
|
||||
|
||||
/** @dev See {IERC4626-convertToAssets}. */
|
||||
function convertToAssets(uint256 shares) public view virtual returns (uint256) {
|
||||
return _convertToAssets(shares, Math.Rounding.Down);
|
||||
return _convertToAssets(shares, Math.Rounding.Floor);
|
||||
}
|
||||
|
||||
/** @dev See {IERC4626-maxDeposit}. */
|
||||
@ -139,7 +139,7 @@ abstract contract ERC4626 is ERC20, IERC4626 {
|
||||
|
||||
/** @dev See {IERC4626-maxWithdraw}. */
|
||||
function maxWithdraw(address owner) public view virtual returns (uint256) {
|
||||
return _convertToAssets(balanceOf(owner), Math.Rounding.Down);
|
||||
return _convertToAssets(balanceOf(owner), Math.Rounding.Floor);
|
||||
}
|
||||
|
||||
/** @dev See {IERC4626-maxRedeem}. */
|
||||
@ -149,22 +149,22 @@ abstract contract ERC4626 is ERC20, IERC4626 {
|
||||
|
||||
/** @dev See {IERC4626-previewDeposit}. */
|
||||
function previewDeposit(uint256 assets) public view virtual returns (uint256) {
|
||||
return _convertToShares(assets, Math.Rounding.Down);
|
||||
return _convertToShares(assets, Math.Rounding.Floor);
|
||||
}
|
||||
|
||||
/** @dev See {IERC4626-previewMint}. */
|
||||
function previewMint(uint256 shares) public view virtual returns (uint256) {
|
||||
return _convertToAssets(shares, Math.Rounding.Up);
|
||||
return _convertToAssets(shares, Math.Rounding.Ceil);
|
||||
}
|
||||
|
||||
/** @dev See {IERC4626-previewWithdraw}. */
|
||||
function previewWithdraw(uint256 assets) public view virtual returns (uint256) {
|
||||
return _convertToShares(assets, Math.Rounding.Up);
|
||||
return _convertToShares(assets, Math.Rounding.Ceil);
|
||||
}
|
||||
|
||||
/** @dev See {IERC4626-previewRedeem}. */
|
||||
function previewRedeem(uint256 shares) public view virtual returns (uint256) {
|
||||
return _convertToAssets(shares, Math.Rounding.Down);
|
||||
return _convertToAssets(shares, Math.Rounding.Floor);
|
||||
}
|
||||
|
||||
/** @dev See {IERC4626-deposit}. */
|
||||
|
||||
Reference in New Issue
Block a user