forked from TrueCloudLab/frostfs-contract
[#88] *: Provide data in migrate method of the contracts
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
8b1c8eb689
commit
2e2eb15729
10 changed files with 60 additions and 20 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue