我正在尝试使用Chainlink Keeper网络,并编写了一个实现KeeperCompatibleInterface
的合同。然而,即使我明确设置了upkeepNeeded = true
,keeper网络仍然不运行维护。我已确保合同资金充足。可能是什么问题?
以下是相关的代码片段:
function checkUpkeep(bytes calldata checkData)
external
override
returns (bool upkeepNeeded, bytes memory performData)
{
return _checkUpkeep(checkData);
}
function _checkUpkeep(bytes memory checkData)
internal
view
returns (bool upkeepNeeded, bytes memory performData)
{
bool jobCanRun = (block.timestamp > _jobStartTime) &&
(block.timestamp < _expirationTime);
bool jobShouldRun = (block.timestamp.sub(_jobLastRun)) >=
_jobIntervalSeconds;
upkeepNeeded = jobCanRun && jobShouldRun;
performData = checkData;
// debug
upkeepNeeded = true;
}
function performUpkeep(bytes calldata performData) external override {
(bool upkeepNeeded, ) = _checkUpkeep("0");
require(upkeepNeeded, "Should not upkeep");
emit AtroposUpkeepPerformed();
_jobLastRun = block.timestamp;
}
用更多LINK代币为您的upKeep合同提供资金。
upKeep甚至需要最低余额才能开始运行,这取决于汽油成本、LINK代币价格和维护所需的汽油量。我会从至少50个Link代币开始。
请记住,Chainlink Keepers目前处于测试版,因此在测试版结束并汇总用户反馈后,所有这些都将得到更好的记录。