Deploying Contracts
Deploy your AutoLoop-compatible contracts to testnet and mainnet.
Overview
Deploying an AutoLoop-compatible contract involves three steps:
- Deploy your contract to the target network
- Register it with the AutoLoop Registrar
- Fund it with ETH to cover execution costs
Deploy to Sepolia (Testnet)
Prerequisites
- Foundry installed
- Sepolia ETH (faucet)
- An RPC endpoint (Infura, Alchemy, or a public one like
https://ethereum-sepolia-rpc.publicnode.com)
Write a Deploy Script
Create script/DeployMyGame.s.sol:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "forge-std/Script.sol";
import "../src/MyGame.sol";
contract DeployMyGame is Script {
function run() external {
vm.startBroadcast();
MyGame game = new MyGame();
console.log("MyGame deployed at:", address(game));
vm.stopBroadcast();
}
}Deploy
forge script script/DeployMyGame.s.sol \
--rpc-url https://ethereum-sepolia-rpc.publicnode.com \
--private-key $DEPLOYER_KEY \
--broadcast \
--verifyRegister with AutoLoop
After deployment, register your contract on-chain. You can do this via the dashboard or with cast:
# Sepolia Registrar
REGISTRAR=0xDA2867844F77768451c2b5f208b4f78571fd82C1
# Register and deposit 0.01 ETH in one call
cast send $REGISTRAR \
"registerAutoLoop(address)" $YOUR_CONTRACT \
--value 0.01ether \
--rpc-url https://ethereum-sepolia-rpc.publicnode.com \
--private-key $DEPLOYER_KEYWorkers will begin monitoring your contract automatically.
Check It's Working
# Check registration
REGISTRY=0xAC905aF2e40404D06317911beb03317Bd1bc5858
cast call $REGISTRY "isRegistered(address)" $YOUR_CONTRACT --rpc-url $RPC_URL
# Check balance
cast call $REGISTRY "getBalance(address)" $YOUR_CONTRACT --rpc-url $RPC_URL
# Watch for execution
cast call $YOUR_CONTRACT "shouldProgressLoop()" --rpc-url $RPC_URLDeploy to Mainnet
Same process, different addresses and RPC:
# Mainnet Registrar
REGISTRAR=0x202d73Ac243907A6e81B5FF55E4c316567e4fF80
forge script script/DeployMyGame.s.sol \
--rpc-url https://eth.drpc.org \
--private-key $DEPLOYER_KEY \
--broadcast \
--verify
cast send $REGISTRAR \
"registerAutoLoop(address)" $YOUR_CONTRACT \
--value 0.05ether \
--rpc-url https://eth.drpc.org \
--private-key $DEPLOYER_KEYMainnet Checklist
Before deploying to mainnet:
- Test thoroughly on Sepolia first
- Verify
shouldProgressLoop()returnsfalsewhen it should — unnecessary ticks waste ETH - Set a reasonable tick interval (every tick costs gas)
- Fund with enough ETH for your expected session length (see Economics)
- For VRF contracts, ensure controller keys are registered
Contract Addresses
Mainnet
| Contract | Address |
|---|---|
| AutoLoop | 0x6748415BcE63c0FBf1E50ceB2128BfeAC977224F |
| Registry | 0xC1b9241DE87108EffF5caAf0340CcEbD05A5425f |
| Registrar | 0x202d73Ac243907A6e81B5FF55E4c316567e4fF80 |
Sepolia
| Contract | Address |
|---|---|
| AutoLoop | 0x311eB21A1f7C0f12Ea7995cd6c02855b1bDa2132 |
| Registry | 0xAC905aF2e40404D06317911beb03317Bd1bc5858 |
| Registrar | 0xDA2867844F77768451c2b5f208b4f78571fd82C1 |
Using the Dashboard
The easiest way to register and fund is through the dashboard:
- Connect your wallet (the account that deployed the contract)
- Click "Register Contract"
- Paste your contract address
- Deposit ETH (minimum recommended: 0.01 ETH for testing, 0.05+ ETH for production)
- Your contract appears in the dashboard with live status
Depositing More ETH
When your contract balance gets low, deposit more:
# Via cast
cast send $REGISTRY "deposit(address)" $YOUR_CONTRACT \
--value 0.05ether \
--rpc-url $RPC_URL \
--private-key $DEPLOYER_KEYOr use the dashboard — click your contract and hit "Deposit".
Withdrawing Funds
To withdraw your remaining balance:
cast send $REGISTRY "requestRefund(address,address)" $YOUR_CONTRACT $RECIPIENT \
--rpc-url $RPC_URL \
--private-key $DEPLOYER_KEYThis sends the full remaining balance to the recipient address and resets the on-chain balance to zero. Workers will stop executing the contract once the balance is insufficient.