August 2019
Intermediate to advanced
486 pages
13h 52m
English
The developers must know that there are two types of transfer() functions. Developers should not be confused with this and use the required functions when needed.
One is used on the address data types to transfer the ether to that address from the contract, as in the following example:
uint amount = 1 ether; //Could be any amount to transferaddress(toAddress).transfer(amount);
The preceding call would transfer 1 ETH from the contract to toAddress. One thing to note is that, before Solidity version 0.5.0, the recipient address should be defined just as an address data type. However, since 0.5.0 version onwards, an address receiving ETH must be defined as address payable.
The second ...