Skip to content

docs(fees): document the pricing model and its invariants - #430

Merged
mikewheeleer merged 2 commits into
Agentpay-Org:mainfrom
Jagadeeshftw:docs/fees-01-model
Jul 28, 2026
Merged

docs(fees): document the pricing model and its invariants#430
mikewheeleer merged 2 commits into
Agentpay-Org:mainfrom
Jagadeeshftw:docs/fees-01-model

Conversation

@Jagadeeshftw

Copy link
Copy Markdown
Contributor

Summary

docs/escrow/pricing.md covered flat-rate and tiered billing but never documented set_price_bounds/get_min_service_price/get_max_service_price, even though set_service_price has enforced them since they were added. Adds a new "Global price bounds" section plus API-reference and security-notes entries:

  • Documents defaults, the PriceOutOfBounds / InvertedPriceBand errors, and the zero-is-free-vs-floor interaction.
  • Notes bounds are write-time-only (not retroactive to already-stored prices).
  • Invariant gap found and documented: set_price_tiers never consults MinServicePrice/MaxServicePrice — a tier price can bypass the global bounds that set_service_price enforces for the same value. Not fixed here; flagged as a known asymmetry for anyone relying on the bounds as a hard invariant.
  • Links both pricing.md and (already-existing) doc conventions consistently — pricing.md itself wasn't linked from the README's documentation index; added that too.

No contract code changes — docs only.

Closes #296

Validation

  • cargo fmt --all -- --check
  • cargo build -p escrow
  • cargo test -p escrow — 352 passed, 1 pre-existing failure unrelated to this change (test_transfer_service_ownership_genuine_transfer_emits_event, fails identically on main)

env.events().all() reflects only the most recent contract invocation, not
a running total across separate calls (consistent with every other event
test in this file). The test compared post-transfer event count against a
pre-transfer count captured after a *different* call (set_service_metadata),
expecting accumulation that never happens, so it failed on every run
regardless of contract behavior. Fixed to assert directly on this call's
own event count.
@mikewheeleer
mikewheeleer merged commit 41ee366 into Agentpay-Org:main Jul 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document the fees model and its invariants

2 participants