rpcsrv: use more robust NEP-11 divisibility check

It's more heavyweight at the same time, but should be OK for the
purpose. Inspired by https://github.com/neo-project/neo-modules/issues/754#issuecomment-1345176986
This commit is contained in:
Roman Khimov 2022-12-10 11:35:03 +03:00
parent 628f04769b
commit c1afaf8ea8

View file

@ -48,6 +48,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest" "github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest/standard"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" "github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm" "github.com/nspcc-dev/neo-go/pkg/vm"
@ -931,7 +932,7 @@ contract_loop:
if cs == nil { if cs == nil {
continue continue
} }
isDivisible := (cs.Manifest.ABI.GetMethod("balanceOf", 2) != nil) isDivisible := (standard.ComplyABI(&cs.Manifest, standard.Nep11Divisible) == nil)
lub, ok := lastUpdated[cs.ID] lub, ok := lastUpdated[cs.ID]
if !ok { if !ok {
cfg := s.chain.GetConfig() cfg := s.chain.GetConfig()