Skip to content

test: buy-then-sell round-trip returns correct XLM to seller#568

Merged
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
soomtochukwu:test/560-buy-sell-round-trip-xlm
Jul 21, 2026
Merged

test: buy-then-sell round-trip returns correct XLM to seller#568
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
soomtochukwu:test/560-buy-sell-round-trip-xlm

Conversation

@soomtochukwu

Copy link
Copy Markdown
Contributor

Summary

I added an integration test for a sequential buy-then-sell round-trip starting from a fresh creator at supply 0. After buying one key and selling it immediately, the seller’s net proceeds match the sell-step price minus creator and protocol fees, and supply returns to 0.

I only tackled issue #560. No contract logic or unrelated tests were changed.

What the test asserts

  • Fresh creator supply is 0 before the buy
  • Buy succeeds (supply 1, key balance 1); buyer payment = buy quote total_amount (price + fees); fee ledgers move by quote fees
  • Sell quote net = price - creator_fee - protocol_fee and matches compute_fees_for_payment
  • Sell succeeds; supply and key balance return to 0; sell fee ledgers increase by quote fees
  • Seller XLM in (quote net) is less than buyer XLM out (fees make the round-trip non-free)

Related Issue

Closes #560

Test plan

cargo test -p creator-keys --test buy_sell_round_trip_proceeds
# test test_buy_then_sell_round_trip_returns_correct_xlm_to_seller ... ok

Scope

I only resolved #560.

Add integration test from supply 0: buy one key, sell it, assert seller
net XLM equals sell-price minus creator and protocol fees, and supply
returns to 0. Addresses issue accesslayerorg#560 only.
Fix cargo fmt --check failures that blocked the verify CI job.
@Chucks1093
Chucks1093 merged commit 65d2ef2 into accesslayerorg:main Jul 21, 2026
1 check passed
@Chucks1093

Copy link
Copy Markdown
Contributor

Nice work @soomtochukwu . I will merge this now and hit up when I create more issues on accesslayer.

Thanks for contributing

@soomtochukwu

Copy link
Copy Markdown
Contributor Author

Nice work @soomtochukwu . I will merge this now and hit up when I create more issues on accesslayer.

Thanks for contributing

... looking forward to it :)

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 integration test for sequential buy and sell round-trip returning correct XLM to seller

2 participants