[#205] proxy: do not store netmap hash

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-12-27 09:53:08 +03:00 committed by Alex Vanin
parent 8718e146c9
commit c1adea2484

View file

@ -7,14 +7,9 @@ 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"
) )
const (
netmapContractKey = "netmapScriptHash"
)
// OnNEP17Payment is a callback for NEP-17 compatible native GAS contract. // OnNEP17Payment is a callback for NEP-17 compatible native GAS contract.
func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) { func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
caller := runtime.GetCallingScriptHash() caller := runtime.GetCallingScriptHash()
@ -23,23 +18,11 @@ func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
} }
} }
func _deploy(data interface{}, isUpdate bool) { func _deploy(_ interface{}, isUpdate bool) {
if isUpdate { if isUpdate {
return return
} }
args := data.(struct {
addrNetmap interop.Hash160
})
ctx := storage.GetContext()
if len(args.addrNetmap) != interop.Hash160Len {
panic("incorrect length of contract script hash")
}
storage.Put(ctx, netmapContractKey, args.addrNetmap)
runtime.Log("proxy contract initialized") runtime.Log("proxy contract initialized")
} }