Can't initialize ERC4626 contract

Hi everyone, I'm trying to implement the ERC4626 contract from OpenZeppelin but I can't understand what I'm doing wrong in the initialization of the contract. The code is as simple as:

  // SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.22;

import {ERC4626} from "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract StakingContract is ERC4626 {
    constructor(IERC20 _asset)
        ERC4626(_asset)
     {}
}

But the compiler is saying: No arguments passed to the base constructor. Specify the arguments or mark "StakingContract" as abstract.(3415)
And I don't get it since I'm calling the constuctor of ERC4626

IIRC, ERC4626 is derived from ERC20, so you should pass another two parameters name and symbol for ERC20. So maybe it should be

// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.22;

import {ERC4626, ERC20} from "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract StakingContract is ERC4626 {
    constructor(string memory _name, string memory _symbol, IERC20 _asset)
        ERC20(_name, _symbol)
        ERC4626(_asset)
     {}
}
1 Like