Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Neo.SmartContract.Framework;
- using Neo.SmartContract.Framework.Services.Neo;
- using System;
- using System.Text;
- using System.Numerics;
- namespace Neo.SmartContract
- {
- public class Contract1 : Framework.SmartContract
- {
- public static object Main(string operation, params object[] args)
- {
- /* params:
- * args[0] = key
- * args[1] = value
- */
- Runtime.Log("Contract executed");
- switch (operation)
- {
- case "storeSwitch":
- Runtime.Log("Case storeSwitch");
- Store((string)args[0], (string)args[1]);
- return true;
- case "store":
- //this code works
- Runtime.Log("Case Store setted");
- Runtime.Notify("args", args.Length);
- Storage.Put(Storage.CurrentContext, (string)args[0], (string)args[1]);
- Runtime.Log("Store executed");
- return true;
- case "get":
- Runtime.Log("Case Get setted");
- return Get((string)args[0]);
- default:
- Runtime.Log("Case DEFAULT setted");
- return false;
- }
- }
- public static bool Store(string key, string value)
- {
- // If I call that from the switch case, it doesnt work.
- Runtime.Log("Inside Store operation");
- Storage.Put(Storage.CurrentContext, key, value);
- Runtime.Log("Store executed");
- return true;
- }
- public static byte[] Get(string key)
- {
- // with this it happen the same, it doesnt work.
- Runtime.Log("Inside Get operation");
- return Storage.Get(Storage.CurrentContext, key);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement