TypeError: Cannot read property 'slice' of undefined

Hello,
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

Error:

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

Does anyone know what happens here?

Thanks!

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,

2 Likes

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

1 Like

Change version of what exactly?

Hey thanks. it worked. i was using version 0.8.13 but it was returning typerror then i used your suggestion and it worked perfectly

1 Like