Skip to content

Pre-check token balance before pay transfer #10

Description

@iexwr

Context

If the payer's SAC balance is lower than amount, token.transfer will panic inside the contract. Surfacing this earlier gives a clearer failure.

Acceptance criteria

  • Before token.transfer, read token.balance(&payer) and abort with a clear message if it is < amount.
  • Add a test where the payer has insufficient balance and the call aborts before state changes.

Technical notes

  • TokenClient exposes balance(client, account).
  • Keep the transfer as the last mutating step so a failed pre-check leaves status unchanged.

Testing

  • pay_insufficient_balance_fails test using a mock token with a low balance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveStellar Wave for StackPayenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions