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.
Context
If the payer's SAC balance is lower than
amount,token.transferwill panic inside the contract. Surfacing this earlier gives a clearer failure.Acceptance criteria
token.transfer, readtoken.balance(&payer)and abort with a clear message if it is< amount.Technical notes
TokenClientexposesbalance(client, account).statusunchanged.Testing
pay_insufficient_balance_failstest using a mock token with a low balance.