native: provide name method for all contracts

This commit is contained in:
Evgenii Stratonikov 2020-10-09 15:06:28 +03:00
parent eb9b1cae36
commit 42ff4a8fc7
6 changed files with 45 additions and 5 deletions

View file

@ -2,8 +2,10 @@ package native
import (
"github.com/nspcc-dev/neo-go/pkg/core/dao"
"github.com/nspcc-dev/neo-go/pkg/core/interop"
"github.com/nspcc-dev/neo-go/pkg/core/storage"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
)
func getSerializableFromDAO(id int32, d dao.DAO, key []byte, item io.Serializable) error {
@ -15,3 +17,9 @@ func getSerializableFromDAO(id int32, d dao.DAO, key []byte, item io.Serializabl
item.DecodeBinary(r)
return r.Err
}
func nameMethod(name string) interop.Method {
return func(_ *interop.Context, _ []stackitem.Item) stackitem.Item {
return stackitem.NewByteArray([]byte(name))
}
}