Skip to content

Commit

Permalink
treat empty wallet as existing
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanok committed May 1, 2020
1 parent 44351eb commit 62ecf8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if(opts.function == "transfer") {
if(getBalance(caller) >= qty) {
// Lower the token balance of the caller
let wl = modifyWallet(wallet_list, caller, -qty)
if(getBalance(target) > 0) {
if(getBalance(target) !== undefined) {
// Wallet already exists in state, add new tokens
wl = modifyWallet(wl, target, qty)
}
Expand Down Expand Up @@ -56,5 +56,5 @@ function getBalance(addr) {
return wallet_list[i].balance
}
}
return 0
return undefined
}

0 comments on commit 62ecf8a

Please sign in to comment.