cli: allow to provide 'data' for 'contract deploy' command

This commit is contained in:
Anna Shaleva 2021-04-16 18:04:19 +03:00
parent 1a8ea8e2d6
commit 4e66293612
3 changed files with 84 additions and 3 deletions

View file

@ -23,6 +23,13 @@ func _deploy(data interface{}, isUpdate bool) {
value = "on create"
sh := runtime.GetCallingScriptHash()
storage.Put(ctx, mgmtKey, sh)
if data != nil {
arr := data.([]interface{})
for i := 0; i < len(arr)-1; i += 2 {
storage.Put(ctx, arr[i], arr[i+1])
}
}
}
storage.Put(ctx, key, value)
@ -48,6 +55,12 @@ func GetValue() string {
return val1.(string) + "|" + val2.(string)
}
// GetValueWithKey returns stored value with the specified key.
func GetValueWithKey(key string) string {
ctx := storage.GetReadOnlyContext()
return storage.Get(ctx, key).(string)
}
// TestFind finds items with the specified prefix.
func TestFind(f storage.FindFlags) []interface{} {
ctx := storage.GetContext()