I'm trying to add the manager address to the playes array. I get the following error:
TypeError: Member "push" not found or not visible after argument-dependent lookup in address payable[] storage ref.
This is my code:
pragma solidity ^0.7.1;
contract Lottery{
address public manager;
uint public value;
address payable[] private players;
constructor() payable {
manager = msg.sender;
value = msg.value;
}
function enter() public payable {
require(value > 0.01 ether);
players.push(manager);
}
function random() private view returns (uint){
return uint(keccak256(abi.encodePacked(block.difficulty, block.timestamp, players)));
}
function pickWinner() public{
uint index = random() % players.length;
players[index].transfer(address(this).balance);
}
}
Any ideas? Thanks!