Skip to content

Commit

Permalink
token.js throw error on invalid balance call
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanok committed Jun 24, 2020
1 parent 61ef3b4 commit 413a689
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ export function handle(state, action) {
}

if (input.function == 'balance') {
if (typeof input.target !== 'string') {
throw new ContractError(`Must specific target to get balance for`);
}
if (typeof balances[target] !== 'number') {
throw new ContractError(`Cannnot get balance, target does not exist`);
}
let target = input.target;
let ticker = state.ticker;
let divisibility = state.divisibility;
Expand Down

0 comments on commit 413a689

Please sign in to comment.