The payable address
is intended to use with Ethereum or the main coin whatever the network you are using. Quoted from the docs
If you need a variable of type address and plan to send Ether to it,
then declare its type as address payable to make this requirement
visible. Also, try to make this distinction or conversion as early as
possible.
At the second line, Solidity compiler cannot know whether the address is just an address
or payable address
,so the correct syntax as:
address payable owner = payable(address(0x11AEA62f1575d87a509d0e25b1060B06600842Fc));
I am guessing your intention with this code as: whether someone calls the withdraw
, certain account receives ethers from the contract's balance.
Actually at the third line, you've mixed parentheses with brackets. Correct syntax as:
owner.send( address(this).balance );
Just to note payable address
member function send
returns false when it fails for some reason, doesn't stop with an exception, docs states a warning about this;
There are some dangers in using send: The transfer fails if the call stack depth is at 1024 (this can always be forced by the caller) and it also fails if the recipient runs out of gas. So in order to make safe Ether transfers, always check the return value of send, use transfer or even better: use a pattern where the recipient withdraws the money.