commit
免费Handle git commits with auto-staging, targeted pre-commit formatting, and Conventional Commit messages. Use when the user says commit it, commit this, commit changes, save my changes, or similar git commit requests.
中文简介正在准备中。当前显示原文说明。
Generate Foundry unit tests for a contract using this repository's conventions, structure, and naming. Use when the user asks for unit tests, Foundry tests, concrete tests, or fuzz tests.
中文简介正在准备中。当前显示原文说明。
实测评分 未实测
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Generate Foundry unit tests for a specific contract following this repository's established directory layout, inheritance chain, setup order, and test naming rules.
contracts/tests/unit/<category>/<ContractName>/
├── shared/
│ └── Shared.sol
├── concrete/
│ ├── FunctionA.t.sol
│ ├── FunctionB.t.sol
│ └── ViewFunctions.t.sol
└── fuzz/
├── FunctionA.fuzz.t.sol
└── FunctionB.fuzz.t.sol
Rules:
ViewFunctions.t.solAdmin.t.sol or Config.t.solforge-std/Test
└─ Base
└─ Unit_Shared_Test
├─ Unit_Concrete_<Contract>_<Feature>_Test
└─ Unit_Fuzz_<Contract>_<Feature>_Test
Base owns shared actors, constants, and IERC20 external token refs. All typed contract/proxy/mock state variables are declared in each Shared.t.sol file (not in Base). This keeps Base lightweight so changes don't invalidate the entire Forge cache.
Tests must interact with contracts through interfaces, not concrete implementations. See contracts/tests/README.md for full details.
Available interfaces:
| Interface | File | Used for |
|---|---|---|
IVault | contracts/interfaces/IVault.sol | All vault contracts |
IOToken | contracts/interfaces/IOToken.sol | All rebasing tokens (OUSD, OETH, OETHBase) |
IWOToken | contracts/interfaces/IWOToken.sol | All wrapped tokens (WOETH, WOETHBase, WOETHPlume, WrappedOusd) |
IProxy | contracts/interfaces/IProxy.sol | All proxy instances |
| Strategy interfaces | contracts/interfaces/strategies/ | Per-strategy interfaces (ICurveAMOStrategy, ICompoundingStakingStrategy, etc.) |
Key rules:
vm.deployCode instead of new (except mocks), and always reference artifact paths through tests/utils/Artifacts.sol (e.g. vm.deployCode(Vaults.OUSD, abi.encode(address(usdc)))); add the entry to the relevant sub-library if it does not exist yetemit IVault.CapitalPaused();vault.withdrawalQueueMetadata().claimable| Product | Token | Vault | Artifacts reference |
|---|---|---|---|
| OUSD | OUSD | OUSDVault | Vaults.OUSD |
| OETH | OETH | OETHVault | Vaults.OETH |
| OETHBase | OETHBase | OETHBaseVault | Vaults.OETH_BASE |
Add the entry to tests/utils/Artifacts.sol if it does not exist yet.
shared/Shared.sol should keep setup in this order:
function setUp() public virtual override {
super.setUp();
vm.warp(7 days);
_deployMockContracts();
_deployContracts();
_configureContracts();
_fundInitialUsers();
label();
}
Key rules:
vm.deployCode, then proxies with vm.deployCode(Proxies.IG_PROXY); all artifact paths (including the proxy) come from tests/utils/Artifacts.sol — never inline a "contracts/...sol:Name" string in a test fileproxy.initialize(impl, governor, initData)ousd = IOToken(address(ousdProxy))vm.startPrank(governor) for config blocksvm.deployCode loads from compiled artifacts; always run forge build contracts/ before forge test after modifying contract sourceMocks:
tests/mocks/contracts/mocks/ should usually be extended in placeFile and contract naming:
concrete/RebaseOptIn.t.sol
Unit_Concrete_<ContractName>_RebaseOptIn_Test
Function naming patterns:
test_<function>()test_<function>_<behavior>()test_<function>_RevertWhen_<condition>()test_<function>_emits<EventName>()Casing rules:
camelCaseRevertWhen is the only PascalCase token in the test nameUse exact revert strings with vm.expectRevert("...").
Emit events from interfaces, not concrete contracts:
vm.expectEmit(true, true, true, true);
emit IVault.EventName(arg1, arg2);
Contract name pattern:
Unit_Fuzz_<ContractName>_<Feature>_Test
Function pattern:
/// @notice Plain-English property description
function testFuzz_<function>_<property>(...) public { ... }
Rules:
bound() over vm.assume()assertEq for exact mathassertApproxEqAbs where rounding is expectedTypical ranges in this repo:
bound(amount, 1, 1e12)bound(amount, 1e12, 100e18)bound(bps, 1, 5000)bound(yield_, 1, 3e5)Match the repository's fuzz configuration in contracts/foundry.toml when relevant. Keep tests deterministic and consistent with existing suite conventions.
When implementing tests:
vm.deployCode, not new (mocks are fine with new), and reference all artifact paths through tests/utils/Artifacts.sol — no inline "contracts/...sol:Name" stringsShared.sol rather than duplicating setup across test files还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Handle git commits with auto-staging, targeted pre-commit formatting, and Conventional Commit messages. Use when the user says commit it, commit this, commit changes, save my changes, or similar git commit requests.
中文简介正在准备中。当前显示原文说明。
Generate Foundry fork tests for contracts that need real on-chain integration coverage. Use when the user asks for fork tests, mainnet or chain fork coverage, or integration tests against live protocol state.
中文简介正在准备中。当前显示原文说明。
Reorganize Foundry test files (*.t.sol) for readability and consistency without changing semantics. Use when the user asks to organize, reorder, clean up, tidy, or reformat a test file's structure.
中文简介正在准备中。当前显示原文说明。
Generate Foundry smoke tests that validate deployment health using DeployManager/Resolver against real on-chain state with pending governance applied. Use when the user asks for smoke tests, deployment verification tests, or post-deploy health checks.
中文简介正在准备中。当前显示原文说明。
Develop, modify, review, and maintain standalone Talos actions in contracts/tasks/actions, including chain guardrails, contract bindings, transaction safety, schedules, action catalogues, and Talos documentation. Use when adding an action, changing an action’s behavior or parameters, updating a Talos schedule, or maintaining action runtime support.
中文简介正在准备中。当前显示原文说明。
Verifies a POST-EXECUTION mainnet (or other network) smart-contract deployment PR for this repo: confirms every deployed contract is listed in the PR description, that the on-chain verified source (and its dependencies) matches the codebase via `sol2uml diff`, that constructor args and the initialize tx match the Foundry script, and that the on-chain governance proposal matches the script's actions. Use when asked to review, verify, audit, or sign off on an executed deployment PR. Invoke explicitly with /verify-deployment-pr <PR#>.
中文简介正在准备中。当前显示原文说明。