[Ethereum] TypeError: Type address is not implicitly convertible to expected type address payable


I'm taking the course from lynda.com "Ethereum: Building Blockchain Decentralized Apps (DApps)" but there's an issue with the contract we're given, and it won't compile:

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 the result of trying to compile the solidity contract:

enter image description here

Best Answer

This casting worked for me:

casted "address" to "address payable" with "payable(msg.sender)".

Related Topic