Skip to content

Commit

Permalink
Update token.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cedriking authored Jun 1, 2021
1 parent 7cbe555 commit 788a974
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export function handle (state, action) {
if (qty <= 0 || caller === target) {
throw new ContractError('Invalid token transfer')
}

if (!(caller in balances)) {
throw new ContractError("Caller doesn't have a balance.");
}

if (balances[caller] < qty) {
throw new ContractError(`Caller balance not high enough to send ${qty} token(s)!`)
Expand Down

0 comments on commit 788a974

Please sign in to comment.