Use UpdateWithData call wrapper in Update methods #30

Merged
fyrchik merged 1 commit from acid-ant/frostfs-contract:bugfix/10-use-updatewithdata into master 2023-06-20 13:46:09 +00:00
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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
runtime.Log("alphabet contract updated")
}

View file

@ -3,7 +3,6 @@ package audit
import (
"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/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/native/crypto"
"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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
runtime.Log("audit contract updated")
}

View file

@ -3,7 +3,6 @@ package balance
import (
"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/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
"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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
runtime.Log("container contract updated")
}

View file

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

View file

@ -3,7 +3,6 @@ package frostfsid
import (
"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/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
"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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
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
// thus we provide `AllowCall` to management.Update.
// management.Update(nef, []byte(manifest))
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, nef, manifest, common.AppendVersion(data))
management.UpdateWithData(nef, []byte(manifest), common.AppendVersion(data))
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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
runtime.Log("processing contract updated")
}

View file

@ -3,7 +3,6 @@ package proxy
import (
"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/native/gas"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
"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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
runtime.Log("proxy contract updated")
}

View file

@ -2,8 +2,6 @@ package reputation
import (
"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/iterator"
"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")
}
contract.Call(interop.Hash160(management.Hash), "update",
contract.All, script, manifest, common.AppendVersion(data))
management.UpdateWithData(script, manifest, common.AppendVersion(data))
runtime.Log("reputation contract updated")
}