Solidityでselfdestructをしたいのですがエラーがでます。
SolidityをRemix上で書いていてselfdestructを使いたいのですが、
『TypeError: Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested.
selfdestruct(owner); // send ether to address inside parenthis』というエラーが出てしまいます。
^---^
どうしたらよいでしょうか。
pragma solidity ^0.5.0;
contract Owned{
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function owned() internal {
owner = msg.sender;
}
function changeOwner(address _newOwner) public onlyOwner {
owner = _newOwner;
}
}
contract Mortal is Owned {
function kill() public onlyOwner {
selfdestruct(owner); // send ether to address inside parenthis
}
}
contract MortalSample is Mortal {
string public someState;
function() payable external {
}
constructor() public{
owned();
someState = "initial";
}
}