3

I am quite new to solidity, and I have not managed to find a solution for this problem.

I am passing the function an address but it says the following: "Invalid type for argument in function call. Invalid implicit conversion from address to address payable request."

address admin;

function endSale() public {
 require(msg.sender == admin);
 selfdestruct(admin);
}
5

As of Solidity 0.5.0, there are two different address types in solidity: address and address payable.

You can only transfer funds to an address payable.

Therefore, your problem will be fixed by making admin an address payable:

address payable admin;
1

You can cast to address payable with this code:

selfdestruct(address(uint160(admin)));

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.