Like the title says, it seems all the conditions for a keeper to run performUpkeep have been met, yet it is not being called.
I have verify my smart contract, make it Kepper Compatible, Fund the Keeper with sufficient LINK.
Here is the upkeep link: https://keepers.chain.link/mumbai/1560
Here is the contract: https://mumbai.polygonscan.com/address/0x5BdfE445c664020988f857b42E6772385da0EdB6#code
Here is the relevant code:
function checkUpkeep(
bytes memory /* checkData */
)
public
view
override
returns (
bool upkeepNeeded,
bytes memory /* performData */
)
{
bool timePassed = ((block.timestamp - lastTimeStamp) > interval); // keep track of betting
bool hasPlayers = upBetAddresses.length > 0 ||
downBetAddresses.length > 0;
upkeepNeeded = (timePassed && hasPlayers);
return (upkeepNeeded, "0x0");
}
// function to send MATIC to the winners
function performUpkeep(
bytes calldata /* performData */
) external override {
// this is the way to get checkUpKeep function. we only need 1 parameter, therefore (bool upkeepNeede, ) next is blank.
(bool upkeepNeeded, ) = checkUpkeep("");
if (!upkeepNeeded) {
revert BET_UPKEEP_NOT_NEEDED();
}
//We highly recommend revalidating the upkeep in the performUpkeep function
if ((block.timestamp - lastTimeStamp) > interval) {
executePlaceBet();
lastTimeStamp = block.timestamp;
}
emit Perform_UpKeep();
}
// placing bet with simple up and down
function executePlaceBet() private {
//code
}
Use Hardhat to deploy code. Some relevant code:
const deployedVerifyContract = await verifyContract.deploy(INTERVAL, FEE);
Create index.js for constants
const FEE = ethers.utils.parseEther("1");
const INTERVAL = 3600;
Upkeep when 1 hour have passed and there are players in array / dapp
perforumUpkeep
just to see if it would go through, and it did - but now we have to wait 3600 seconds