Skip to content

feat: add remove_service_price to clear a configured service price#65

Merged
mikewheeleer merged 1 commit into
Agentpay-Org:mainfrom
Baskarayelu:feature/contracts-remove-service-price
Jun 24, 2026
Merged

feat: add remove_service_price to clear a configured service price#65
mikewheeleer merged 1 commit into
Agentpay-Org:mainfrom
Baskarayelu:feature/contracts-remove-service-price

Conversation

@Baskarayelu

Copy link
Copy Markdown
Contributor

Summary

Adds remove_service_price(service_id) to the escrow contract, letting the admin
clear a previously configured per-request price and free its storage slot.

Removed vs. set-to-zero

After removal, get_service_price and compute_billing read back 0, exactly
as for a never-priced service. The distinction is about storage, not the read
value: removal frees the storage slot and emits price_rm, whereas
set_service_price(service_id, 0) leaves a stored slot holding 0. Documented
in the /// docs and README.md.

Security notes

  • State-changing entrypoint, so it is pause-gated and admin-authenticated like
    the sibling pricing/admin mutations.
  • Read-only billing paths already default missing prices to 0, so freeing the
    slot cannot under/over-bill; usage counters are left untouched.
  • Idempotent removal cannot panic on absent slots, avoiding a griefing surface.

Tests

set price then remove -> 0; idempotent no-op on never-priced; remove then
re-set; compute_billing is 0 after removal; non-admin caller is rejected;
price_rm event payload asserted via testutils Events; remove while paused
panics #4.

Closes #35

test result: ok. 58 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mikewheeleer mikewheeleer merged commit 2972c79 into Agentpay-Org:main Jun 24, 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.

Add remove_service_price to clear a configured price and revert a service to free

2 participants