Skip to content

feat: settlement claim window#679

Open
EneGab wants to merge 2 commits into
CalloraOrg:mainfrom
EneGab:main
Open

feat: settlement claim window#679
EneGab wants to merge 2 commits into
CalloraOrg:mainfrom
EneGab:main

Conversation

@EneGab

@EneGab EneGab commented Jul 24, 2026

Copy link
Copy Markdown

Adds a configurable, admin-managed claim window that restricts when a developer can call withdraw_developer_balance to an inclusive [start_ts, end_ts] ledger-timestamp range. Developers with no configured window remain claimable at any time.

  • set_developer_claim_window / clear_developer_claim_window / get_developer_claim_window, enforced inside withdraw_developer_balance via ClaimWindowClosed (24) / InvalidClaimWindow (25)
  • Wires up admin.rs, errors.rs, events.rs, limits.rs, migrate.rs, pagination.rs, timelock.rs, and types.rs, which existed on disk but were never declared as modules in lib.rs from a prior bad merge, so the crate did not compile
  • Restores/implements entrypoints the existing test suite already assumed: two-step admin/vault rotation, upgrade, force_credit_developer, daily withdrawal cap, paginated balance views, and migration wrappers
  • Fixes a duplicate-field bug in pagination.rs, a missing require_auth in migrate_single_developer, and two incomplete event structs (DepositEvent, DeveloperForceCreditedEvent)
  • Adds claim window unit tests; updates ERROR_CODES.md, EVENTS_INDEX.md, and docs/interfaces/settlement.json for the new codes/event

Closes #631

Adds a configurable, admin-managed claim window that restricts when a
developer can call withdraw_developer_balance to an inclusive
[start_ts, end_ts] ledger-timestamp range. Developers with no
configured window remain claimable at any time.

- set_developer_claim_window / clear_developer_claim_window /
  get_developer_claim_window, enforced inside withdraw_developer_balance
  via ClaimWindowClosed (24) / InvalidClaimWindow (25)
- Wires up admin.rs, errors.rs, events.rs, limits.rs, migrate.rs,
  pagination.rs, timelock.rs, and types.rs, which existed on disk but
  were never declared as modules in lib.rs from a prior bad merge, so
  the crate did not compile
- Restores/implements entrypoints the existing test suite already
  assumed: two-step admin/vault rotation, upgrade, force_credit_developer,
  daily withdrawal cap, paginated balance views, and migration wrappers
- Fixes a duplicate-field bug in pagination.rs, a missing require_auth
  in migrate_single_developer, and two incomplete event structs
  (DepositEvent, DeveloperForceCreditedEvent)
- Adds claim window unit tests; updates ERROR_CODES.md, EVENTS_INDEX.md,
  and docs/interfaces/settlement.json for the new codes/event

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Jul 24, 2026

Copy link
Copy Markdown

@EneGab Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Root causes of the PR CalloraOrg#679 CI failures:
- Cargo.lock was gitignored, so every CI run re-resolved dependencies
  fresh and landed on an ed25519-dalek/rand_core combo that breaks
  soroban-env-host's own test-prng code. Lockfile is now committed.
- batch_withdraw_developer_balance_cursor exceeded Soroban's 32-byte
  contract function name limit; renamed (unreferenced elsewhere).
- Settlement lib.rs/test.rs were missing testutils trait imports
  (Instance/Persistent for get_ttl, IntoVal for event decoding).
- Several test-only bugs never previously caught because the crate
  didn't compile: duplicate shadowed `token` bindings, an events-read
  ordered after an event-less getter call, and require_auth called
  twice inside one as_contract frame in archive.rs's own tests.
- test_upgrade_and_get_version needed a real uploaded WASM hash;
  matched the existing upload_contract_wasm(Bytes::new()) pattern
  already used in vault/revenue_pool's own upgrade tests.
- cargo fmt --check and clippy -D warnings (both required by
  ci.yml's Test job) had never been run clean on settlement; fixed
  its lint violations and reformatted vault/revenue_pool (whitespace
  only) so the repo-wide fmt gate passes.
- EVENT_SCHEMA.md was missing docs for revenue_pool's pre-existing
  emergency_drain_{proposed,executed,cancelled} events, which the
  event-shape script checks repo-wide.

Not addressed here (pre-existing, unrelated to this PR, flagged
separately): ~63 clippy violations in vault/revenue_pool, and 17
wasm32-unknown-unknown compile errors in the vault crate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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 settlement claim window

1 participant