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) {
|
func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
ctx := storage.GetContext()
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
|
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +48,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
total int
|
total int
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx := storage.GetContext()
|
|
||||||
|
|
||||||
if len(args.addrNetmap) != interop.Hash160Len || !args.notaryDisabled && len(args.addrProxy) != interop.Hash160Len {
|
if len(args.addrNetmap) != interop.Hash160Len || !args.notaryDisabled && len(args.addrProxy) != interop.Hash160Len {
|
||||||
panic("incorrect length of contract script hash")
|
panic("incorrect length of contract script hash")
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,9 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
ctx := storage.GetContext()
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
|
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,8 +54,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
addrNetmap interop.Hash160
|
addrNetmap interop.Hash160
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx := storage.GetContext()
|
|
||||||
|
|
||||||
if len(args.addrNetmap) != interop.Hash160Len {
|
if len(args.addrNetmap) != interop.Hash160Len {
|
||||||
panic("incorrect length of contract script hash")
|
panic("incorrect length of contract script hash")
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,9 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
ctx := storage.GetContext()
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
|
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,8 +71,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
addrContainer interop.Hash160
|
addrContainer interop.Hash160
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx := storage.GetContext()
|
|
||||||
|
|
||||||
if len(args.addrNetmap) != interop.Hash160Len || len(args.addrContainer) != interop.Hash160Len {
|
if len(args.addrNetmap) != interop.Hash160Len || len(args.addrContainer) != interop.Hash160Len {
|
||||||
panic("incorrect length of contract script hash")
|
panic("incorrect length of contract script hash")
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import (
|
||||||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
"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.
|
// HasUpdateAccess returns true if contract can be updated.
|
||||||
func HasUpdateAccess() bool {
|
func HasUpdateAccess() bool {
|
||||||
return runtime.CheckWitness(CommitteeAddress())
|
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) {
|
func _deploy(data interface{}, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
if isUpdate {
|
||||||
|
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
args := data.(struct {
|
args := data.(struct {
|
||||||
notaryDisabled bool
|
notaryDisabled bool
|
||||||
|
@ -93,10 +97,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
nnsRoot string
|
nnsRoot string
|
||||||
})
|
})
|
||||||
|
|
||||||
if isUpdate {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(args.addrNetmap) != interop.Hash160Len ||
|
if len(args.addrNetmap) != interop.Hash160Len ||
|
||||||
len(args.addrBalance) != interop.Hash160Len ||
|
len(args.addrBalance) != interop.Hash160Len ||
|
||||||
len(args.addrID) != interop.Hash160Len {
|
len(args.addrID) != interop.Hash160Len {
|
||||||
|
|
|
@ -33,6 +33,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
|
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||||
it := storage.Find(ctx, []byte{}, storage.None)
|
it := storage.Find(ctx, []byte{}, storage.None)
|
||||||
for iterator.Next(it) {
|
for iterator.Next(it) {
|
||||||
kv := iterator.Value(it).([][]byte)
|
kv := iterator.Value(it).([][]byte)
|
||||||
|
|
|
@ -83,6 +83,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
|
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||||
return
|
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/management"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/interop/native/neo"
|
"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/runtime"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
||||||
"github.com/nspcc-dev/neofs-contract/common"
|
"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) {
|
func _deploy(_ interface{}, isUpdate bool) {
|
||||||
|
ctx := storage.GetContext()
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
|
storage.Delete(ctx, common.LegacyOwnerKey)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue