In older solidity compilers this code snippet works. In newer compilers, I get an error. Can someone what I need to change so it works again? I get the following error message: "Type contract createWallet is not implicitly convertible to expected type address. I extracted the snippet so it is easier to see my problem.

contract factorywallet { 

   function newWallet(uint256 _unlockDate) public returns(address wallet){
        wallet = new createWallet(msg.sender);

contract createWallet{
    address public owner;

    constructor(address _owner) public {
        owner = _owner;

1 Answer 1


You can just use an explicit cast:

wallet = address(new createWallet(msg.sender));
  • Shouldn't that be address(new createWallet(mag.sender))? Jan 5, 2019 at 8:47
  • That's better, yes. Edited. (Both work.)
    – user19510
    Jan 5, 2019 at 8:54
  • Cool, didn't know the first way of casting worked as well Jan 5, 2019 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.