docs: AfterSwap commission_amount excludes book fees (L7) #80

Closed
opened 2026-04-09 03:24:13 +00:00 by PlasticDigits · 8 comments
PlasticDigits commented 2026-04-09 03:24:13 +00:00 (Migrated from gitlab.com)

Type

security-hardening (integrator clarity)

Evidence

  • SECURITY_REVIEW.md SC-01; invariant L7

Acceptance criteria

  • docs/integrators.md (or hook README) states pool-leg-only commission in hooks for hybrid txs

Epic

#60

## Type **security-hardening** (integrator clarity) ## Evidence - `SECURITY_REVIEW.md` SC-01; invariant **L7** ## Acceptance criteria - [ ] `docs/integrators.md` (or hook README) states pool-leg-only commission in hooks for hybrid txs ## Epic #60
PlasticDigits commented 2026-04-09 03:24:14 +00:00 (Migrated from gitlab.com)

marked this issue as related to #60

marked this issue as related to #60
PlasticDigits commented 2026-04-09 03:24:15 +00:00 (Migrated from gitlab.com)

marked this issue as related to #63

marked this issue as related to #63
PlasticDigits commented 2026-04-13 11:35:32 +00:00 (Migrated from gitlab.com)

@brouie Please verify: added docs/integrators.md (L7 hybrid hooks, limit-book 50/50 fees, max_spread/belief semantics), linked from docs/README.md, and tightened SC-08 evidence in docs/reviews/20260409T030009Z/SECURITY_REVIEW.md. Pair has new max_spread regression tests in contract.rs (hybrid denominator + belief path). Run: cargo test -p cl8y-dex-pair

@brouie Please verify: added docs/integrators.md (L7 hybrid hooks, limit-book 50/50 fees, max_spread/belief semantics), linked from docs/README.md, and tightened SC-08 evidence in docs/reviews/20260409T030009Z/SECURITY_REVIEW.md. Pair has new max_spread regression tests in contract.rs (hybrid denominator + belief path). Run: cargo test -p cl8y-dex-pair
PlasticDigits commented 2026-04-13 12:54:17 +00:00 (Migrated from gitlab.com)

Added smartcontracts/contracts/hooks/README.md stating that on hybrid swaps AfterSwap.commission_amount / spread_amount are pool-leg only, with pointer to docs/integrators.md (L7). The integrators doc already described this; hook crate README now surfaces it for implementers.

Implemented in main (commit c262c42). @brouie please review.

Added `smartcontracts/contracts/hooks/README.md` stating that on hybrid swaps `AfterSwap.commission_amount` / `spread_amount` are **pool-leg only**, with pointer to `docs/integrators.md` (L7). The integrators doc already described this; hook crate README now surfaces it for implementers. Implemented in `main` (commit c262c42). @brouie please review.
Brouie commented 2026-04-20 06:45:38 +00:00 (Migrated from gitlab.com)

@PlasticDigits Verified on current main. Acceptance criteria:

  • docs/integrators.md (or hook README) states pool-leg-only commission in hooks for hybrid txs: BOTH surfaces implemented.

docs/integrators.md (line 5 'Hybrid swaps and post-swap hooks (invariant L7)') -- explicitly states commission_amount is 'Pool leg only — CW20 amount sent to treasury from the constant-product leg' (line 12). Line 15: 'Book-side fees are collected inside the book match path (limit_order_fill events, treasury transfers in token0/token1 per side). Do not treat commission_amount in AfterSwap as the full protocol fee for the transaction.' Canonical refs to contracts-security-audit.md (L7) and limit-orders.md on line 17. Linked from docs/README.md line 9.

smartcontracts/contracts/hooks/README.md line 5 'AfterSwap fields on hybrid swaps (invariant L7)' -- states commission_amount and spread_amount are pool-leg only, total user output in return_asset.amount includes book net + pool net, taker fees attributed on limit_order_fill events. Points to docs/integrators.md.

Security review: SC-01 (line 11) and SC-08 (line 79) both present in docs/reviews/20260409T030009Z/SECURITY_REVIEW.md, evidence tightened per dev comment.

Integrator clarity on L7 properly documented at both the integrator doc level and hook README level. Closing.

@PlasticDigits Verified on current main. Acceptance criteria: - [x] docs/integrators.md (or hook README) states pool-leg-only commission in hooks for hybrid txs: BOTH surfaces implemented. **docs/integrators.md** (line 5 'Hybrid swaps and post-swap hooks (invariant L7)') -- explicitly states commission_amount is 'Pool leg only — CW20 amount sent to treasury from the constant-product leg' (line 12). Line 15: 'Book-side fees are collected inside the book match path (limit_order_fill events, treasury transfers in token0/token1 per side). Do not treat commission_amount in AfterSwap as the full protocol fee for the transaction.' Canonical refs to contracts-security-audit.md (L7) and limit-orders.md on line 17. Linked from docs/README.md line 9. **smartcontracts/contracts/hooks/README.md** line 5 'AfterSwap fields on hybrid swaps (invariant L7)' -- states commission_amount and spread_amount are pool-leg only, total user output in return_asset.amount includes book net + pool net, taker fees attributed on limit_order_fill events. Points to docs/integrators.md. **Security review:** SC-01 (line 11) and SC-08 (line 79) both present in docs/reviews/20260409T030009Z/SECURITY_REVIEW.md, evidence tightened per dev comment. Integrator clarity on L7 properly documented at both the integrator doc level and hook README level. Closing.
Brouie (Migrated from gitlab.com) closed this issue 2026-04-20 06:45:40 +00:00
Brouie commented 2026-04-20 07:18:46 +00:00 (Migrated from gitlab.com)

mentioned in issue #96

mentioned in issue #96
Brouie commented 2026-04-20 07:26:42 +00:00 (Migrated from gitlab.com)

mentioned in issue #100

mentioned in issue #100
PlasticDigits commented 2026-05-26 07:59:57 +00:00 (Migrated from gitlab.com)

mentioned in issue #196

mentioned in issue #196
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#80
No description provided.