0

I am using this code for implementing Forwarder in my Contract.

contract Forward {

  address public destinationAddress;
  event LogForwarded(address indexed sender, uint amount);
  event LogFlushed(address indexed sender, uint amount);

  constructor() public {
    destinationAddress = msg.sender;
  }

  function() payable public {
    emit LogForwarded(msg.sender, msg.value);
    destinationAddress.transfer(msg.value);
  }

  function flush() public {
    emit LogFlushed(msg.sender, address(this).balance);
    destinationAddress.transfer(address(this).balance);
  }

}

But it's showing me some errors as I am using Compiler 0.6.0 and this code is of 0.4.23 and I am not able to convert it to latest version. Can someone help me with it?

Here is a preview of the error:

enter image description here

2

1 Answer 1

1

Changing address public destinationAddress; to address payable public destinationAddress; worked for me.

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.