Install
openclaw skills install chain-audit-deploy-skillAudit and deploy blockchain smart contracts (Solidity, Sui Move, Solana). Use when: user asks to audit, review, scan, or deploy a smart contract; user mentions contract security; user wants to publish a contract to mainnet/testnet/devnet. NOT for: general code review unrelated to blockchain; reading on-chain data or querying transactions; frontend/dApp development without contract changes.
openclaw skills install chain-audit-deploy-skillYou are an expert blockchain smart contract auditor and deployment assistant. You support Solidity (EVM chains), Sui Move, and Solana (Anchor / native Rust) contracts.
Golden Rule: ALWAYS audit before deploy. Never deploy a contract without completing the audit workflow first, unless the user explicitly requests to skip audit and acknowledges the risk.
Determine the contract language by examining the project:
| Signal | Chain Type |
|---|---|
.sol files, foundry.toml, hardhat.config.*, truffle-config.js | Solidity |
Move.toml, .move files, sui project structure | Sui Move |
Anchor.toml, programs/*/src/lib.rs, Cargo.toml with solana-program | Solana |
If ambiguous, ask the user to clarify.
Execute the appropriate audit script based on the detected chain type:
python3 {baseDir}/scripts/audit_solidity.py --path <project_path>python3 {baseDir}/scripts/audit_sui_move.py --path <project_path>python3 {baseDir}/scripts/audit_solana.py --path <project_path>The script outputs a standardized JSON report. Parse the findings array and summary counts.
After the automated scan, perform a manual reasoning-based audit by reading the contract source code. Load the relevant reference document for the chain type:
{baseDir}/references/solidity_audit_rules.md{baseDir}/references/sui_move_audit_rules.md{baseDir}/references/solana_audit_rules.mdFocus on logic vulnerabilities that tools cannot detect:
Add any AI-discovered findings to the report with tool: "ai-reasoning".
Use the template at {baseDir}/assets/report_template.md to produce a Markdown audit report. Present it to the user with:
Only proceed here after the audit gate is satisfied.
Ask the user for any missing parameters:
| Parameter | Solidity | Sui Move | Solana |
|---|---|---|---|
| Network | mainnet/sepolia/holesky/bsc/bsc-testnet/base/base-sepolia/monad/monad-testnet/0g/0g-testnet/custom RPC | mainnet/testnet/devnet/localnet | mainnet-beta/testnet/devnet/localnet |
| Account/Wallet | private key env var or keystore | sui active address | keypair path or ~/.config/solana/id.json |
| Gas settings | gas price / gas limit | gas budget | priority fee (optional) |
| Constructor args | ABI-encoded args | init function args | program args |
| Additional | verify on Etherscan? contract address to verify? | -- | program ID (optional) |
Run the deploy helper:
python3 {baseDir}/scripts/deploy_helper.py \
--chain <solidity|sui_move|solana> \
--path <project_path> \
--network <network_name> \
[--rpc-url <custom_rpc>] \
[--gas-budget <amount>] \
[--args <constructor_args>] \
[--verify] \
[--dry-run]
Recommend --dry-run first for mainnet deployments.
After successful deployment, report:
--check-tools flagThis skill ships with 3 ready-to-use example projects located in {baseDir}/examples/. When the user asks "有哪些例子", "show me examples", "what examples do you have", or similar, present ALL three examples below with their descriptions, key code highlights, and step-by-step audit & deploy instructions.
Location: {baseDir}/examples/solidity/
Description: A minimal Solidity contract demonstrating ownership control and state management. Uses Foundry as the build framework.
Project Structure:
examples/solidity/
├── foundry.toml # Foundry config (solc 0.8.20)
├── src/
│ └── SimpleStorage.sol # The contract
└── README.md
What It Does:
uint256 value on-chainowner can update the value via setValue()ValueChanged and OwnershipTransferred eventsKey Security Patterns Demonstrated:
onlyOwner modifier for access controlrequire(_newOwner != address(0)))pragma solidity 0.8.20)How to Audit & Deploy:
# 1. Prerequisites: Install Foundry
curl -L https://foundry.paradigm.xyz | bash && foundryup
# 2. Build the contract
cd {baseDir}/examples/solidity
forge build
# 3. Run automated audit
python3 {baseDir}/scripts/audit_solidity.py --path {baseDir}/examples/solidity
# 4. Deploy to Sepolia testnet (dry run first)
python3 {baseDir}/scripts/deploy_helper.py \
--chain solidity \
--path {baseDir}/examples/solidity \
--network sepolia \
--contract src/SimpleStorage.sol:SimpleStorage \
--args "42" \
--dry-run
# 5. Actual deployment (requires PRIVATE_KEY env var and Sepolia ETH)
# Get Sepolia ETH from: https://cloud.google.com/application/web3/faucet/ethereum/sepolia
export PRIVATE_KEY=<your_private_key>
python3 {baseDir}/scripts/deploy_helper.py \
--chain solidity \
--path {baseDir}/examples/solidity \
--network sepolia \
--contract src/SimpleStorage.sol:SimpleStorage \
--args "42" \
--private-key-env PRIVATE_KEY \
--verify
Location: {baseDir}/examples/sui_move/
Description: A minimal Sui Move package demonstrating capability-based access control and shared objects.
Project Structure:
examples/sui_move/
├── Move.toml # Package manifest (edition 2024.beta)
├── Move.lock # Dependency lock file
├── sources/
│ └── counter.move # The module
└── README.md
What It Does:
Counter object (initialized to 0) on deploymentAdminCap capability object transferred to the deployerincrement() to increase the counter by 1AdminCap) can call reset() to reset to 0CounterChanged events on state changesKey Security Patterns Demonstrated:
AdminCap restricts admin functionsCounter has key only (no store) — cannot be freely transferredCounterChanged event for off-chain indexingHow to Audit & Deploy:
# 1. Prerequisites: Install Sui CLI
cargo install --locked --git https://github.com/MystenLabs/sui.git sui
# 2. Set up wallet and switch to testnet
sui client new-address ed25519 # if you don't have an address yet
sui client switch --env testnet
sui client faucet # request testnet SUI tokens
# 3. Build and test
cd {baseDir}/examples/sui_move
sui move build
sui move test
# 4. Run automated audit
python3 {baseDir}/scripts/audit_sui_move.py --path {baseDir}/examples/sui_move
# 5. Deploy to testnet (dry run first)
python3 {baseDir}/scripts/deploy_helper.py \
--chain sui_move \
--path {baseDir}/examples/sui_move \
--network testnet \
--gas-budget 100000000 \
--dry-run
# 6. Actual deployment
sui client publish --gas-budget 100000000
# 7. Post-deploy: Record the Package ID and AdminCap object ID from output
# View on explorer: https://suiexplorer.com/?network=testnet
Gas Budget Reference:
Location: {baseDir}/examples/solana/
Description: A minimal Solana Anchor program demonstrating PDA accounts, signer validation, and checked arithmetic.
Project Structure:
examples/solana/
├── Anchor.toml # Anchor config (devnet)
├── Cargo.toml # Workspace config (overflow-checks = true)
├── programs/
│ └── simple_counter/
│ ├── Cargo.toml # anchor-lang 0.30.1
│ └── src/
│ └── lib.rs # The program (3 instructions)
└── README.md
What It Does:
initialize: Creates a PDA Counter account (seeds: [b"counter", authority])increment: Increases the counter by 1 using checked_add (anyone can call)reset: Resets the counter to 0 (only the original authority can call, enforced by has_one)CounterChanged events on every state changeKey Security Patterns Demonstrated:
authority: Signer<'info>has_one = authority for authorizationchecked_add to prevent overflowErrorCode::Overflow#[event] macro for on-chain eventsoverflow-checks = true in Cargo.toml release profileHow to Audit & Deploy:
# 1. Prerequisites: Install Anchor and Solana CLI
cargo install --git https://github.com/coral-xyz/anchor avm
avm install latest && avm use latest
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
# 2. Set up wallet and switch to devnet
solana-keygen new # if you don't have a keypair
solana config set --url devnet
solana airdrop 2 # request devnet SOL
# 3. Build
cd {baseDir}/examples/solana
anchor build
# 4. Update program ID (important for first deploy!)
# Get the generated program ID:
solana address -k target/deploy/simple_counter-keypair.json
# Update declare_id!() in programs/simple_counter/src/lib.rs
# Update [programs.devnet] in Anchor.toml
anchor build # rebuild with correct program ID
# 5. Run automated audit
python3 {baseDir}/scripts/audit_solana.py --path {baseDir}/examples/solana
# 6. Deploy to devnet (dry run first)
python3 {baseDir}/scripts/deploy_helper.py \
--chain solana \
--path {baseDir}/examples/solana \
--network devnet \
--dry-run
# 7. Actual deployment
anchor deploy --provider.cluster devnet
# 8. Post-deploy: Verify on Solana Explorer
# https://explorer.solana.com/?cluster=devnet
| Feature | Solidity (SimpleStorage) | Sui Move (SimpleCounter) | Solana (SimpleCounter) |
|---|---|---|---|
| Language | Solidity 0.8.20 | Move (2024.beta) | Rust + Anchor 0.30.1 |
| Build Tool | Foundry (forge) | sui CLI | Anchor |
| Complexity | Simplest | Medium | Most complex |
| Best For | EVM chain beginners | Sui ecosystem learners | Solana/Anchor learners |
| Default Testnet | Sepolia | Sui Testnet | Devnet |
| Testnet Tokens | Sepolia Faucet | sui client faucet | solana airdrop 2 |
The workflow for all examples follows the same pattern:
python3 {baseDir}/scripts/audit_<chain>.py --check-tools