Cleared up thanks. Below should just be the correct answer, should anyone find it useful.
In order to solve the problem we have to somehow let the contract be accessed by onlyOwner and we have to make the address where funds are being withdrawn to, somehow payable. In the solution below, the first characteristic is derived from inheritance, while for making variable payable there are multiple options:
Option #1 - we make the address payable by using msg.sender
contract Ownable {
address public owner;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
constructor(){
owner = msg.sender;
}
}
contract Destroyable is Ownable {
function destroyContract() public onlyOwner {
selfdestruct(msg.sender);
}
}
Option #2.1 - we make the owner
variable payable by hand
contract Ownable {
address payable public owner;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
constructor(){
owner = msg.sender;
}
}
contract Destroyable is Ownable {
function destroyContract() public onlyOwner {
selfdestruct(owner);
}
}
Option #2.2 - we can also leave the state variable owner as non-payable and instead making it payable only locally within the Destroyable function, like below.
address public owner;
...
function destroyContract() public onlyOwner {
selfdestruct(payable(owner));
}