0

I'm getting error here :: "send" and "transfer" are only available for objects of type "address payable", not "address".

    function pickWinner() public{
    uint index = random() % players.length;

   players[index].transfer(address(this).balance);     //error
0

1 Answer 1

0

In solidity there are 2 types of address: address and address payable. They are define diferently. For example,

 address public _firstKindOfAddress;
 address payable public _secondKindOfAddress;

If you want to transfer ether (or any other native coin) to some address, you must use the second option, address payable.

0

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