当我尝试使用ERC20Capped
来自 OpenZeppelin 4的构造函数内部进行铸造时
contract SomeERC20 is ERC20Capped {
constructor (
string memory name,
string memory symbol,
uint256 cap,
uint256 initialBalance
)
ERC20(name, symbol)
ERC20Capped(cap)
{
_mint(_msgSender(), initialBalance);
}
}
错误
Immutable variables cannot be read during contract creation time, which means they cannot be read in the constructor or any function or modifier called from it
出现。
我应该怎么办?