TypeError: Cannot read property 'slice' of undefined

I encountered the same problem with the new version solc compiler.
My contract:

pragma solidity ^0.8.0;

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

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("MyToken", "MTK") {
        _mint(msg.sender, initialSupply);

My solc version: 0.8.2
Truffle v5.3.6 (core: 5.3.6)
Node v15.14.0


TypeError: Cannot read property 'slice' of undefined
    at convertJsFunctionToWasm....

Does anyone know what happens here?


1 Like

Hi, welcome! :wave:

There is a discussion about this error in the repo of Truffle,

And it seems like a problem of the compiler version, so maybe you can use a newer version, such as 0.8.4,

Hi @Skyge, thanks for your reply, it works!

1 Like