Files
nexus/wiki/entities/Foundry.md
2026-04-21 00:02:55 +08:00

39 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Foundry"
type: entity
tags: [tool, development-framework, testing]
sources: [blockchain-security-auditor]
last_updated: 2026-04-20
---
## 定义
Foundry 是以太坊开发框架,包含 Forge智能合约测试工具和 Cast交互工具使用 Solidity 编写测试,支持高速测试执行和模糊测试。
## 核心功能
- **Forge**:智能合约测试框架
- **Cast**:链上交互 CLI
- **Anvil**:本地测试网络
- **Chisel**Solidity REPL
## 在审计中的应用
```solidity
// Foundry Exploit PoC 示例
contract FlashLoanOracleExploitTest is Test {
function test_oracleManipulationExploit() public {
// 复现漏洞的 Foundry 测试
}
}
```
## 与传统测试对比
| 特性 | Forge | Hardhat |
|------|-------|---------|
| 语言 | Solidity | JavaScript/TypeScript |
| 速度 | 快Rust | 较慢 |
| Fuzzing | 内置 | 需集成 Echidna |
## Connections
- [[Smart Contract Testing]] ← provides ← [[Foundry]]
- [[Invariant Verification]] ← supports ← [[Foundry]]