Skip to content

Automation ​

Run contract functions automatically, on a fixed interval or whenever a condition becomes true. Staked keepers take turns, and the registry re-checks every trigger on-chain.

1. Make your contract automatable ​

solidity
import {IGenesisAutomationTarget} from "./interfaces/IGenesisAutomation.sol";

contract Rebalancer is IGenesisAutomationTarget {
    address immutable registry;

    constructor(address registry_) { registry = registry_; }

    function checkUpkeep(bytes calldata) external view returns (bool needed, bytes memory data) {
        needed = _isOffTarget();
        data = abi.encode(_targetAmount());
    }

    function performUpkeep(bytes calldata data) external {
        require(msg.sender == registry, "only registry");
        require(_isOffTarget(), "not needed");   // always re-validate
        _rebalance(abi.decode(data, (uint256)));
    }
}

2. Register and fund it ​

solidity
// trigger: 0 = conditional (uses checkUpkeep), 1 = time (every `interval` seconds)
registry.registerUpkeep{value: 1 ether}(
    "Rebalancer", target, 200_000, 0, 0, "", address(0), 1 ether   // fund in HYPE
);

To fund in GENESIS, approve the registry, pass the GENESIS address as token and send no value. A GENESIS-funded job pays a smaller keeper premium. Top up later with addFunds(id, amount).

What a run costs ​

cost = gas used × gas price  +  premium (20% of gas cost)  +  flat fee

The premium gets your holder discount. For GENESIS-funded jobs it also gets the GENESIS payment discount, and the gas cost is converted at the GENESIS/HYPE rate. Jobs whose balance can't cover the worst case are skipped until topped up.

Managing a job ​

CallWhoEffect
setPaused(id, bool)adminStop or resume runs
cancelUpkeep(id)adminPermanently stop
withdrawFunds(id, to)adminRefund the balance after cancelling

Becoming a keeper ​

  1. From a secure wallet, stake at least the minimum in GenesisStaking. There's a HYPE minimum, and a lower GENESIS minimum after launch.
  2. From the same wallet, call registry.registerKeeper().
  3. Authorize a separate node wallet with registry.setKeeperOperator(nodeWallet).
  4. Run the operator node with that node wallet as KEEPER_PRIVATE_KEY.

The node wallet can only perform upkeeps. Stake, slashing exposure and earnings all stay with the secure wallet, so the node only needs enough HYPE for gas. Revoke it at any time with setKeeperOperator(address(0)).

Earnings accumulate per token. Collect them with withdrawKeeperBalance(token). Keepers whose stake drops below the minimum can be removed by anyone with removeUnderstakedKeeper.

GENESIS · verifiable infrastructure for Elysium