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
|
@ -24,6 +24,10 @@ func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
|||
}
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
args := data.([]interface{})
|
||||
owner := args[0].(interop.Hash160)
|
||||
addrNetmap := args[1].(interop.Hash160)
|
||||
|
@ -44,7 +48,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
runtime.Log("proxy 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) {
|
||||
|
@ -52,7 +56,7 @@ func Migrate(script []byte, manifest []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
management.Update(script, manifest)
|
||||
management.UpdateWithData(script, manifest, data)
|
||||
runtime.Log("proxy contract updated")
|
||||
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue