0

我正在尝试使用 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;
    }
4

1 回答 1

0

使用更多 LINK 代币为您的 upKeep 合约提供资金。

upKeep 需要最低余额才能根据 gas 成本、LINK 代币价格以及您的维护所需的 gas 量开始运行。我会从至少 50 个链接令牌开始。

请记住,Chainlink Keepers 目前处于测试阶段,因此在测试结束并汇总用户反馈后,所有这些都会得到更好的记录。

于 2021-07-02T15:12:02.110 回答