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
|
@ -34,6 +34,10 @@ func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
|||
}
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
args := data.([]interface{})
|
||||
notaryDisabled := args[0].(bool)
|
||||
owner := args[1].(interop.Hash160)
|
||||
|
@ -70,7 +74,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
runtime.Log(name + " 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) {
|
||||
|
@ -78,7 +82,7 @@ func Migrate(script []byte, manifest []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
management.Update(script, manifest)
|
||||
management.UpdateWithData(script, manifest, data)
|
||||
runtime.Log("alphabet contract updated")
|
||||
|
||||
return true
|
||||
|
|
|
@ -43,6 +43,10 @@ const (
|
|||
)
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
args := data.([]interface{})
|
||||
notaryDisabled := args[0].(bool)
|
||||
owner := args[1].(interop.Hash160)
|
||||
|
@ -70,7 +74,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
runtime.Log("audit 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) {
|
||||
|
@ -78,7 +82,7 @@ func Migrate(script []byte, manifest []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
management.Update(script, manifest)
|
||||
management.UpdateWithData(script, manifest, data)
|
||||
runtime.Log("audit contract updated")
|
||||
|
||||
return true
|
||||
|
|
|
@ -59,6 +59,10 @@ func init() {
|
|||
}
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
args := data.([]interface{})
|
||||
notaryDisabled := args[0].(bool)
|
||||
owner := args[1].(interop.Hash160)
|
||||
|
@ -89,7 +93,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
runtime.Log("balance 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) {
|
||||
|
@ -97,7 +101,7 @@ func Migrate(script []byte, manifest []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
management.Update(script, manifest)
|
||||
management.UpdateWithData(script, manifest, data)
|
||||
runtime.Log("balance contract updated")
|
||||
|
||||
return true
|
||||
|
|
|
@ -64,6 +64,10 @@ var (
|
|||
)
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
args := data.([]interface{})
|
||||
notaryDisabled := args[0].(bool)
|
||||
owner := args[1].(interop.Hash160)
|
||||
|
@ -96,7 +100,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
runtime.Log("container 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) {
|
||||
|
@ -104,7 +108,7 @@ func Migrate(script []byte, manifest []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
management.Update(script, manifest)
|
||||
management.UpdateWithData(script, manifest, data)
|
||||
runtime.Log("container contract updated")
|
||||
|
||||
return true
|
||||
|
|
|
@ -78,6 +78,10 @@ var (
|
|||
|
||||
// _deploy sets up initial alphabet node keys.
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
args := data.([]interface{})
|
||||
notaryDisabled := args[0].(bool)
|
||||
owner := args[1].(interop.Hash160)
|
||||
|
@ -126,7 +130,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
// Migrate updates smart contract execution script and manifest.
|
||||
func Migrate(script []byte, manifest []byte) bool {
|
||||
func Migrate(script []byte, manifest []byte, data interface{}) bool {
|
||||
ctx := storage.GetReadOnlyContext()
|
||||
|
||||
if !common.HasUpdateAccess(ctx) {
|
||||
|
@ -134,7 +138,7 @@ func Migrate(script []byte, manifest []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
management.Update(script, manifest)
|
||||
management.UpdateWithData(script, manifest, data)
|
||||
runtime.Log("neofs contract updated")
|
||||
|
||||
return true
|
||||
|
|
|
@ -25,6 +25,10 @@ const (
|
|||
)
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
args := data.([]interface{})
|
||||
notaryDisabled := args[0].(bool)
|
||||
owner := args[1].(interop.Hash160)
|
||||
|
@ -55,7 +59,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
runtime.Log("neofsid 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) {
|
||||
|
@ -63,7 +67,7 @@ func Migrate(script []byte, manifest []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
management.Update(script, manifest)
|
||||
management.UpdateWithData(script, manifest, data)
|
||||
runtime.Log("neofsid contract updated")
|
||||
|
||||
return true
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -17,6 +17,10 @@ const (
|
|||
)
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
if isUpdate {
|
||||
return
|
||||
}
|
||||
|
||||
args := data.([]interface{})
|
||||
notaryDisabled := args[0].(bool)
|
||||
owner := args[1].(interop.Hash160)
|
||||
|
@ -39,7 +43,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
runtime.Log("reputation 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) {
|
||||
|
@ -47,7 +51,7 @@ func Migrate(script []byte, manifest []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
management.Update(script, manifest)
|
||||
management.UpdateWithData(script, manifest, data)
|
||||
runtime.Log("reputation contract updated")
|
||||
|
||||
return true
|
||||
|
|
Loading…
Reference in a new issue