Get the FREE Ultimate OpenClaw Setup Guide →

deploy

Scanned
npx machina-cli add skill HCS412/contractkit/deploy --openclaw
Files (1)
SKILL.md
1.9 KB

ContractKit: Deploy

Deploy contracts to a local chain or testnet.

Usage

/contractkit:deploy <network>

Networks:

  • local - Local Anvil chain (default)
  • sepolia - Sepolia testnet

Process

Local Deployment

  1. Verify Anvil is running:

    curl -s http://127.0.0.1:8545 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
    
  2. Deploy:

    forge script script/Deploy.s.sol --rpc-url http://127.0.0.1:8545 --broadcast
    
  3. Parse deployment addresses and save to deployments/local.json

Sepolia Deployment

  1. Check required environment variables:

    • SEPOLIA_RPC_URL - Required
    • ETHERSCAN_API_KEY - Optional, for verification
  2. Warn user about testnet deployment (costs test ETH)

  3. Deploy:

    forge script script/Deploy.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast --verify
    
  4. Parse deployment addresses and save to deployments/sepolia.json

Output

After deployment, report:

  • Contract address(es)
  • Transaction hash
  • Block explorer link (for testnet)
  • Example call commands:
    /contractkit:call balanceOf --args "0x..."
    

Deployment Files

Deployments are saved to deployments/<network>.json:

{
  "Token": "0x..."
}

Example Usage

User: /contractkit:deploy local

Deploying to local chain...

Transaction sent: 0x...
Token deployed at: 0x5FbDB2315678afecb367f032d93F642f64180aa3

Saved to deployments/local.json

Example calls:
  /contractkit:call name
  /contractkit:call balanceOf --args "0xf39F..."

Troubleshooting

"Anvil not running"

Start Anvil first: /contractkit:local

"Insufficient funds" (Sepolia)

Get testnet ETH from a faucet:

"Script not found"

Ensure script/Deploy.s.sol exists in your project.

Source

git clone https://github.com/HCS412/contractkit/blob/main/plugins/contractkit/skills/deploy/SKILL.mdView on GitHub

Overview

ContractKit’s deploy skill lets you push smart contracts to a local Anvil chain or the Sepolia testnet. It uses forge script Deploy.s.sol to perform the deployment and saves the resulting addresses to deployments/local.json or deployments/sepolia.json for easy reference. Verification is optional on Sepolia via ETHERSCAN_API_KEY and the --verify flag.

How This Skill Works

When you run /contractkit:deploy <network>, the tool executes forge script script/Deploy.s.sol against the chosen RPC URL (local: http://127.0.0.1:8545; sepolia uses SEPOLIA_RPC_URL). After broadcasting, it outputs contract addresses and the transaction hash, which are parsed and saved to deployments/<network>.json. For Sepolia deployments, you can enable verification with --verify and provide ETHERSCAN_API_KEY.

When to Use It

  • Deploying contracts to a local Anvil chain for development and testing.
  • Deploying to Sepolia testnet to validate on a real network.
  • Saving deployment addresses to deployments/local.json or deployments/sepolia.json for quick reference.
  • Verifying Sepolia deployments with --verify when a ETHERSCAN_API_KEY is available.
  • Troubleshooting deployment failures (e.g., Anvil not running or insufficient funds).

Quick Start

  1. Step 1: Pick a network (local or sepolia) and ensure prerequisites are met (Anvil for local; SEPOLIA_RPC_URL for Sepolia).
  2. Step 2: Run the deployment command, e.g. forge script script/Deploy.s.sol --rpc-url http://127.0.0.1:8545 --broadcast or forge script script/Deploy.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast --verify.
  3. Step 3: Check deployments/<network>.json and use /contractkit:call to interact with deployed contracts.

Best Practices

  • Ensure Anvil is running before local deployments.
  • Test RPC responsiveness with a quick node query (e.g., eth_blockNumber) before deploying.
  • Set SEPOLIA_RPC_URL for Sepolia deployments and provide ETHERSCAN_API_KEY if you plan to verify.
  • Use --verify for Sepolia deployments to enable on-chain verification where supported.
  • After deployment, check deployments/<network>.json and use the provided addresses in subsequent calls.

Example Use Cases

  • Deploy locally: /contractkit:deploy local
  • Deploy to Sepolia: /contractkit:deploy sepolia
  • Saved addresses appear in deployments/local.json after local deployment
  • Example calls and addresses shown in terminal output after deployment
  • Verify Sepolia deployment with --verify and your ETHERSCAN_API_KEY

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers