Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

279
Views
TypeError: Cannot read properties of undefined (checkUpkeep, chainlink keepers)

I'm getting this error while testing my smart contract using hardhat

TypeError: Cannot read properties of undefined (reading 'checkUpkeep')

code for the test

 describe("checkUpkeep", () => {
              it("returns false if people haven't sent any eth", async () => {
                  await network.provider.send("evm_increaseTime", [interval.toNumber() + 1])
                  await network.provider.send("evm_mine", [])
                  const { upkeepNeeded } = await raffle.callstatic.checkUpkeep("0x")
                  assert(!upkeepNeeded)
              })
          })

relevant code of the smart contract

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);
        return (upkeepNeeded, "0x0");
    }
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Since its JS its hard to know which of the function calls is trying to access a variable with an undefined value. Based on the code you supplied it could even be that the reference to raffle is undefined.

But I'm assuming this code is the same as what's here.

There may be a missing import in your hardhat config or in your test imports. Double check those. It looks like there is something that your execution context requires that is not injected when your tests are running.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!