[#10] Use UpdateWithData call wrapper in Update methods

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2023-06-19 11:17:51 +03:00
parent 2da0ff5750
commit bcf22c50a1
11 changed files with 11 additions and 28 deletions

View file

@ -72,8 +72,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only committee can update contract") panic("only committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("alphabet contract updated") runtime.Log("alphabet contract updated")
} }

View file

@ -3,7 +3,6 @@ package audit
import ( import (
"git.frostfs.info/TrueCloudLab/frostfs-contract/common" "git.frostfs.info/TrueCloudLab/frostfs-contract/common"
"github.com/nspcc-dev/neo-go/pkg/interop" "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/iterator" "github.com/nspcc-dev/neo-go/pkg/interop/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/native/crypto" "github.com/nspcc-dev/neo-go/pkg/interop/native/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/native/management"
@ -75,8 +74,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only committee can update contract") panic("only committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("audit contract updated") runtime.Log("audit contract updated")
} }

View file

@ -3,7 +3,6 @@ package balance
import ( import (
"git.frostfs.info/TrueCloudLab/frostfs-contract/common" "git.frostfs.info/TrueCloudLab/frostfs-contract/common"
"github.com/nspcc-dev/neo-go/pkg/interop" "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/iterator" "github.com/nspcc-dev/neo-go/pkg/interop/iterator"
"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/std" "github.com/nspcc-dev/neo-go/pkg/interop/native/std"
@ -93,8 +92,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only committee can update contract") panic("only committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("balance contract updated") runtime.Log("balance contract updated")
} }

View file

@ -171,8 +171,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only committee can update contract") panic("only committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("container contract updated") runtime.Log("container contract updated")
} }

View file

@ -109,8 +109,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic(common.ErrAlphabetWitnessFailed) panic(common.ErrAlphabetWitnessFailed)
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("frostfs contract updated") runtime.Log("frostfs contract updated")
} }

View file

@ -3,7 +3,6 @@ package frostfsid
import ( import (
"git.frostfs.info/TrueCloudLab/frostfs-contract/common" "git.frostfs.info/TrueCloudLab/frostfs-contract/common"
"github.com/nspcc-dev/neo-go/pkg/interop" "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/iterator" "github.com/nspcc-dev/neo-go/pkg/interop/iterator"
"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/runtime" "github.com/nspcc-dev/neo-go/pkg/interop/runtime"
@ -62,8 +61,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only committee can update contract") panic("only committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("frostfsid contract updated") runtime.Log("frostfsid contract updated")
} }

View file

@ -127,8 +127,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only committee can update contract") panic("only committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("netmap contract updated") runtime.Log("netmap contract updated")
} }

View file

@ -82,8 +82,7 @@ func Update(nef []byte, manifest string, data interface{}) {
// std and crypto contracts. This can be helpful on update // std and crypto contracts. This can be helpful on update
// thus we provide `AllowCall` to management.Update. // thus we provide `AllowCall` to management.Update.
// management.Update(nef, []byte(manifest)) // management.Update(nef, []byte(manifest))
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(nef, []byte(manifest), common.AppendVersion(data))
contract.All, nef, manifest, common.AppendVersion(data))
runtime.Log("nns contract updated") runtime.Log("nns contract updated")
} }

View file

@ -59,8 +59,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only side chain committee can update contract") panic("only side chain committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("processing contract updated") runtime.Log("processing contract updated")
} }

View file

@ -3,7 +3,6 @@ package proxy
import ( import (
"git.frostfs.info/TrueCloudLab/frostfs-contract/common" "git.frostfs.info/TrueCloudLab/frostfs-contract/common"
"github.com/nspcc-dev/neo-go/pkg/interop" "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/gas" "github.com/nspcc-dev/neo-go/pkg/interop/native/gas"
"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"
@ -35,8 +34,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only committee can update contract") panic("only committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("proxy contract updated") runtime.Log("proxy contract updated")
} }

View file

@ -2,8 +2,6 @@ package reputation
import ( import (
"git.frostfs.info/TrueCloudLab/frostfs-contract/common" "git.frostfs.info/TrueCloudLab/frostfs-contract/common"
"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/convert" "github.com/nspcc-dev/neo-go/pkg/interop/convert"
"github.com/nspcc-dev/neo-go/pkg/interop/iterator" "github.com/nspcc-dev/neo-go/pkg/interop/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/native/management"
@ -36,8 +34,7 @@ func Update(script []byte, manifest []byte, data interface{}) {
panic("only committee can update contract") panic("only committee can update contract")
} }
contract.Call(interop.Hash160(management.Hash), "update", management.UpdateWithData(script, manifest, common.AppendVersion(data))
contract.All, script, manifest, common.AppendVersion(data))
runtime.Log("reputation contract updated") runtime.Log("reputation contract updated")
} }