Replies: 2 comments 17 replies
-
The code of Raffle.sol please |
Beta Was this translation helpful? Give feedback.
8 replies
-
If it is not performUpkeep is not reverting try logging isOpen, timePassed, hasPlayers & hasBalance from raffle.sol itself with hardhat debugging like this function checkUpkeep(
bytes memory /*checkData*/
)
public
view
override
returns (
bool upkeepNeeded,
bytes memory /*performData*/
)
{
bool isOpen = false;
bool timePassed = false;
bool hasPlayers = false;
bool hasBalance = false;
if (s_raffleState == RaffleState.OPEN) {
isOpen = true;
}
uint timeInterval = (block.timestamp - s_lastTimeStamp);
if (timeInterval > i_interval) {
timePassed = true;
}
if (s_playersArray.length > 0) {
hasPlayers = true;
}
if (address(this).balance > 0) {
hasBalance = true;
}
console.log(
"isOpen: %s, timePassed: %s, hasPlayers: %s, hasBalance: %s ",
isOpen,
timePassed,
hasPlayers,
hasBalance
);
if (isOpen && timePassed && hasPlayers && hasBalance) {
upkeepNeeded = true;
}
} Check what is causing error and debug accordingly. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys, I'm currently at
15:45:11
. I need some clarrification.In this code
Here is the github link
Instead of testing it like this I tried testing it like this
Notice that I changed the
interval.toNumber()+1
inside theevm_increaseTime
tointerval.toNumber()-1
to make it revert with the custom errorIn the
it("it can only run if checkUpkeep is true")
@PatrickAlphaC mentioned that ** If theupkeepNeeded
returned falseperformUpkeep will revert the transaction
but when I tried testing with the code I modified it's not reverting.Here is the photo of that

Can you please tell me what mistake I make??
Beta Was this translation helpful? Give feedback.
All reactions