rutts-cred's picture
Update README.md
4a84f42 verified
|
raw
history blame
2.82 kB
metadata
license: mit
language:
  - en
base_model:
  - Qwen/Qwen3-4B-Instruct-2507
tags:
  - solidity
  - smart_contract
  - web3
  - solidityscan
  - credshields

Solidity-CodeGen-v0.1

Solidity-CodeGen-v0.1 is a fine-tuned LLM specialized for generating Solidity smart contracts with modern OpenZeppelin patterns. It works best when paired with the OpenZeppelin Contracts MCP (Model Context Protocol) to produce canonical ERC and Governor implementations.

  • Base: Qwen3 (tuned for Solidity codegen)
  • Context length: Served via vLLM (up to 32k with server)
  • Recommended: Use with OpenZeppelin MCP locally for highest-quality results

How to Load

Transformers:

from transformers import AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained("credshields/Solidity-CodeGen-v0.1")
model = AutoModelForCausalLM.from_pretrained("credshields/Solidity-CodeGen-v0.1", torch_dtype="auto", device_map="auto")

vLLM: vllm serve YOUR_ORG/Solidity-CodeGen-v0.1 --dtype auto --port 8005

Recommended: Use OpenZeppelin MCP (Locally)

For best results, run the official OpenZeppelin Contracts MCP locally and route ERC20/721/1155 and Governor requests through it.

This model card does not include MCP files; use the official OZ MCP project locally.

Prompting Guide (No MCP)

When MCP is unavailable, use structured prompts:

  • Start with:
  - “Generate only Solidity code in a single ```
  - “Solidity: ^0.8.27 and OpenZeppelin v5 imports only (@openzeppelin/contracts/...).”
- Specify contract type, features, and constraints.

Example (ERC20 minimal, mintable):

Generate only Solidity code in a single ```
Solidity: ^0.8.27, OpenZeppelin v5 imports only.
Contract: ERC20 token
Name: TestToken
Symbol: TEST
Features: Ownable, mint(address,uint256) onlyOwner
Constraints:
Imports: ERC20, Ownable
constructor(address initialOwner) and Ownable(initialOwner)
No burn, no pause, no permit

Quality and Limitations

  • With MCP: ERC20/721/1155 and Governor scaffolds are canonical; custom templates are solid but require review.
  • Without MCP: Basic patterns work with structured prompts; complex protocols require expert review.
  • Always test and audit generated code before production.

Files Included

  • Model weights and tokenizer
  • Optional requirements files for Transformers/vLLM
  • No MCP/server code included; use official OZ MCP locally.

License

  • Model weights: see LICENSE.
  • Generated code: user responsibility; OpenZeppelin Contracts are MIT-licensed.

Note

Note: This preview focuses on tailored scaffolds for common patterns and may omit end‑to‑end features; treat outputs as starting points to be completed, validated, and audited.