0

I want to write a function let user deposit a fixed amount of eth to a specific address for registering purpose.

pragma solidity ^0.5.0;

contract Election {
    // Constructor
    address public chairman;

    constructor () public {
      chairman = msg.sender;
    }

    function register() public payable{
        chairman.transfer(1.0);
    }
}

But this error threw out

member 'transfer' not found or not visible after argument-dependent lookup in address

0

In order to transfer ETH to an address, it has to be marked as payable, so you have to use address payable public chairman;.

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.