1

I am trying to convert an address to payable address but I'm not able to do it. please find my code below:

address a = destinationAddress;
address dest =  address(uint160(a));
dest.transfer(amount);
2
  • Why can't you just use destinationAddress.transfer(amount);?
    – sp4c3
    Commented Jan 31, 2019 at 9:39
  • I tried it first but i got same error in which destination address must be of type 'address payable' datatype and now i want my destination address to payable. Commented Jan 31, 2019 at 9:52

1 Answer 1

1

You must be using solidity 0.5 or above compiler, just declare destinationAddress as payable : address payable destinationAddress, then you can directly use destinationAddress.transfer(amount);.

Also check this for more breaking changes.

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