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);
  • Why can't you just use destinationAddress.transfer(amount);? – sp4c3 Jan 31 '19 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. – Prasanth A S Jan 31 '19 at 9:52
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.

| improve this answer | |

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