Implement a price-removal entrypoint for services
Description
set_service_price in contracts/escrow/src/lib.rs can write or overwrite a price under DataKey::ServicePrice(service_id), but there is no way to remove the entry — the only way to make a previously-priced service free again is to write 0, which leaves a dangling stored key paying ledger rent and is semantically ambiguous (an explicit zero price vs. no price configured both read back as 0 from get_service_price). This issue adds an explicit removal entrypoint so operators can fully retire a price.
Requirements and context
- Repository scope:
Agentpay-Org/Agentpay-contracts only.
- Add
remove_service_price(env, service_id): admin-gated via the existing Admin + require_auth() pattern, calling env.storage().persistent().remove(&DataKey::ServicePrice(service_id)). Idempotent — removing an absent price is a no-op.
- Document that after removal
get_service_price and compute_billing read back as the 0 default, identical to a never-priced service.
- Emit a
price_removed(service_id) event (additive) so indexers can distinguish a removal from a set to zero.
- Honour the pause gate consistently with the other admin mutations.
Suggested execution
- Fork the repo and create a branch
git checkout -b feature/contracts-remove-service-price
- Implement changes
- Write code in:
contracts/escrow/src/lib.rs — remove_service_price entrypoint + event.
- Write comprehensive tests in:
contracts/escrow/src/test.rs — set then remove returns get_service_price == 0; remove on never-priced service is a no-op; non-admin caller panics; event fires.
- Add documentation: clarify the zero-vs-removed distinction in
README.md.
- Include NatSpec-style doc comments (
///) matching the existing style in lib.rs.
- Validate security: only admin can remove, no fund/billing inconsistency after removal.
- Test and commit
Test and commit
- Run
cargo fmt --all -- --check, cargo build, and cargo test.
- Cover edge cases: remove then re-set, remove an unregistered service's price, compute_billing after removal.
- Include the full
cargo test output and a short security notes section in the PR description.
Example commit message
feat: add remove_service_price to clear a configured service price
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the AgentPay community on Discord for questions, reviews, and faster merges: https://discord.gg/eXvRKkgcv
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Implement a price-removal entrypoint for services
Description
set_service_priceincontracts/escrow/src/lib.rscan write or overwrite a price underDataKey::ServicePrice(service_id), but there is no way to remove the entry — the only way to make a previously-priced service free again is to write0, which leaves a dangling stored key paying ledger rent and is semantically ambiguous (an explicit zero price vs. no price configured both read back as0fromget_service_price). This issue adds an explicit removal entrypoint so operators can fully retire a price.Requirements and context
Agentpay-Org/Agentpay-contractsonly.remove_service_price(env, service_id): admin-gated via the existingAdmin+require_auth()pattern, callingenv.storage().persistent().remove(&DataKey::ServicePrice(service_id)). Idempotent — removing an absent price is a no-op.get_service_priceandcompute_billingread back as the0default, identical to a never-priced service.price_removed(service_id)event (additive) so indexers can distinguish a removal from asetto zero.Suggested execution
git checkout -b feature/contracts-remove-service-pricecontracts/escrow/src/lib.rs—remove_service_priceentrypoint + event.contracts/escrow/src/test.rs— set then remove returnsget_service_price == 0; remove on never-priced service is a no-op; non-admin caller panics; event fires.README.md.///) matching the existing style inlib.rs.Test and commit
cargo fmt --all -- --check,cargo build, andcargo test.cargo testoutput and a short security notes section in the PR description.Example commit message
feat: add remove_service_price to clear a configured service priceGuidelines
Community & contribution rewards