[#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

@ -26,6 +26,10 @@ func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
}
func _deploy(data interface{}, isUpdate bool) {
if isUpdate {
return
}
arr := data.([]interop.Hash160)
owner := arr[0]
addrNeoFS := arr[1]
@ -46,7 +50,7 @@ func _deploy(data interface{}, isUpdate bool) {
runtime.Log("processing 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) {
@ -54,7 +58,7 @@ func Migrate(script []byte, manifest []byte) bool {
return false
}
management.Update(script, manifest)
management.UpdateWithData(script, manifest, data)
runtime.Log("processing contract updated")
return true