Skip to content

checkUpkeep not showing in Write Contract #2296

Answered by RoboCrypter
ashrth asked this question in Q&A
Discussion options

You must be logged in to vote

@ashrth : In your Raffle.sol, You have to remove view visibility from your checkUpkeep function,

From this :

function checkUpkeep(
        bytes memory /* checkData*/
    )
        public
        view
        override
        returns (
            bool upkeepNeeded,
            bytes memory /*performData */
        )
    {
        bool isOpen = (RaffleState.OPEN == s_raffleState);
        bool timePassed = ((block.timestamp - s_lastTimeStamp) > i_interval);
        bool hasPlayers = (s_players.length > 0);
        bool hasBalance = address(this).balance > 0;
        upkeepNeeded = (isOpen && timePassed && hasPlayers && hasBalance);
    }

To :

function checkUpkeep(
        bytes memory /*…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ashrth
Comment options

Answer selected by ashrth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants