mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 13:41:47 +00:00
6b21ad9922
Everywhere including examples, external interop APIs, bindings generators code and in other valuable places. A couple of `interface{}` usages are intentionally left in the CHANGELOG.md, documentation and tests.
34 lines
940 B
Go
34 lines
940 B
Go
/*
|
|
Package storage contains contract that puts a set of values inside the storage on
|
|
deploy. The contract has a single method returning iterator over these values.
|
|
The contract is aimed to test iterator sessions RPC API.
|
|
*/
|
|
package storage
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
|
)
|
|
|
|
// valuesCount is the amount of stored values.
|
|
const valuesCount = 255
|
|
|
|
// valuesPrefix is the prefix values are stored by.
|
|
var valuesPrefix = []byte{0x01}
|
|
|
|
func _deploy(data any, isUpdate bool) {
|
|
if !isUpdate {
|
|
ctx := storage.GetContext()
|
|
for i := 0; i < valuesCount; i++ {
|
|
key := append(valuesPrefix, byte(i))
|
|
storage.Put(ctx, key, i)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// IterateOverValues returns iterator over contract storage values stored during deploy.
|
|
func IterateOverValues() iterator.Iterator {
|
|
ctx := storage.GetContext()
|
|
return storage.Find(ctx, valuesPrefix, storage.ValuesOnly)
|
|
}
|