[#88] *: Provide data in migrate method of the contracts

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-06-03 10:49:07 +03:00 committed by Alex Vanin
parent 8b1c8eb689
commit 2e2eb15729
10 changed files with 60 additions and 20 deletions

View file

@ -60,6 +60,10 @@ var (
// _deploy function sets up initial list of inner ring public keys.
func _deploy(data interface{}, isUpdate bool) {
if isUpdate {
return
}
args := data.([]interface{})
notaryDisabled := args[0].(bool)
owner := args[1].(interop.Hash160)
@ -108,7 +112,7 @@ func _deploy(data interface{}, isUpdate bool) {
runtime.Log("netmap contract initialized")
}
func Migrate(script []byte, manifest []byte) bool {
func Migrate(script []byte, manifest []byte, data interface{}) bool {
ctx := storage.GetReadOnlyContext()
if !common.HasUpdateAccess(ctx) {
@ -116,7 +120,7 @@ func Migrate(script []byte, manifest []byte) bool {
return false
}
management.Update(script, manifest)
management.UpdateWithData(script, manifest, data)
runtime.Log("netmap contract updated")
return true