I am trying one Lottery contract in that I am using one function which give me error.
function pickAWinner() public restricted {
require(this.balance >= 10 ether);
uint index = random() % players.length;
players[index].transfer(this.balance);
players = new address[](0);
}
Getting below error, Below error I am getting other contract also as "Member "balance" not found or not visible after argument-dependent lookup in contract" I think there is issue with 'balance' keyword. however I Unable to fixed it.
Error:-TypeError: Member "balance" not found or not visible after
argument-dependent lookup in contract Lottery. Use
"address(this).balance" to access this address member.
require(this.balance >= 10 ether);
^----------^
How can I fixed it?