Implement a single read exposing the contract's global configuration
Description
Inspecting the escrow's global configuration in contracts/escrow/src/lib.rs today requires a fan-out of separate getters: is_paused, is_allowlist_enabled, is_service_registration_required, get_max_requests_per_call, get_min_requests_per_call, get_max_requests_per_window, get_rate_window_seconds, get_schema_version, and get_admin. A dashboard or health check must issue nine reads to render one config panel, and they can be inconsistent across ledgers. This issue adds a single read returning all global settings in one coherent struct.
Requirements and context
- Repository scope:
Agentpay-Org/Agentpay-contracts only.
- Add a
ContractConfig #[contracttype] carrying paused, allowlist_enabled, require_service_registration, max_requests_per_call, min_requests_per_call, max_requests_per_window, window_seconds, schema_version, and admin: Option<Address>, and a get_contract_config(env) -> ContractConfig read that reuses the existing getters' default semantics.
- This is a pure read — no
require_auth, no pause gate — consistent with the other getters; values must match the individual getters exactly (reuse them or the same unwrap_or defaults so they cannot drift).
- Keep the change purely additive; do not modify any existing getter.
- Document that the struct is a convenience snapshot and the per-field getters remain available.
Suggested execution
- Fork the repo and create a branch
git checkout -b feature/contracts-get-contract-config
- Implement changes
- Write code in:
contracts/escrow/src/lib.rs — ContractConfig type and get_contract_config reusing existing reads.
- Write comprehensive tests in:
contracts/escrow/src/test.rs — every field matches its individual getter on a fresh contract and after several config changes.
- Add documentation: document the config snapshot in
README.md.
- Include NatSpec-style doc comments (
///) matching the existing style in lib.rs.
- Validate security: read-only, no auth bypass, fields cannot diverge from the per-field getters.
- Test and commit
Test and commit
- Run
cargo fmt --all -- --check, cargo build, and cargo test.
- Cover edge cases: defaults on a fresh contract, after toggling pause/allowlist/strict, after setting bounds and window.
- Include the full
cargo test output and a short security notes section in the PR description.
Example commit message
feat: add get_contract_config single-read configuration snapshot
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 single read exposing the contract's global configuration
Description
Inspecting the escrow's global configuration in
contracts/escrow/src/lib.rstoday requires a fan-out of separate getters:is_paused,is_allowlist_enabled,is_service_registration_required,get_max_requests_per_call,get_min_requests_per_call,get_max_requests_per_window,get_rate_window_seconds,get_schema_version, andget_admin. A dashboard or health check must issue nine reads to render one config panel, and they can be inconsistent across ledgers. This issue adds a single read returning all global settings in one coherent struct.Requirements and context
Agentpay-Org/Agentpay-contractsonly.ContractConfig#[contracttype]carryingpaused,allowlist_enabled,require_service_registration,max_requests_per_call,min_requests_per_call,max_requests_per_window,window_seconds,schema_version, andadmin: Option<Address>, and aget_contract_config(env) -> ContractConfigread that reuses the existing getters' default semantics.require_auth, no pause gate — consistent with the other getters; values must match the individual getters exactly (reuse them or the sameunwrap_ordefaults so they cannot drift).Suggested execution
git checkout -b feature/contracts-get-contract-configcontracts/escrow/src/lib.rs—ContractConfigtype andget_contract_configreusing existing reads.contracts/escrow/src/test.rs— every field matches its individual getter on a fresh contract and after several config changes.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 get_contract_config single-read configuration snapshotGuidelines
Community & contribution rewards