Skip to main content

CLAUDE.md — OPNet Smart Contract Project

This file tells Claude everything it needs to know about this project.


#What This Is

An OPNet smart contract project. Contracts are written in AssemblyScript and compiled to WebAssembly. They run on Bitcoin L1 via the OPNet consensus layer.

#Plugin Setup

This project uses the buidl-opnet-plugin. To start Claude with the plugin loaded:

bash
# Add these aliases to your shell config (~/.bashrc or ~/.zshrc):
alias claudey="claude --plugin-dir /path/to/buidl-opnet-plugin/buidl"
alias claudeyproj="claude --dangerously-skip-permissions --plugin-dir /path/to/buidl-opnet-plugin/buidl"

Use claudeyproj for autonomous builds with the /buidl command.

When the plugin is loaded, Claude has access to:

  • opnet-contract-dev agent — specialized OPNet contract development
  • opnet-auditor agent — 27 real-bug audit patterns from btc-vision repos
  • opnet-deployer agent — deployment to testnet and mainnet
  • Knowledge slices covering OPNet token standards, storage patterns, security requirements

#Contract Details

Contract name: [Your Contract Name] Token standard: [OP20 / OP721 / custom] Network: [testnet / mainnet] Contract address (if deployed): [address or leave blank]

#What This Contract Does

[Describe your contract's purpose and core mechanics in 2-3 sentences]

#Key Mechanics

[List the main functions and what they do]

  • [functionName]: [what it does]
  • [functionName]: [what it does]

#Rules and Constraints

[List any important rules the contract must enforce]

  • [rule 1]
  • [rule 2]

#Build Commands

bash
# Compile the contract
npm run build

# Run tests
npm run test

# Deploy to testnet
npm run deploy:testnet

# Deploy to mainnet
npm run deploy:mainnet

#Using the /buidl Pipeline

For major changes or new features, use the full pipeline:

text
/buidl "describe the feature or change"

For small targeted changes, use direct prompts.

#Security Notes

  • All u256 arithmetic uses SafeMath (do not use raw operators)
  • Storage pointers are unique and documented below
  • No while loops — only bounded for loops
  • CSV timelocks on all swap recipient addresses

#Storage Layout

Slot Name Type Description
1
2

(Fill in your storage slots to prevent collisions)

Ready to test your knowledge?

20 questions covering everything from vibecoding basics to shipping a complete dApp.

Take the Quiz