Below is the contact code. This is basically a lottery contract.
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.10;
contract Lottery {
address public manager;
address[] public players;
constructor() public {
manager = msg.sender;
}
function enter() public payable {
require(msg.value > .01 ether);
players.push(msg.sender);
}
function random() private view returns (uint) {
return uint(keccak256(abi.encodePacked(block.difficulty,block.timestamp,players)));
}
function pickWinner() public restricted {
uint index = random() % players.length;
payable(players[index]).transfer(address(this).balance);
players = new address[](0);
}
modifier restricted() {
require(msg.sender == manager);
_;
}
function getPlayers() public view returns (address payable[] memory) {
return players;
}
}
On the last line return players
, I am getting this ERROR: Return argument type address[] storage ref is not implicitly convertible to expected type (type of first return variable) address payable[] memory.
What am I missing ??