[#174] subnet: Move Update
method to the top of the file
It is done to make all contract file similar. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
3723fcaacf
commit
b02a5c2d40
1 changed files with 11 additions and 11 deletions
|
@ -38,6 +38,17 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
storage.Put(ctx, []byte{notaryDisabledKey}, args.notaryDisabled)
|
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")
|
||||||
|
}
|
||||||
|
|
||||||
// Put creates new subnet with the specified owner and info.
|
// Put creates new subnet with the specified owner and info.
|
||||||
func Put(id []byte, ownerKey interop.PublicKey, info []byte) {
|
func Put(id []byte, ownerKey interop.PublicKey, info []byte) {
|
||||||
if len(id) != 4 {
|
if len(id) != 4 {
|
||||||
|
@ -120,17 +131,6 @@ func Delete(id []byte) {
|
||||||
storage.Delete(ctx, key)
|
storage.Delete(ctx, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
// Version returns version of the contract.
|
||||||
func Version() int {
|
func Version() int {
|
||||||
return common.Version
|
return common.Version
|
||||||
|
|
Loading…
Reference in a new issue