Skip to content

Track lifetime settled amounts per agent#144

Open
jamilahmadzai wants to merge 1 commit into
Agentpay-Org:mainfrom
jamilahmadzai:codex/agentpay-82-settled-counters
Open

Track lifetime settled amounts per agent#144
jamilahmadzai wants to merge 1 commit into
Agentpay-Org:mainfrom
jamilahmadzai:codex/agentpay-82-settled-counters

Conversation

@jamilahmadzai

@jamilahmadzai jamilahmadzai commented Jul 2, 2026

Copy link
Copy Markdown

Summary

  • Add lifetime settled-value counters for each agent and for the full protocol.
  • Update both settle and settle_all to add positive billed stroops with saturating arithmetic.
  • Add read entrypoints, regression tests, README notes, and storage/API reference docs.

Closes #82

Bounty: GrantFox OSS campaign for issue #82

Security notes

  • Counters are monotonic: non-positive bills leave settled totals unchanged, and positive bills use saturating_add to clamp at i128::MAX instead of overflowing.
  • The existing settled event payload is unchanged.
  • settle_all is included so batch drains cannot undercount lifetime settled value compared with single-service settle.
  • New getters default to 0 for fresh agents/deployments.

Validation

  • cargo fmt --all -- --check
  • cargo build
  • cargo test -p escrow total_settled -- --nocapture (5 passed)
  • GitHub CI currently fails in the clippy step with the same existing escrow test-module warnings present on main (262c66b, latest main CI run 28393140941 also failed with could not compile escrow (lib test) due to 155 previous errors).
  • cargo test currently fails on existing baseline failures reproducible from clean main, including the owner-scoped settlement expectation tests and event-count tests unrelated to this change.

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.

Track and expose a per-agent lifetime settled-amount counter

1 participant