Skip to content

Commit 78ed646

Browse files
Merge branch 'master' into fix/tx-priority-tx-matching
2 parents 7e52471 + 9f4396a commit 78ed646

27 files changed

Lines changed: 170 additions & 3405 deletions

CLAUDE.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,52 @@ Use BDD-style "should-when" naming for all tests. The test name should read as a
5252
- Avoid generic names like `test_1`, `it_works`, or `basic_test`.
5353
- One behavior per test — if you need "and" in the name, split it into two tests.
5454

55+
## Extrinsic documentation
56+
57+
Every public extrinsic in `#[pallet::call]` blocks must have a rustdoc comment that follows
58+
this standard structure. See `pallets/omnipool/src/lib.rs` and `pallets/stableswap/src/lib.rs`
59+
for canonical examples.
60+
61+
**Required sections (in order):**
62+
63+
1. **Description** — one-line summary, then any longer explanation as additional paragraphs.
64+
Cover what the extrinsic does, important preconditions, and notable side effects (NFT
65+
minting, hooks, tradability flags, error conditions worth highlighting).
66+
2. **Parameters** — a `Parameters:` block listing every argument as `` - `name`: description ``.
67+
Include `origin` when its required type is non-trivial (e.g. `T::AuthorityOrigin`).
68+
3. **Emitted events** — a final line of the form `` Emits `EventName` event when successful. ``
69+
If multiple events are emitted, list each on its own line.
70+
71+
**Format:**
72+
73+
```rust
74+
/// <One-line summary of what the extrinsic does.>
75+
///
76+
/// <Optional longer explanation: preconditions, side effects, error conditions,
77+
/// hook invocations, tradability flags, etc. Use multiple paragraphs as needed.>
78+
///
79+
/// Parameters:
80+
/// - `origin`: <only if origin type is non-trivial, e.g. Must be T::AuthorityOrigin>
81+
/// - `param_a`: <what it represents and any constraints>
82+
/// - `param_b`: <what it represents and any constraints>
83+
///
84+
/// Emits `SomethingHappened` event when successful.
85+
///
86+
#[pallet::call_index(N)]
87+
#[pallet::weight(...)]
88+
#[transactional]
89+
pub fn my_extrinsic(...) -> DispatchResult { ... }
90+
```
91+
92+
**Rules:**
93+
- Use `///` doc comments (rustdoc), not `//` line comments.
94+
- Blank `///` lines separate paragraphs and the three sections.
95+
- Wrap identifiers, types, and values in backticks (e.g. `` `asset_id` ``, `` `T::AuthorityOrigin` ``).
96+
- Phrase the emitted-events line consistently: `` Emits `X` event when successful. ``
97+
- If the extrinsic delegates to another (e.g. `add_liquidity``add_liquidity_with_limit`),
98+
still document it in full — do not rely on the reader following the delegation.
99+
- Keep parameter names in the doc identical to the function signature.
100+
55101
## Running tests
56102

57103
Dont't run tests with --release flag!

0 commit comments

Comments
 (0)