I take the course from lynda.com "Ethereum: Building Blockchain Decentralized Apps (DApps)" but i can't follow the instructor, so I can't compiling my contract

pragma solidity ^0.5.0;

contract ApprovalContract {
    address payable public sender;
    address payable public receiver;
    address public constant approver = 0x3999BA5D247c800E5Ef3d4de66618741E3675379 ;

function deposit(address _receiver) external payable {

    require (msg.value > 0);
    sender = msg.sender;
    receiver = _receiver;   

function viewApprover () external pure returns(address) {

function approve() external {
        require(msg.sender == approver);


Here the picture from cmd, please help !!

enter image description here


Should be

function deposit(address payable _receiver) external payable {

From Solidity documentation:

The address type comes in two flavours, which are largely identical:

address: Holds a 20 byte value (size of an Ethereum address).

address payable: Same as address, but with the additional members transfer and send.

The idea behind this distinction is that address payable is an address you can send Ether to, while a plain address cannot be sent Ether.

As long as address has fewer methods than address payable you cannot directly assign address value to address payable variable. Tough you may explicitly cast adderess to address payable (not needed in your case).

  • It's works, OMG, it took me 4h for this – johnho.91 Apr 4 '19 at 9:46
  • 2
    How would you cast address to address payable? – NYC Tech Engineer Feb 20 '20 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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