forked from TrueCloudLab/frostfs-contract
[#202] *: remove owner from contract storage
It is no longer used and should've be removed on update. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
c1adea2484
commit
1944a4332b
8 changed files with 18 additions and 10 deletions
|
@ -33,7 +33,9 @@ func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
|||
}
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -46,8 +48,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
total int
|
||||
})
|
||||
|
||||
ctx := storage.GetContext()
|
||||
|
||||
if len(args.addrNetmap) != interop.Hash160Len || !args.notaryDisabled && len(args.addrProxy) != interop.Hash160Len {
|
||||
panic("incorrect length of contract script hash")
|
||||
}
|
||||
|
|
|
@ -43,7 +43,9 @@ const (
|
|||
)
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -52,8 +54,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
addrNetmap interop.Hash160
|
||||
})
|
||||
|
||||
ctx := storage.GetContext()
|
||||
|
||||
if len(args.addrNetmap) != interop.Hash160Len {
|
||||
panic("incorrect length of contract script hash")
|
||||
}
|
||||
|
|
|
@ -59,7 +59,9 @@ func init() {
|
|||
}
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -69,8 +71,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
addrContainer interop.Hash160
|
||||
})
|
||||
|
||||
ctx := storage.GetContext()
|
||||
|
||||
if len(args.addrNetmap) != interop.Hash160Len || len(args.addrContainer) != interop.Hash160Len {
|
||||
panic("incorrect length of contract script hash")
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
)
|
||||
|
||||
// LegacyOwnerKey is storage key used to store contract owner.
|
||||
const LegacyOwnerKey = "contractOwner"
|
||||
|
||||
// HasUpdateAccess returns true if contract can be updated.
|
||||
func HasUpdateAccess() bool {
|
||||
return runtime.CheckWitness(CommitteeAddress())
|
||||
|
|
|
@ -83,6 +83,10 @@ func OnNEP11Payment(a interop.Hash160, b int, c []byte, d interface{}) {
|
|||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||
return
|
||||
}
|
||||
|
||||
args := data.(struct {
|
||||
notaryDisabled bool
|
||||
|
@ -93,10 +97,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
nnsRoot string
|
||||
})
|
||||
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
if len(args.addrNetmap) != interop.Hash160Len ||
|
||||
len(args.addrBalance) != interop.Hash160Len ||
|
||||
len(args.addrID) != interop.Hash160Len {
|
||||
|
|
|
@ -33,6 +33,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
ctx := storage.GetContext()
|
||||
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||
it := storage.Find(ctx, []byte{}, storage.None)
|
||||
for iterator.Next(it) {
|
||||
kv := iterator.Value(it).([][]byte)
|
||||
|
|
|
@ -83,6 +83,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/neo"
|
||||
"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"
|
||||
)
|
||||
|
||||
|
@ -19,7 +20,9 @@ func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
|||
}
|
||||
|
||||
func _deploy(_ interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
if isUpdate {
|
||||
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue