test: assert creator fee recipient balance on buy#339
Merged
Conversation
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
|
@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! 🚀 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_keyexecution.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
buy_keywhen a fee config is set, keyed per creator.get_creator_fee_balanceread-only accessor for test and indexer use.buy_creator_fee_recipient_balanceintegration test with a fixed 90/10 fixture (KEY_PRICE = 1000, expected creator fee900).compute_expected_creator_feefixture helper and document the new read method.How to Test
cargo test --test buy_creator_fee_recipient_balance.test_buy_credits_creator_fee_recipient_balance_by_bps_amountpasses.cargo test --workspaceto verify no regressions in related buy and fee tests.Expected: recipient balance is
0before buy, then increases by900(90% of1000) and matchesget_buy_quote().creator_fee.Breaking Changes
Related Issues
Closes #297
Checklist