Merge pull request #945 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:44:15 +03:00 committed by GitHub
commit c85e77e1c9
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
}