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);

marked as duplicate by Rosco Kalis, Achala Dissanayake, shane, Ismael, Richard Horrocks Jan 31 at 21:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Why can't you just use destinationAddress.transfer(amount);? – sp4c3 Jan 31 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 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.

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