I am using remix: I have this function in my contract:
contract Control {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function withdrawAll() public payable onlyOwner {
require(payable(msg.sender).send(address(this).balance));
}
}
But I'm getting this error with the withdrawAll function:
test token V2.sol:84:17: ParserError: Expected primary expression.
require(payable(msg.sender).send(address(this).balance)); ^-----^
did i forget a varible or is this just a syntax error? The script works, but this function I just want to be able to call to withdraw anything that gets stuck at this address.