Rename ERC20TokenizedVault to ERC4626 (#3467)

This commit is contained in:
Hadrien Croubois
2022-06-14 11:39:01 +02:00
committed by GitHub
parent 5a0bff465d
commit a55b7d1372
5 changed files with 16 additions and 16 deletions

View File

@ -2,15 +2,15 @@
pragma solidity ^0.8.0;
import "../token/ERC20/extensions/ERC20TokenizedVault.sol";
import "../token/ERC20/extensions/ERC4626.sol";
// mock class using ERC20
contract ERC20TokenizedVaultMock is ERC20TokenizedVault {
contract ERC4626Mock is ERC4626 {
constructor(
IERC20Metadata asset,
string memory name,
string memory symbol
) ERC20(name, symbol) ERC20TokenizedVault(asset) {}
) ERC20(name, symbol) ERC4626(asset) {}
function mockMint(address account, uint256 amount) public {
_mint(account, amount);

View File

@ -24,7 +24,7 @@ Additionally there are multiple custom extensions, including:
* {ERC20Votes}: support for voting and vote delegation.
* {ERC20VotesComp}: support for voting and vote delegation (compatible with Compound's token, with uint96 restrictions).
* {ERC20Wrapper}: wrapper to create an ERC20 backed by another ERC20, with deposit and withdraw methods. Useful in conjunction with {ERC20Votes}.
* {ERC20TokenizedVault}: tokenized vault that manages shares (represented as ERC20) that are backed by assets (another ERC20).
* {ERC4626}: tokenized vault that manages shares (represented as ERC20) that are backed by assets (another ERC20).
Finally, there are some utilities to interact with ERC20 contracts in various ways.
@ -63,7 +63,7 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel
{{ERC20FlashMint}}
{{ERC20TokenizedVault}}
{{ERC4626}}
== Draft EIPs

View File

@ -18,7 +18,7 @@ import "../../../utils/math/Math.sol";
*
* _Available since v4.7._
*/
abstract contract ERC20TokenizedVault is ERC20, IERC4626 {
abstract contract ERC4626 is ERC20, IERC4626 {
using Math for uint256;
IERC20Metadata private immutable _asset;
@ -92,7 +92,7 @@ abstract contract ERC20TokenizedVault is ERC20, IERC4626 {
/** @dev See {IERC4262-deposit} */
function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {
require(assets <= maxDeposit(receiver), "ERC20TokenizedVault: deposit more than max");
require(assets <= maxDeposit(receiver), "ERC4626: deposit more than max");
uint256 shares = previewDeposit(assets);
_deposit(_msgSender(), receiver, assets, shares);
@ -102,7 +102,7 @@ abstract contract ERC20TokenizedVault is ERC20, IERC4626 {
/** @dev See {IERC4262-mint} */
function mint(uint256 shares, address receiver) public virtual override returns (uint256) {
require(shares <= maxMint(receiver), "ERC20TokenizedVault: mint more than max");
require(shares <= maxMint(receiver), "ERC4626: mint more than max");
uint256 assets = previewMint(shares);
_deposit(_msgSender(), receiver, assets, shares);
@ -116,7 +116,7 @@ abstract contract ERC20TokenizedVault is ERC20, IERC4626 {
address receiver,
address owner
) public virtual override returns (uint256) {
require(assets <= maxWithdraw(owner), "ERC20TokenizedVault: withdraw more than max");
require(assets <= maxWithdraw(owner), "ERC4626: withdraw more than max");
uint256 shares = previewWithdraw(assets);
_withdraw(_msgSender(), receiver, owner, assets, shares);
@ -130,7 +130,7 @@ abstract contract ERC20TokenizedVault is ERC20, IERC4626 {
address receiver,
address owner
) public virtual override returns (uint256) {
require(shares <= maxRedeem(owner), "ERC20TokenizedVault: redeem more than max");
require(shares <= maxRedeem(owner), "ERC4626: redeem more than max");
uint256 assets = previewRedeem(shares);
_withdraw(_msgSender(), receiver, owner, assets, shares);