Merge pull request #946 from nspcc-dev/examples/nep5-transfer-bug

examples: Use "or" operator in transfer check of NEP5 token
This commit is contained in:
Roman Khimov 2020-05-12 16:58:26 +03:00 committed by GitHub
commit 9eaec2adcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,7 @@ func (t Token) Transfer(ctx storage.Context, from []byte, to []byte, amount int)
// CanTransfer returns the amount it can transfer
func (t Token) CanTransfer(ctx storage.Context, from []byte, to []byte, amount int) int {
if len(to) != 20 && !IsUsableAddress(from) {
if len(to) != 20 || !IsUsableAddress(from) {
return -1
}