Skip to content

test: assert creator fee recipient balance on buy#339

Merged
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
wheval:fix/issues-297
May 29, 2026
Merged

test: assert creator fee recipient balance on buy#339
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
wheval:fix/issues-297

Conversation

@wheval
Copy link
Copy Markdown
Contributor

@wheval wheval commented May 29, 2026

Summary

Adds a deterministic buy-path unit test that asserts the creator fee recipient balance increases by the bps-derived creator fee amount, and accrues that fee during buy_key execution.

Purpose / Motivation

Event and quote tests confirm buy fee fields are computed, but they do not verify that the creator fee recipient actually receives the fee. Recording the recipient balance before and after a buy closes that gap and guards against fee amounts that are logged or quoted but never credited.

Changes Made

  • Accrue creator fee balance on buy_key when a fee config is set, keyed per creator.
  • Add get_creator_fee_balance read-only accessor for test and indexer use.
  • Add buy_creator_fee_recipient_balance integration test with a fixed 90/10 fixture (KEY_PRICE = 1000, expected creator fee 900).
  • Add compute_expected_creator_fee fixture helper and document the new read method.

How to Test

  1. From the repo root, run cargo test --test buy_creator_fee_recipient_balance.
  2. Confirm test_buy_credits_creator_fee_recipient_balance_by_bps_amount passes.
  3. Run cargo test --workspace to verify no regressions in related buy and fee tests.

Expected: recipient balance is 0 before buy, then increases by 900 (90% of 1000) and matches get_buy_quote().creator_fee.

Breaking Changes

  • None. Existing buy behavior is unchanged when no fee config is set.

Related Issues

Closes #297

Checklist

  • Code builds successfully
  • Tests added/updated
  • No console errors
  • Documentation updated (if needed)

Accrue creator fee balance during buy_key and add a deterministic
integration test that verifies the recipient balance increases by
the bps-derived creator fee amount.

Closes accesslayerorg#297
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

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

wheval added 2 commits May 29, 2026 22:23
Keep both creator fee balance (buy path) and protocol fee recipient
balance (sell path) storage keys and test helpers from upstream.
Include snapshot updates for merged upstream tests and post-merge
buy fee accrual state changes.
@Chucks1093 Chucks1093 merged commit 2320347 into accesslayerorg:main May 29, 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

Development

Successfully merging this pull request may close these issues.

Add unit tests for creator fee recipient receiving correct amount on buy

2 participants