OpenZeppelin ERC4626 implementation

Hello,

This might a very silly question but I am trying to use the ERC4626 in my contracts and I am getting the next error:

Contract "MyContract" should be marked as abstract.

The code is the next one:

//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.7;

import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol";

contract MyContract is ERC4626 {
    constructor(address _token) ERC4626(IERC20Metadata(_token)) {}
}

What I am missing?

I don't know which is the method that should be implemented to stop MyContract.sol being abstract so I can deploy it.

Thanks in advanced and apologise for the disturbance of such a probably newbie question :sweat_smile:

At the moment your contract does nothing so it is normal. try do implement some functions and you will see

You need to also initialize ERC20 in the constructor: constructor(address _token) ERC4626(IERC20Metadata(_token)) ERC20("name", "symbol") {}

1 Like

Hello @helio.rosa , @FreezyEx ,

It seems that the problem was that I didn't implement the constructor of ERC20 as @helio.rosa pointed out.

Thanks to both of you for such a prompt reply and helping me out in this newbie question.

Have a nice day!