Enable notary and remove all ballots
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
8ea2c12fab
commit
72571349a8
8 changed files with 30 additions and 39 deletions
|
@ -34,6 +34,13 @@ func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
|||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
ctx := storage.GetContext()
|
||||
storage.Delete(ctx, "ballots")
|
||||
storage.Put(ctx, notaryDisabledKey, false)
|
||||
|
||||
proxyContract := data.([]interface{})[0] // better to hardcode it
|
||||
storage.Put(ctx, proxyKey, proxyContract)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ const (
|
|||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
ctx := storage.GetContext()
|
||||
storage.Delete(ctx, "ballots")
|
||||
storage.Put(ctx, notaryDisabledKey, false)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,10 @@ func init() {
|
|||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
ctx := storage.GetContext()
|
||||
storage.Delete(ctx, "ballots")
|
||||
storage.Put(ctx, notaryDisabledKey, false)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,9 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
})
|
||||
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, "ballots")
|
||||
storage.Put(ctx, notaryDisabledKey, false)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/crypto"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/std"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
||||
"github.com/nspcc-dev/neofs-contract/common"
|
||||
|
@ -33,19 +32,9 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
ctx := storage.GetContext()
|
||||
|
||||
if isUpdate {
|
||||
it := storage.Find(ctx, []byte{}, storage.None)
|
||||
for iterator.Next(it) {
|
||||
kv := iterator.Value(it).([][]byte)
|
||||
// V2 format
|
||||
if len(kv[0]) == ownerSize {
|
||||
info := std.Deserialize(kv[1]).(UserInfo)
|
||||
key := append([]byte{ownerKeysPrefix}, kv[0]...)
|
||||
for i := range info.Keys {
|
||||
storage.Put(ctx, append(key, info.Keys[i]...), []byte{1})
|
||||
}
|
||||
storage.Delete(ctx, kv[0])
|
||||
}
|
||||
}
|
||||
storage.Delete(ctx, "ballots")
|
||||
storage.Put(ctx, notaryDisabledKey, false)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,9 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, "ballots")
|
||||
storage.Put(ctx, notaryDisabledKey, false)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/interop/convert"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/std"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
||||
"github.com/nspcc-dev/neofs-contract/common"
|
||||
|
@ -22,31 +21,9 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
ctx := storage.GetContext()
|
||||
|
||||
if isUpdate {
|
||||
// Storage migration.
|
||||
storage.Delete(ctx, []byte("contractOwner"))
|
||||
storage.Delete(ctx, "ballots")
|
||||
storage.Put(ctx, notaryDisabledKey, false)
|
||||
|
||||
it := storage.Find(ctx, []byte{}, storage.None)
|
||||
for iterator.Next(it) {
|
||||
kv := iterator.Value(it).([][]byte)
|
||||
if string(kv[0]) == notaryDisabledKey {
|
||||
continue
|
||||
}
|
||||
if string(kv[0]) == "ballots" {
|
||||
continue
|
||||
}
|
||||
|
||||
storage.Delete(ctx, kv[0])
|
||||
|
||||
rawValues := std.Deserialize(kv[1]).([][]byte)
|
||||
key := getReputationKey(reputationCountPrefix, kv[0])
|
||||
storage.Put(ctx, key, len(rawValues))
|
||||
|
||||
key[0] = reputationValuePrefix
|
||||
for i := range rawValues {
|
||||
newKey := append(key, convert.ToBytes(i)...)
|
||||
storage.Put(ctx, newKey, rawValues[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@ const (
|
|||
// _deploy function sets up initial list of inner ring public keys.
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
ctx := storage.GetContext()
|
||||
storage.Delete(ctx, "ballots")
|
||||
storage.Put(ctx, notaryDisabledKey, false)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue