Get the FREE Ultimate OpenClaw Setup Guide →

solidity-deploy

npx machina-cli add skill 0xlayerghost/solidity-agent-kit/solidity-deploy --openclaw
Files (1)
SKILL.md
2.8 KB

Deployment Workflow

Language Rule

  • Always respond in the same language the user is using. If the user asks in Chinese, respond in Chinese. If in English, respond in English.

Pre-deployment Checklist (all must pass)

StepCommand / Action
Format codeforge fmt
Run all testsforge test — zero failures required
Check gas reportforge test --gas-report — review critical functions
Verify configManually check config/*.json parameters
Dry-runforge script <Script> --fork-url <RPC_URL> -vvvv (no --broadcast)
Check balancecast balance <DEPLOYER> --rpc-url <RPC_URL> — sufficient gas?
Gas limit setDeployment command must include --gas-limit

Deployment Decision Rules

SituationRule
Default deploymentNo --verify — contracts are not verified on block explorers by default
User requests verificationAdd --verify and --etherscan-api-key to the command
Post-deploy verificationUse forge verify-contract as a separate step
Multi-chain deploySeparate scripts per chain, never batch multiple chains in one script
Proxy deploymentDeploy implementation first, then proxy — verify both separately

Post-deployment Operations (all required)

  1. Update addresses in config/*.json and deployments/latest.env
  2. Test critical functions: cast call to verify on-chain state is correct
  3. Record changes in docs/CHANGELOG.md
  4. Submit PR with deployment transaction hash link
  5. If verification needed, run forge verify-contract separately

Key Security Rule

  • Never pass private keys directly in commands. Use Foundry Keystore (cast wallet import) to manage keys securely.
  • Never include --broadcast in templates. The user must explicitly add it when ready to deploy.

Command Templates

# Dry-run (simulation only, no on-chain execution)
forge script script/Deploy.s.sol:DeployScript \
  --rpc-url <RPC_URL> \
  --gas-limit 5000000 \
  -vvvv

# When user is ready to deploy, instruct them to add:
#   --account <KEYSTORE_NAME> --broadcast

# Verify existing contract separately
forge verify-contract <ADDRESS> <CONTRACT> \
  --chain-id <CHAIN_ID> \
  --etherscan-api-key <API_KEY> \
  --constructor-args $(cast abi-encode "constructor(address)" <ARG>)

# Quick on-chain read test after deployment
cast call <CONTRACT_ADDRESS> "functionName()" --rpc-url <RPC_URL>

Source

git clone https://github.com/0xlayerghost/solidity-agent-kit/blob/main/skills/solidity-deploy/SKILL.mdView on GitHub

Overview

Solidity-deploy provides the preflight and post-deploy workflow you must invoke before deploying contracts or writing deployment scripts (*.s.sol). It covers pre-flight checks (formatting, tests, gas reports, and config validation), dry-run execution of Forge scripts, and post-deployment verification. It also defines deployment decision rules and post-deploy hygiene like address updates and changelog entries.

How This Skill Works

The skill chains Forge-based steps: format code with forge fmt, run tests with forge test (including --gas-report), and validate config files; perform a dry-run with forge script and --fork-url to simulate deployment; then execute the real deployment with proper authentication and a set --gas-limit. It enforces security rules (never pass private keys in commands) and requires explicit --broadcast only when ready to deploy.

When to Use It

  • Before deploying contracts or writing deployment scripts (*.s.sol).
  • When performing forge script tasks or needing block explorer verification.
  • During pre-deployment checks: format, tests, gas report, config validation, and balance checks.
  • For post-deployment verification and multi-chain deployments.
  • When using proxies: deploy the implementation first, then the proxy, and verify both separately.

Quick Start

  1. Step 1: Run pre-deploy checks (forge fmt, forge test, forge test --gas-report, and review config/*.json).
  2. Step 2: Do a dry-run: forge script script/Deploy.s.sol:DeployScript --fork-url <RPC_URL> -vvvv.
  3. Step 3: When ready, deploy with --account <KEYSTORE> --broadcast; if verification is needed, add --verify and later run forge verify-contract; update addresses.

Best Practices

  • Run forge fmt, then forge test; ensure there are zero failures.
  • Manually verify config/*.json parameters before deployment.
  • Always do a dry-run with forge script --fork-url and -vvvv (no --broadcast).
  • Check deployer balance with cast balance and ensure the deployment command includes --gas-limit.
  • Never pass private keys directly in commands; use Foundry Keystore and avoid --broadcast until ready.

Example Use Cases

  • Dry-run a deployment: forge script script/Deploy.s.sol:DeployScript --fork-url <RPC_URL> -vvvv.
  • Post-deploy: deploy implementation, then proxy, verifying both separately with appropriate keys.
  • Multi-chain deployment: use separate scripts per chain instead of batching multiple chains.
  • Verification: after deployment, run forge verify-contract <ADDRESS> <CONTRACT> --etherscan-api-key <API_KEY>.
  • Post-deploy housekeeping: update config/*.json and deployments/latest.env, then submit a PR with the deployment hash.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers