diff --git a/neofs/neofs_contract.go b/neofs/neofs_contract.go index 7141955..355b547 100644 --- a/neofs/neofs_contract.go +++ b/neofs/neofs_contract.go @@ -54,6 +54,7 @@ func _deploy(data interface{}, isUpdate bool) { owner := args[1].(interop.Hash160) addrProc := args[2].(interop.Hash160) keys := args[3].([]interop.PublicKey) + config := args[4].([][]byte) ctx := storage.GetContext() @@ -93,6 +94,18 @@ func _deploy(data interface{}, isUpdate bool) { runtime.Log("neofs contract notary disabled") } + ln := len(config) + if ln%2 != 0 { + panic("init: bad configuration") + } + + for i := 0; i < ln/2; i++ { + key := config[i*2] + val := config[i*2+1] + + setConfig(ctx, key, val) + } + runtime.Log("neofs: contract initialized") } @@ -529,33 +542,6 @@ func ListConfig() []record { return config } -// InitConfig method sets up initial key-value configuration pair. Can be invoked -// only once. -// -// Arguments should contain even number of byte arrays. First byte array is a -// configuration key and the second is configuration value. -func InitConfig(args [][]byte) { - ctx := storage.GetContext() - - if getConfig(ctx, candidateFeeConfigKey) != nil { - panic("neofs: configuration already installed") - } - - ln := len(args) - if ln%2 != 0 { - panic("initConfig: bad arguments") - } - - for i := 0; i < ln/2; i++ { - key := args[i*2] - val := args[i*2+1] - - setConfig(ctx, key, val) - } - - runtime.Log("neofs: config has been installed") -} - // Version returns version of the contract. func Version() int { return common.Version