forked from TrueCloudLab/frostfs-contract
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
|
package subnet
|
||
|
|
||
|
import (
|
||
|
"github.com/nspcc-dev/neo-go/pkg/interop"
|
||
|
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
|
||
|
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
|
||
|
"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"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
notaryDisabledKey = 'z'
|
||
|
)
|
||
|
|
||
|
// _deploy function sets up initial list of inner ring public keys.
|
||
|
func _deploy(data interface{}, isUpdate bool) {
|
||
|
if isUpdate {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
args := data.(struct {
|
||
|
notaryDisabled bool
|
||
|
})
|
||
|
|
||
|
ctx := storage.GetContext()
|
||
|
storage.Put(ctx, []byte{notaryDisabledKey}, args.notaryDisabled)
|
||
|
}
|
||
|
|
||
|
// Update method updates contract source code and manifest. Can be invoked
|
||
|
// only by committee.
|
||
|
func Update(script []byte, manifest []byte, data interface{}) {
|
||
|
if !common.HasUpdateAccess() {
|
||
|
panic("only committee can update contract")
|
||
|
}
|
||
|
|
||
|
contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
|
||
|
runtime.Log("subnet contract updated")
|
||
|
}
|
||
|
|
||
|
// Version returns version of the contract.
|
||
|
func Version() int {
|
||
|
return common.Version
|
||
|
}
|