solidity
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill based on Solidity (ethereum/solidity) docs, generated at 2026-02-09.
Solidity is a statically typed, object-oriented language for EVM smart contracts. This skill covers source layout, types, contract structure, control flow, security patterns, compiler usage, and ABI/internals.
基于Solidity(ethereum/solidity)文档生成的Skill,生成时间:2026-02-09。
Solidity是一种用于EVM智能合约的静态类型、面向对象编程语言。本Skill涵盖了源码结构、类型、合约结构、控制流、安全模式、编译器使用以及ABI/内部机制等内容。
Core References
核心参考
| Topic | Description | Reference |
|---|---|---|
| Source Layout | SPDX, pragma, import, comments | core-layout |
| Contract Structure | State, functions, modifiers, events, errors, structs, enums | core-structure |
| Types | Value/reference/mapping types, operators, conversions | core-types |
| Control Structures | if/loop, internal/external calls, revert, try/catch | core-control |
| Units and Globals | Ether/time units, block/msg/tx, ABI/hash helpers | core-units-globals |
| 主题 | 描述 | 参考 |
|---|---|---|
| 源码结构 | SPDX声明、pragma指令、导入语句、注释 | core-layout |
| 合约结构 | 状态变量、函数、修饰器、事件、错误、结构体、枚举 | core-structure |
| 类型 | 值类型/引用类型/映射类型、运算符、类型转换 | core-types |
| 控制结构 | if/循环、内部/外部调用、revert、try/catch | core-control |
| 单位与全局变量 | 以太币/时间单位、block/msg/tx变量、ABI/哈希工具 | core-units-globals |
Features
功能特性
Contracts
合约
| Topic | Description | Reference |
|---|---|---|
| Contracts | Creation, visibility, modifiers, functions, events, errors, inheritance, interfaces, libraries, using-for | features-contracts |
| Inline Assembly | Yul in Solidity, access to variables, safety | features-assembly |
| Yul | Intermediate language, EVM opcodes, objects | features-yul |
| NatSpec | Tags, userdoc/devdoc output, @inheritdoc, @custom | features-natspec |
| Events | Indexed, anonymous, topics, selector, emit | features-events |
| Custom Errors | revert/require, selector, try/catch, ABI | features-errors |
| Libraries | DELEGATECALL, internal vs external, linking | features-libraries |
| Inheritance | virtual/override, super, C3, base constructors | features-inheritance |
| Interfaces | Restrictions, enum/struct, ABI alignment | features-interfaces |
| Transient Storage | EIP-1153, transaction-scoped, reentrancy locks | features-transient-storage |
| Visibility and Getters | external/public/internal/private, getter generation | features-visibility-getters |
| 主题 | 描述 | 参考 |
|---|---|---|
| 合约 | 创建、可见性、修饰器、函数、事件、错误、继承、接口、库、using-for | features-contracts |
| 内联汇编 | Solidity中的Yul、变量访问、安全性 | features-assembly |
| Yul | 中间语言、EVM操作码、对象 | features-yul |
| NatSpec | 标签、userdoc/devdoc输出、@inheritdoc、@custom | features-natspec |
| 事件 | 索引、匿名、主题、选择器、emit | features-events |
| 自定义错误 | revert/require、选择器、try/catch、ABI | features-errors |
| 库 | DELEGATECALL、内部与外部、链接 | features-libraries |
| 继承 | virtual/override、super、C3线性化、基类构造函数 | features-inheritance |
| 接口 | 限制、枚举/结构体、ABI对齐 | features-interfaces |
| 临时存储 | EIP-1153、事务作用域、重入锁 | features-transient-storage |
| 可见性与Getter | external/public/internal/private、自动生成Getter | features-visibility-getters |
Best Practices
最佳实践
| Topic | Description | Reference |
|---|---|---|
| Security | Reentrancy, gas, visibility, randomness, front-running | best-practices-security |
| Common Patterns | Withdrawal, access control, checks-effects-interactions, proxies | best-practices-patterns |
| Style and Layout | File/contract order, modifier order, naming | best-practices-style |
| 主题 | 描述 | 参考 |
|---|---|---|
| 安全 | 重入攻击、Gas优化、可见性、随机性、抢先交易 | best-practices-security |
| 常见模式 | 提取模式、访问控制、检查-效果-交互模式、代理 | best-practices-patterns |
| 风格与结构 | 文件/合约顺序、修饰器顺序、命名规范 | best-practices-style |
Advanced
进阶内容
| Topic | Description | Reference |
|---|---|---|
| Compiler | solc CLI, Standard JSON, optimizer, libraries, path resolution | advanced-compiler |
| Internals | Storage/memory/calldata layout, optimizer, source mappings | advanced-internals |
| ABI and Metadata | ABI spec, contract metadata, NatSpec | advanced-abi-metadata |
| SMTChecker | Formal verification, engines, targets, options | advanced-smtchecker |
| Path Resolution | VFS, base/include paths, remapping, allowed paths | advanced-path-resolution |
| Compilation Output | Bytecode, --asm, optimized vs non-optimized | advanced-compilation-output |
| 主题 | 描述 | 参考 |
|---|---|---|
| 编译器 | solc CLI、标准JSON、优化器、库、路径解析 | advanced-compiler |
| 内部机制 | 存储/内存/调用数据结构、优化器、源码映射 | advanced-internals |
| ABI与元数据 | ABI规范、合约元数据、NatSpec | advanced-abi-metadata |
| SMTChecker | 形式化验证、引擎、目标、选项 | advanced-smtchecker |
| 路径解析 | VFS、基础/包含路径、重映射、允许路径 | advanced-path-resolution |
| 编译输出 | 字节码、--asm、优化与非优化版本 | advanced-compilation-output |