2021-02-02 18:34:17 +00:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
2021-03-12 12:16:36 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/native/std"
|
2021-02-02 18:34:17 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
|
|
|
)
|
|
|
|
|
|
|
|
func GetList(ctx storage.Context, key interface{}) [][]byte {
|
|
|
|
data := storage.Get(ctx, key)
|
|
|
|
if data != nil {
|
2021-03-12 12:16:36 +00:00
|
|
|
return std.Deserialize(data.([]byte)).([][]byte)
|
2021-02-02 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return [][]byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSerialized serializes data and puts it into contract storage.
|
|
|
|
func SetSerialized(ctx storage.Context, key interface{}, value interface{}) {
|
2021-03-12 12:16:36 +00:00
|
|
|
data := std.Serialize(value)
|
2021-02-02 18:34:17 +00:00
|
|
|
storage.Put(ctx, key, data)
|
|
|
|
}
|