Skip to content

Add unit tests for the buy function panicking with insufficient_funds when the buyer sends less XLM than the required cost #708

Description

@Chucks1093

Summary

The buy function must verify the attached XLM payment covers the full cost including fees before executing. Unit tests should confirm underpayment panics with the correct error and that the exact required amount succeeds.

Scope

  • Test sending exactly the required amount (cost + fees) succeeds
  • Test sending 1 stroop less than required panics with insufficient_funds
  • Test sending more than required succeeds and does not refund the excess (excess handled by caller)
  • Test sending 0 XLM panics with insufficient_funds
  • Assert no supply change or event emitted on any panic

Acceptance Criteria

  • Exact required amount succeeds
  • 1 stroop short panics with insufficient_funds
  • Zero XLM panics with insufficient_funds
  • No supply change or event on panic

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions