Docs/Examples

Examples

Complete, deployable example contracts demonstrating all three AutoLoop integration patterns.


Overview

These examples are ready to deploy and test. Each demonstrates a different AutoLoop integration pattern.

| Contract | Base | VRF | Difficulty | |----------|------|-----|------------| | AutoCounter | AutoLoopCompatible | No | Beginner | | HybridGame | AutoLoopHybridVRFCompatible | Selective | Intermediate | | CoinFlipper | AutoLoopVRFCompatible | Every tick | Intermediate | | PriceAlerter | AutoLoopCompatible | No | Intermediate |

Deployment

Local (Anvil)

cd autoloop

# Deploy any example
forge create examples/AutoCounter.sol:AutoCounter \
  --constructor-args 30 \
  --rpc-url http://127.0.0.1:8545 \
  --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

Mainnet / Sepolia

forge create examples/AutoCounter.sol:AutoCounter \
  --constructor-args 30 \
  --rpc-url $RPC_URL \
  --private-key $PRIVATE_KEY \
  --verify

After Deployment

  1. Register with AutoLoop
  2. Set max gas (e.g., 500,000)
  3. Fund with ETH
  4. Watch — workers start executing automatically