Skip to content

feat: add read_creator_supply helper, storage key collision tests, and integration tests - #602

Merged
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
Lekan101:fix/issues-587-597-598-600
Jul 25, 2026
Merged

Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
Lekan101:fix/issues-587-597-598-600

Conversation

@Lekan101

Copy link
Copy Markdown

Summary

This PR addresses four open issues by adding a storage helper, unit tests for key collision prevention, and integration tests for buy/sell fee distribution and partial sell balance tracking.

Changes

Issue #587 — Add helper for reading a creator's current key supply from persistent storage

  • Added helper that centralises creator supply reads
  • Updated to delegate to the new helper
  • Added 3 unit tests: initialized creator returns correct supply, uninitialized creator returns 0, and consistency with

Issue #597 — Add unit tests for storage key helpers confirming no collisions

  • Added 16 unit tests covering all composite key helpers:
    • : different holders, argument order, cross-type collisions
    • : different holders
    • : different holders
    • : different pairs and creators
    • : different creators
    • Cross-type: holder balance vs creator key, dividend accumulator, creator fee balance
    • , , , : different creators

Issue #598 — Add integration test for protocol fee distributed correctly on buy

  • Created with 5 tests:
    • Protocol fee recipient balance increases by exact bps-derived fee
    • Test passes with two different protocol fee bps values (1000 and 2500)
    • Protocol fee accumulates across multiple buys
    • Protocol fee recipient does not receive creator fee
    • Fee amount uses floor division

Issue #600 — Add integration test for holder balance correctly decremented after partial sell

  • Created with 6 tests:
    • Holder balance decrements by exact sold quantity
    • Creator supply decrements by the same amount
    • Two sequential partial sells each produce correct balance
    • Holder entry not removed after partial sell
    • Full sell removes holder entry
    • Supply equals balance when single holder

Test Results

All 81 unit tests and all new integration tests pass.

running 81 tests (lib) ... ok
running 5 tests (buy_protocol_fee_recipient_balance) ... ok
running 6 tests (partial_sell_holder_balance) ... ok

Closes #587
Closes #597
Closes #598
Closes #600

…d integration tests

- Add read_creator_supply helper for centralised creator supply reads (accesslayerorg#587)
- Add unit tests confirming no two distinct inputs produce the same storage key (accesslayerorg#597)
- Add integration test for protocol fee distributed correctly to protocol fee recipient on buy (accesslayerorg#598)
- Add integration test for holder balance correctly decremented after a partial sell (accesslayerorg#600)
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Lekan101 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

@Chucks1093
Chucks1093 merged commit 0de5761 into accesslayerorg:main Jul 25, 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

3 participants