Skip to content

feat(creator-keys): add transfer entrypoint and enforce unique holder…#436

Open
N-thnI wants to merge 2 commits into
accesslayerorg:mainfrom
N-thnI:test/holder-count-balance-edges
Open

feat(creator-keys): add transfer entrypoint and enforce unique holder…#436
N-thnI wants to merge 2 commits into
accesslayerorg:mainfrom
N-thnI:test/holder-count-balance-edges

Conversation

@N-thnI

@N-thnI N-thnI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

… count state invariants

Summary

Description

This PR implements a direct key transfer entrypoint (transfer_key) to the contract surface and ensures that unique holder_count metrics adjust accurately based on pre- and post-transfer balances.

Scope of Changes

  • Contract Surface Modification: Introduced a lightweight transfer_key function utilizing existing balance and dividend-settlement checkpoints.
  • Holder Count Tracking: - Decrements holder_count when a sender transfers their entire remaining balance.
    • Increments holder_count when a recipient acquires keys for the first time.
    • Keeps holder_count unchanged on partial transfers where the sender retains assets.
  • Targeted Unit Tests: Added explicit state assertions verifying all three core edge cases.

Verification Checklist

  • Full transfer out decrements unique holder count.
  • First-time recipient increments unique holder count.
  • Partial transfer leaves unique holder count unaffected.
  • Changes isolated exclusively to the transfer pipeline and associated tests.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace

Checklist

  • Linked issue or backlog item
  • Added or updated creator-keys unit/integration tests for every changed contract behavior, including failure paths for new or reachable ContractError variants
  • Ran cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace, or explained exactly why a command was not run
  • Reviewed persistent storage changes against docs/storage-key-invariants.md; any storage layout change includes a migration/backward-compatibility note
  • Confirmed event names, topic order, payload field order, and field meanings remain compatible with docs/contract-event-conventions.md, or documented the breaking change and versioning plan
  • Updated docs for any changed public contract interface, read-only method, event schema, storage behavior, fee logic, or deployment workflow
  • Scope stays limited to one contract concern and does not include unrelated formatting, lockfile, generated artifact, or dependency changes

closes #422

@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@N-thnI 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

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 unit tests for transfer holder count update when sender balance reaches zero

1 participant