diff --git a/alphabet/alphabet_contract.go b/alphabet/alphabet_contract.go index 8a85ef7..f3c0092 100644 --- a/alphabet/alphabet_contract.go +++ b/alphabet/alphabet_contract.go @@ -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 } diff --git a/audit/audit_contract.go b/audit/audit_contract.go index cfa3995..7306d3f 100644 --- a/audit/audit_contract.go +++ b/audit/audit_contract.go @@ -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 } diff --git a/balance/balance_contract.go b/balance/balance_contract.go index 8ac9f5d..f4926de 100644 --- a/balance/balance_contract.go +++ b/balance/balance_contract.go @@ -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 } diff --git a/container/container_contract.go b/container/container_contract.go index 10b7e5b..777329d 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -94,6 +94,9 @@ func _deploy(data interface{}, isUpdate bool) { }) if isUpdate { + storage.Delete(ctx, "ballots") + storage.Put(ctx, notaryDisabledKey, false) + return } diff --git a/neofsid/neofsid_contract.go b/neofsid/neofsid_contract.go index 8fc1e2f..782c278 100644 --- a/neofsid/neofsid_contract.go +++ b/neofsid/neofsid_contract.go @@ -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 } diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index fbd6796..69d63eb 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -83,6 +83,9 @@ func _deploy(data interface{}, isUpdate bool) { } if isUpdate { + storage.Delete(ctx, "ballots") + storage.Put(ctx, notaryDisabledKey, false) + return } diff --git a/reputation/reputation_contract.go b/reputation/reputation_contract.go index a49475f..23262cb 100644 --- a/reputation/reputation_contract.go +++ b/reputation/reputation_contract.go @@ -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 } diff --git a/subnet/subnet_contract.go b/subnet/subnet_contract.go index 2743c17..1a7aad3 100644 --- a/subnet/subnet_contract.go +++ b/subnet/subnet_contract.go @@ -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 }