Docs/Getting Started

Getting Started

Set up your first AutoLoop contract in under 5 minutes.


Prerequisites

Installation

AutoLoop is published to the Lucky Machines registry.

npm install @luckymachines/autoloop

For Foundry projects, add a remapping to remappings.txt:

@luckymachines/autoloop/=node_modules/@luckymachines/autoloop/

One-Command Local Setup

./quickstart.sh

This starts a complete local environment:

  • Anvil local chain (2s blocks)
  • Deploys all contracts + a sample NumberGoUp contract
  • Registers, funds, and starts automation
  • Runs a worker monitoring the chain
  • Launches the dashboard at http://localhost:3000

Connect MetaMask to http://127.0.0.1:8545 (chain ID 31337) and import the test private key:

0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

Choose Your Contract Type

AutoLoop offers three base contracts depending on your needs:

| Base Contract | Use Case | Gas per Tick | |---------------|----------|--------------| | AutoLoopCompatible | Pure automation — no randomness | ~90,000 | | AutoLoopHybridVRFCompatible | Selective VRF — randomness when you need it | ~90k / ~240k | | AutoLoopVRFCompatible | Full VRF — randomness on every tick | ~240,000 |

Most game developers should start with Hybrid VRF — it gives you cheap standard ticks with on-demand randomness for loot drops, crits, spawns, and special events.

How It Works

  1. Inherit from one of the three base contracts
  2. Implement shouldProgressLoop() and progressLoop() (or _onTick() / _onVRFTick() for hybrid)
  3. Register your contract on-chain via the dashboard or directly
  4. Fund with ETH to cover gas + fees
  5. Workers auto-detect your contract type via ERC-165 and execute accordingly

Deployed Contracts

Mainnet

| Contract | Address | |----------|---------| | AutoLoop | 0x6748415BcE63c0FBf1E50ceB2128BfeAC977224F | | Registry | 0xC1b9241DE87108EffF5caAf0340CcEbD05A5425f | | Registrar | 0x202d73Ac243907A6e81B5FF55E4c316567e4fF80 |

Sepolia

| Contract | Address | |----------|---------| | AutoLoop | 0x6742F258121bf616a581e9E773e33DEaAe07E2e1 | | Registry | 0x7a87279cD828954C8b7f9Bbe547b51e59E587d20 | | Registrar | 0x475609997112897E492311A0A27D1f95F808921A |

Next Steps