Reputation: 1
Custom Automation on Fuji is never calling my contract.
I have created a very simple contract like this :
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {AutomationCompatibleInterface} from "@chainlink/contracts/src/v0.8/automation/AutomationCompatible.sol";
contract TestAutomation is AutomationCompatibleInterface {
bool public hasAutomationRun;
function getHasRun() external view returns (bool) {
return hasAutomationRun;
}
function checkUpkeep(bytes calldata /* checkData */) external view override returns (bool upkeepNeeded, bytes memory /* performData */) {
upkeepNeeded = !hasAutomationRun;
return (upkeepNeeded, "");
}
function performUpkeep(bytes calldata /* performData */) external override {
hasAutomationRun = true;
}
}
I have deployed it on Avalanche Fuji and created a new Custom logic upkeep pointing to that contract.
I have funded the Upkeep with 12 link and increased gas limit to maximum, but still nothing happens on the automation.
It shows it has never run and also shows no history except the funds and creation.
Upvotes: 0
Views: 76
Reputation: 31
The Automation network is running, you can look at the registry events in the Avalanche Fuji scanner and will see perform events. https://testnet.snowtrace.io/address/0x819B58A646CDd8289275A87653a2aA4902b14fe6/events
Regarding your upkeep, you might want to check out the debugger script referred to in the documentation https://github.com/smartcontractkit/chainlink/blob/develop/core/scripts/chaincli/DEBUGGING.md The script will allow you to pinpoint, to some degree, why your upkeep is not running.
I used your source code and registered this upkeep and it performed once as expected https://automation.chain.link/fuji/93646709238747824616295073127342479529913089319546469919204345641805496170336
The only tweak to source code was ability to reset hasRun to see if it fires again. I ran resetHasRun from Remix and you can see the upkeep performed twice.
pragma solidity ^0.8.24;
import {AutomationCompatibleInterface} from "@chainlink/contracts/src/v0.8/automation/AutomationCompatible.sol";
contract TestAutomation is AutomationCompatibleInterface {
bool public hasAutomationRun;
function getHasRun() external view returns (bool) {
return hasAutomationRun;
}
function resetHasRun() external {
hasAutomationRun = false;
}
function checkUpkeep(bytes calldata /* checkData */) external view override returns (bool upkeepNeeded, bytes memory /* performData */) {
upkeepNeeded = !hasAutomationRun;
return (upkeepNeeded, "");
}
function performUpkeep(bytes calldata /* performData */) external override {
hasAutomationRun = true;
}
}
Upvotes: 0
Reputation: 1
I know it only triggers once it is just a test to demonstrate that automation on fuji is not running at all. Calling the hasRun or the checkupkeep is always returning false and the details of the automation shows it has never run.
Upvotes: 0
Reputation: 46
hello! I suggest that you use the Chainlink example from this link (https://docs.chain.link/chainlink-automation/guides/compatible-contracts) to see how it works. Your code will only trigger once, and if you manually called performUpKeep, the checkUpKeep will remain false indefinitely.
Upvotes: 0