/// <summary> /// Collectible methods (NPC Level 4) /// </summary> /// <param name="e">e</param> /// <param name="vau">vau</param> /// <param name="index">index</param> /// <returns>bool</returns> public static bool PutElement(NPCNEP5Requisition e, NeoVersionedAppUser vau, byte[] domain, byte[] bindex) { if (NeoVersionedAppUser.IsNull(vau)) { return(false); } Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext; NeoStorageKey nsk = NeoStorageKey.New(vau, domain, _bClassName); //byte[] bkey; e._state = NeoEntityModel.EntityState.PUTTED; Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bSTA), e._state.AsBigInteger()); Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bFromScriptHash), e._fromScriptHash); // Template: NPCLevel4APutElement_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bToScriptHash), e._toScriptHash); // Template: NPCLevel4APutElement_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bEncryptedBlobURI), e._encryptedBlobURI); // Template: NPCLevel4APutElement_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bWorkflowState), e._workflowState); // Template: NPCLevel4APutElement_cs.txt if (NeoTrace.RUNTIME) { LogExt("PutElement(vau,i).NPCNEP5Requisition", e); // Template: NPCLevel4BGetElement_cs.txt } return(true); }
public static NPCNEP5Requisition[] GetContributorRequisitions(NeoVersionedAppUser AppVAU, object[] args) { NPCNEP5Requisition[] results = { NPCNEP5Requisition.Null() }; byte[] encodedRequisitionName = (byte[])args[0]; if (NeoTrace.ARGSRESULTS) { NeoTrace.Trace("GetRequisition.encodedRequisitionName", encodedRequisitionName); } NPCNEP5Requisition uc = FindRequisition(AppVAU, encodedRequisitionName); if (NeoTrace.INFO) { NPCNEP5Requisition.LogExt("GetRequisition.uc", uc); } results[0] = uc; if (NeoTrace.ARGSRESULTS) { NeoTrace.Trace("GetRequisition.results", results); } return(results); }
// Factory methods // Template: NPCLevel1Part2_cs.txt private static NPCNEP5Requisition _Initialize(NPCNEP5Requisition e) { e._fromScriptHash = NeoEntityModel.NullByteArray; e._toScriptHash = NeoEntityModel.NullByteArray; e._encryptedBlobURI = ""; e._workflowState = 0; e._state = NeoEntityModel.EntityState.NULL; if (NeoTrace.RUNTIME) { LogExt("_Initialize(e).NPCNEP5Requisition", e); } return(e); }
public static NPCNEP5Requisition New() { NPCNEP5Requisition e = new NPCNEP5Requisition(); _Initialize(e); if (NeoTrace.RUNTIME) { LogExt("New().NPCNEP5Requisition", e); } return(e); }
public static NPCNEP5Requisition New(byte[] FromScriptHash, byte[] ToScriptHash, string EncryptedBlobURI, Int32 WorkflowState) { NPCNEP5Requisition e = new NPCNEP5Requisition(); e._fromScriptHash = FromScriptHash; e._toScriptHash = ToScriptHash; e._encryptedBlobURI = EncryptedBlobURI; e._workflowState = WorkflowState; e._state = NeoEntityModel.EntityState.INIT; if (NeoTrace.RUNTIME) { LogExt("New(.,.).NPCNEP5Requisition", e); } return(e); }
public static NPCNEP5Requisition Missing() { NPCNEP5Requisition e = new NPCNEP5Requisition(); e._fromScriptHash = NeoEntityModel.NullByteArray; e._toScriptHash = NeoEntityModel.NullByteArray; e._encryptedBlobURI = ""; e._workflowState = 0; e._state = NeoEntityModel.EntityState.MISSING; if (NeoTrace.RUNTIME) { LogExt("Missing().NPCNEP5Requisition", e); } return(e); }
/// <summary> /// Get an element of an array of entities from Storage based on a NeoStorageKey (NPC Level 4) /// </summary> /// <param name="vau">vau</param> /// <param name="index">index</param> /// <returns>NPCNEP5Requisition</returns> public static NPCNEP5Requisition GetElement(NeoVersionedAppUser vau, byte[] domain, byte[] bindex) { if (NeoVersionedAppUser.IsNull(vau)) { return(Null()); } Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext; NeoStorageKey nsk = NeoStorageKey.New(vau, domain, _bClassName); NPCNEP5Requisition e; //byte[] bkey; byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bSTA)); if (NeoTrace.RUNTIME) { TraceRuntime("Get(bkey).NPCNEP5Requisition.bsta", bsta.Length, bsta); } if (bsta.Length == 0) { e = NPCNEP5Requisition.Missing(); } else // not MISSING { int ista = (int)bsta.AsBigInteger(); NeoEntityModel.EntityState sta = (NeoEntityModel.EntityState)ista; if (sta == NeoEntityModel.EntityState.TOMBSTONED) { e = NPCNEP5Requisition.Tombstone(); } else // not MISSING && not TOMBSTONED { e = new NPCNEP5Requisition(); byte[] FromScriptHash = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bFromScriptHash)); // Template: NPCLevel4CGetElement_cs.txt byte[] ToScriptHash = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bToScriptHash)); // Template: NPCLevel4CGetElement_cs.txt string EncryptedBlobURI = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bEncryptedBlobURI)).AsString(); // Template: NPCLevel4CGetElement_cs.txt Int32 WorkflowState = (Int32)Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bWorkflowState)).AsBigInteger(); // Template: NPCLevel4CGetElement_cs.txt e._fromScriptHash = FromScriptHash; e._toScriptHash = ToScriptHash; e._encryptedBlobURI = EncryptedBlobURI; e._workflowState = WorkflowState; // NPCLevel4DBuryElement_cs.txt e._state = sta; e._state = NeoEntityModel.EntityState.GETTED; /* OVERRIDE */ } } if (NeoTrace.RUNTIME) { LogExt("Get(bkey).NPCNEP5Requisition.e", e); } return(e); }
private static NPCNEP5Requisition FindRequisition(NeoVersionedAppUser AppVAU, byte[] encodedRequisitionName) { if (NeoTrace.ARGSRESULTS) { NeoTrace.Trace("FindRequisition.encodedRequisitionName", encodedRequisitionName); } NPCNEP5Requisition result = NPCNEP5Requisition.GetElement(AppVAU, DOMAINNEP5REQ, encodedRequisitionName); if (NeoTrace.ARGSRESULTS) { NPCNEP5Requisition.LogExt("FindRequisition.result", result); } return(result); }
public static NPCNEP5Requisition SubmitRequisition(NeoVersionedAppUser AppVAU, object[] args) { NPCNEP5Requisition results = NPCNEP5Requisition.Null(); byte[] encodedRequisitionName = (byte[])args[0]; if (NeoTrace.ARGSRESULTS) { NeoTrace.Trace("AddRequisition.encodedRequisitionName", encodedRequisitionName); } byte[] encodedPassword = (byte[])args[1]; if (NeoTrace.ARGSRESULTS) { NeoTrace.Trace("AddRequisition.encodedPassword", encodedPassword); } NPCNEP5Requisition uc = FindRequisition(AppVAU, encodedRequisitionName); if (NPCNEP5Requisition.IsMissing(uc)) // add the unique new user { if (NeoTrace.INFO) { NPCNEP5Requisition.LogExt("AddRequisition.missing", uc); } uc = NPCNEP5Requisition.New(encodedRequisitionName, encodedPassword); NPCNEP5Requisition.PutElement(uc, AppVAU, DOMAINNEP5REQ, encodedRequisitionName); if (NeoTrace.INFO) { NPCNEP5Requisition.LogExt("AddRequisition.added", uc); } } else { if (NeoTrace.INFO) { NPCNEP5Requisition.LogExt("AddRequisition.exists", uc); } } results = uc; if (NeoTrace.ARGSRESULTS) { NeoTrace.Trace("AddRequisition.results", results); } return(results); }
public static NPCNEP5Requisition Get(string key) { if (key.Length == 0) { return(Null()); } Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext; string _skeyTag = key + _classKeyTag; NPCNEP5Requisition e; byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sSTA); if (NeoTrace.RUNTIME) { TraceRuntime("Get(skey).NPCNEP5Requisition.bsta", bsta.Length, bsta); } if (bsta.Length == 0) { e = NPCNEP5Requisition.Missing(); } else // not MISSING { int ista = (int)bsta.AsBigInteger(); NeoEntityModel.EntityState sta = (NeoEntityModel.EntityState)ista; e = new NPCNEP5Requisition(); byte[] FromScriptHash = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sFromScriptHash); //NPCLevel2IGet_cs.txt byte[] ToScriptHash = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sToScriptHash); //NPCLevel2IGet_cs.txt string EncryptedBlobURI = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sEncryptedBlobURI).AsString(); //NPCLevel2IGet_cs.txt Int32 WorkflowState = (Int32)Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sWorkflowState).AsBigInteger(); //NPCLevel2IGet_cs.txt if (NeoTrace.RUNTIME) { TraceRuntime("Get(skey).e._fromScriptHash, e._toScriptHash, e._encryptedBlobURI, e._workflowState", e._fromScriptHash, e._toScriptHash, e._encryptedBlobURI, e._workflowState); // Template: NPCLevel2Part2_cs.txt } e._fromScriptHash = FromScriptHash; e._toScriptHash = ToScriptHash; e._encryptedBlobURI = EncryptedBlobURI; e._workflowState = WorkflowState; e._state = sta; e._state = NeoEntityModel.EntityState.GETTED; /* OVERRIDE */ } if (NeoTrace.RUNTIME) { LogExt("Get(skey).NPCNEP5Requisition", e); } return(e); }
public static NPCNEP5Requisition Get(byte[] key) { if (key.Length == 0) { return(Null()); } Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext; byte[] _bkeyTag = Helper.Concat(key, _bclassKeyTag); NPCNEP5Requisition e; byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, Helper.Concat(_bkeyTag, _bSTA)); if (NeoTrace.RUNTIME) { TraceRuntime("Get(bkey).bsta", bsta.Length, bsta); } if (bsta.Length == 0) { e = NPCNEP5Requisition.Missing(); } else // not MISSING { int ista = (int)bsta.AsBigInteger(); NeoEntityModel.EntityState sta = (NeoEntityModel.EntityState)ista; e = new NPCNEP5Requisition(); byte[] FromScriptHash = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, Helper.Concat(_bkeyTag, _bFromScriptHash)); //NPCLevel2GGet_cs.txt byte[] ToScriptHash = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, Helper.Concat(_bkeyTag, _bToScriptHash)); //NPCLevel2GGet_cs.txt string EncryptedBlobURI = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, Helper.Concat(_bkeyTag, _bEncryptedBlobURI)).AsString(); //NPCLevel2GGet_cs.txt Int32 WorkflowState = (Int32)Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, Helper.Concat(_bkeyTag, _bWorkflowState)).AsBigInteger(); //NPCLevel2GGet_cs.txt e._fromScriptHash = FromScriptHash; e._toScriptHash = ToScriptHash; e._encryptedBlobURI = EncryptedBlobURI; e._workflowState = WorkflowState; // Template: NPCLevel2HGet_cs.txt e._state = sta; e._state = NeoEntityModel.EntityState.GETTED; /* OVERRIDE */ } if (NeoTrace.RUNTIME) { LogExt("Get(bkey).NPCNEP5Requisition", e); } return(e); }
/// <summary> /// Bury an element of an array of entities in Storage based on a NeoStorageKey (NPC Level 4) /// </summary> /// <param name="vau">vau</param> /// <param name="index">index</param> /// <returns>NPCNEP5Requisition</returns> public static NPCNEP5Requisition BuryElement(NeoVersionedAppUser vau, byte[] domain, byte[] bindex) { if (NeoVersionedAppUser.IsNull(vau)) // TODO - create NeoEntityModel.EntityState.BADKEY? { return(NPCNEP5Requisition.Null()); } Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext; NeoStorageKey nsk = NeoStorageKey.New(vau, domain, _bClassName); //byte[] bkey; NPCNEP5Requisition e; byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bSTA)); if (NeoTrace.RUNTIME) { TraceRuntime("Bury(vau,index).NPCNEP5Requisition.bsta", bsta.Length, bsta); } if (bsta.Length == 0) { e = NPCNEP5Requisition.Missing(); } else // not MISSING - bury it { e = NPCNEP5Requisition.Tombstone(); // TODO - should Bury() preserve the exist field values or re-initialize them? Preserve is cheaper but not as private Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bSTA), e._state.AsBigInteger()); Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bFromScriptHash), e._fromScriptHash); // NPCLevel4EBuryElement_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bToScriptHash), e._toScriptHash); // NPCLevel4EBuryElement_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bEncryptedBlobURI), e._encryptedBlobURI); // NPCLevel4EBuryElement_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, bindex, _bWorkflowState), e._workflowState); // NPCLevel4EBuryElement_cs.txt } // Template: NPCLevel4Part2_cs.txt if (NeoTrace.RUNTIME) { LogExt("Bury(vau,i).NPCNEP5Requisition", e); } return(e); }
public static bool Put(NPCNEP5Requisition e, byte[] key) { if (key.Length == 0) { return(false); } Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext; byte[] _bkeyTag = Helper.Concat(key, _bclassKeyTag); e._state = NeoEntityModel.EntityState.PUTTED; Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, Helper.Concat(_bkeyTag, _bSTA), e._state.AsBigInteger()); Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, Helper.Concat(_bkeyTag, _bFromScriptHash), e._fromScriptHash); // Template: NPCLevel2CPut_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, Helper.Concat(_bkeyTag, _bToScriptHash), e._toScriptHash); // Template: NPCLevel2CPut_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, Helper.Concat(_bkeyTag, _bEncryptedBlobURI), e._encryptedBlobURI); // Template: NPCLevel2CPut_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, Helper.Concat(_bkeyTag, _bWorkflowState), e._workflowState); // Template: NPCLevel2CPut_cs.txt if (NeoTrace.RUNTIME) { LogExt("Put(bkey).NPCNEP5Requisition", e); // Template: NPCLevel2DPut_cs.txt } return(true); }
public static NPCNEP5Requisition Bury(string key) { if (key.Length == 0) { return(Null()); } Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext; string _skeyTag = key + _classKeyTag; NPCNEP5Requisition e; byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sSTA); if (NeoTrace.RUNTIME) { TraceRuntime("Bury(skey).NPCNEP5Requisition.bsta", bsta.Length, bsta); } if (bsta.Length == 0) { e = NPCNEP5Requisition.Missing(); } else // not MISSING - bury it { e = NPCNEP5Requisition.Tombstone(); // but don't overwrite existing field values - just tombstone it Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sSTA, e._state.AsBigInteger()); //Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sFromScriptHash, e._fromScriptHash); // Template: NPCLevel3CBury_cs.txt //Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sToScriptHash, e._toScriptHash); // Template: NPCLevel3CBury_cs.txt //Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sEncryptedBlobURI, e._encryptedBlobURI); // Template: NPCLevel3CBury_cs.txt //Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sWorkflowState, e._workflowState); // Template: NPCLevel3CBury_cs.txt } // Template: NPCLevel3Part2_cs.txt if (NeoTrace.RUNTIME) { LogExt("Bury(skey).NPCNEP5Requisition", e); } return(e); // return Entity e to signal if key is Missing or bad key }
public static bool Put(NPCNEP5Requisition e, string key) { if (key.Length == 0) { return(false); } if (NeoTrace.RUNTIME) { LogExt("Put(skey).NPCNEP5Requisition", e); } Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext; string _skeyTag = key + _classKeyTag; if (NeoTrace.RUNTIME) { TraceRuntime("Put(skey)._skeyTag", _skeyTag); } e._state = NeoEntityModel.EntityState.PUTTED; BigInteger bis = e._state.AsBigInteger(); if (NeoTrace.RUNTIME) { TraceRuntime("Put(skey).bis", bis); } Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sSTA, bis); Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sFromScriptHash, e._fromScriptHash); // Template: NPCLevel2EPut_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sToScriptHash, e._toScriptHash); // Template: NPCLevel2EPut_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sEncryptedBlobURI, e._encryptedBlobURI); // Template: NPCLevel2EPut_cs.txt Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, _skeyTag + _sWorkflowState, e._workflowState); // Template: NPCLevel2EPut_cs.txt if (NeoTrace.RUNTIME) { LogExt("Put(skey).NPCNEP5Requisition", e); // Template: NPCLevel2FGet_cs.txt } return(true); }
// Deletable methods public static bool IsBuried(NPCNEP5Requisition e) { return(e._state == NeoEntityModel.EntityState.TOMBSTONED); }
public static void Set(NPCNEP5Requisition e, byte[] FromScriptHash, byte[] ToScriptHash, string EncryptedBlobURI, Int32 WorkflowState) // Template: NPCLevel1Set_cs.txt { e._fromScriptHash = FromScriptHash; e._toScriptHash = ToScriptHash; e._encryptedBlobURI = EncryptedBlobURI; e._workflowState = WorkflowState; e._state = NeoEntityModel.EntityState.SET; }
public static Int32 GetWorkflowState(NPCNEP5Requisition e) { return(e._workflowState); }
public static void SetEncryptedBlobURI(NPCNEP5Requisition e, string value) // Template: NPCLevel1SetXGetX_cs.txt { e._encryptedBlobURI = value; e._state = NeoEntityModel.EntityState.SET; }
public static byte[] GetToScriptHash(NPCNEP5Requisition e) { return(e._toScriptHash); }
public static byte[] GetFromScriptHash(NPCNEP5Requisition e) { return(e._fromScriptHash); }
public static void LogExt(string label, NPCNEP5Requisition e) { TraceRuntime(label, e._fromScriptHash, e._toScriptHash, e._encryptedBlobURI, e._workflowState, e._state); }
// EntityState wrapper methods public static bool IsNull(NPCNEP5Requisition e) { return(e._state == NeoEntityModel.EntityState.NULL); }
public static object ProcessOperation(NeoVersionedAppUser AppVAU, NPCNEP5Base tokenBase, string operation, object[] args) { object result = false; if (NeoTrace.VERBOSE) { NeoTrace.Trace("operation", operation); } if (operation == "deploy") { result = deploy(tokenBase); } else if (operation == "ping") { result = ping(); } else if (operation == "name") { result = name(tokenBase); } else if (operation == "symbol") { result = symbol(tokenBase); } else if (operation == "decimals") { result = decimals(tokenBase); } else if (operation == "totalSupply") { result = totalSupply(tokenBase); } else if (operation == "balanceOf") { byte[] account = (byte[])args[0]; if (NeoTrace.TESTING && account[0] == 0x0) // DEBUGGING { account = OwnerAccountScriptHash; if (NeoTrace.VERBOSE) { NeoTrace.Trace("DEBUGGING:from", account); } } result = balanceOf(account); } else if (operation == "transfer") { if (args.Length == 3) { // https://github.com/neo-project/examples-csharp/blob/master/ICO_Template/ICO_Template.cs#L59 byte[] from = (byte[])args[0]; byte[] to = (byte[])args[1]; BigInteger amount = (BigInteger)args[2]; if (NeoTrace.TESTING && from[0] == 0x0) // DEBUGGING { from = OwnerAccountScriptHash; if (NeoTrace.VERBOSE) { NeoTrace.Trace("DEBUGGING:from", from); } } result = transfer(from, to, amount); } } else if (operation == "allowance") { byte[] from = (byte[])args[0]; byte[] to = (byte[])args[1]; if (NeoTrace.TESTING && from[0] == 0x0) // DEBUGGING { from = OwnerAccountScriptHash; if (NeoTrace.VERBOSE) { NeoTrace.Trace("DEBUGGING:from", from); } } result = allowance(from, to); // optional } else if (operation == "transferFrom") { byte[] originator = OwnerAccountScriptHash; byte[] from = (byte[])args[0]; byte[] to = (byte[])args[1]; BigInteger amount = (BigInteger)args[2]; if (NeoTrace.TESTING && originator[0] == 0x0) // DEBUGGING { originator = OwnerAccountScriptHash; if (NeoTrace.VERBOSE) { NeoTrace.Trace("DEBUGGING:originator", originator); } } result = transferFrom(originator, from, to, amount); // optional } else if (operation == "approve") { byte[] originator = OwnerAccountScriptHash; byte[] to = (byte[])args[0]; BigInteger amount = (BigInteger)args[1]; if (NeoTrace.TESTING && originator[0] == 0x0) // DEBUGGING { originator = OwnerAccountScriptHash; if (NeoTrace.VERBOSE) { NeoTrace.Trace("DEBUGGING:originator", originator); } } result = approve(originator, to, amount); // optional } else if (operation == "createUser") { result = UserCredentials.CreateUser(AppVAU, args); } else if (operation == "getUser") { result = UserCredentials.GetUser(AppVAU, args); } //else if (operation == "getUsers") //{ // result = UserCredentials.GetUsers(AppVAU, args); //} else if (operation == "CreateContributor") { result = NPCContributor.CreateContributor(AppVAU, args); } else if (operation == "getContributor") { result = NPCContributor.GetContributor(AppVAU, args); } //else if (operation == "getContributors") //{ // result = NPCContributor.GetContributors(AppVAU, args); //} else if (operation == "createRequisition") { result = NPCNEP5Requisition.CreateRequisition(AppVAU, args); } else if (operation == "submitRequisition") { result = NPCNEP5Requisition.SubmitRequisition(AppVAU, args); } else if (operation == "getContributorRequisitions") { result = NPCNEP5Requisition.GetContributorRequisitions(AppVAU, args); } else if (operation == "updateRequisition") { result = NPCNEP5Requisition.UpdateRequisition(AppVAU, args); } else if (operation == "payRequisition") { result = NPCNEP5Requisition.PayRequisition(AppVAU, args); } else { if (NeoTrace.INFO) { NeoTrace.Trace("Unknown operation", operation); } string message = "unknown operation '" + operation + "'"; if (NeoTrace.ERROR) { NeoTrace.Trace("**ERROR** operation", message); } result = false; } if (NeoTrace.VERBOSE) { NeoTrace.Trace("result", result); } return(result); }
public static string GetEncryptedBlobURI(NPCNEP5Requisition e) { return(e._encryptedBlobURI); }
public static void SetWorkflowState(NPCNEP5Requisition e, Int32 value) // Template: NPCLevel1SetXGetX_cs.txt { e._workflowState = value; e._state = NeoEntityModel.EntityState.SET; }
public static void SetToScriptHash(NPCNEP5Requisition e, byte[] value) // Template: NPCLevel1SetXGetX_cs.txt { e._toScriptHash = value; e._state = NeoEntityModel.EntityState.SET; }
// Persistable methods public static bool IsMissing(NPCNEP5Requisition e) { return(e._state == NeoEntityModel.EntityState.MISSING); }