/// <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(NeoCounter e, NeoVersionedAppUser vau, byte[] domain, int index)
        {
            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);

            // no readonly fields byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, index, _bSTA));
            // no readonly fields if (NeoTrace.RUNTIME) TraceRuntime("Get(bkey).NeoCounter.bsta", bsta.Length, bsta);
            // no readonly fields bool isMissing = false; if (bsta.Length == 0) isMissing = true;

            //byte[] bkey;
            e._state = NeoEntityModel.EntityState.PUTTED;
            Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, index, _bSTA), e._state.AsBigInteger());

            Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, index, _bCurrentNumber), e._currentNumber); // Template: NPCLevel4APutElementExt0_cs.txt

            if (NeoTrace.RUNTIME)
            {
                LogExt("PutElement(vau,i).NeoCounter", e);                   // Template: NPCLevel4BGetElement_cs.txt
            }
            return(true);
        }
        public static NeoCounter 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;

            NeoCounter e;

            byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sSTA);
            if (NeoTrace.RUNTIME)
            {
                TraceRuntime("Bury(skey).NeoCounter.bsta", bsta.Length, bsta);
            }
            if (bsta.Length == 0)
            {
                e = NeoCounter.Missing();
            }
            else // not MISSING - bury it
            {
                e = NeoCounter.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 + _sCurrentNumber, e._currentNumber); // Template: NPCLevel3CBury_cs.txt
            } // Template: NPCLevel3Part2_cs.txt
            if (NeoTrace.RUNTIME)
            {
                LogExt("Bury(skey).NeoCounter", e);
            }
            return(e); // return Entity e to signal if key is Missing or bad key
        }
        /// <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>NeoCounter</returns>
        public static NeoCounter BuryElement(NeoVersionedAppUser vau, byte[] domain, int index)
        {
            if (NeoVersionedAppUser.IsNull(vau)) // TODO - create NeoEntityModel.EntityState.BADKEY?
            {
                return(NeoCounter.Null());
            }

            Neo.SmartContract.Framework.Services.Neo.StorageContext ctx = Neo.SmartContract.Framework.Services.Neo.Storage.CurrentContext;
            NeoStorageKey nsk = NeoStorageKey.New(vau, domain, _bClassName);

            //byte[] bkey;
            NeoCounter e;

            byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, index, _bSTA));
            if (NeoTrace.RUNTIME)
            {
                TraceRuntime("Bury(vau,index).NeoCounter.bsta", bsta.Length, bsta);
            }
            if (bsta.Length == 0)
            {
                e = NeoCounter.Missing();
            }
            else // not MISSING - bury it
            {
                e = NeoCounter.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, index, _bSTA), e._state.AsBigInteger());

                Neo.SmartContract.Framework.Services.Neo.Storage.Put(ctx, NeoStorageKey.StorageKey(nsk, index, _bCurrentNumber), e._currentNumber); // NPCLevel4EBuryElement_cs.txt
            } // Template: NPCLevel4Part2_cs.txt
            if (NeoTrace.RUNTIME)
            {
                LogExt("Bury(vau,i).NeoCounter", e);
            }
            return(e);
        }
 // Factory methods // Template: NPCLevel1Part2_cs.txt
 private static NeoCounter _Initialize(NeoCounter e)
 {
     e._currentNumber = 0;
     e._state         = NeoEntityModel.EntityState.NULL;
     if (NeoTrace.RUNTIME)
     {
         LogExt("_Initialize(e).NeoCounter", e);
     }
     return(e);
 }
        public static NeoCounter Null()
        {
            NeoCounter e = new NeoCounter();

            _Initialize(e);
            if (NeoTrace.RUNTIME)
            {
                LogExt("Null().NeoCounter", e);
            }
            return(e);
        }
        public static NeoCounter New(BigInteger CurrentNumber)
        {
            NeoCounter e = new NeoCounter();

            e._currentNumber = CurrentNumber;
            e._state         = NeoEntityModel.EntityState.INIT;
            if (NeoTrace.RUNTIME)
            {
                LogExt("New(.,.).NeoCounter", e);
            }
            return(e);
        }
        public static NeoCounter Missing()
        {
            NeoCounter e = new NeoCounter();

            e._currentNumber = 0;
            e._state         = NeoEntityModel.EntityState.MISSING;
            if (NeoTrace.RUNTIME)
            {
                LogExt("Missing().NeoCounter", e);
            }
            return(e);
        }
        public static NeoCounter Tombstone()
        {
            NeoCounter e = new NeoCounter();

            e._currentNumber = 0;
            e._state         = NeoEntityModel.EntityState.TOMBSTONED;
            if (NeoTrace.RUNTIME)
            {
                LogExt("Tombstone().NeoCounter", e);
            }
            return(e);
        }
Exemple #9
0
        public static BigInteger GetNextNumber(NeoVersionedAppUser vau, NeoCounters counter)
        {
            BigInteger result = -1;

            NeoCounter nc = NeoCounter.GetElement(vau, DOMAINAC, (int)counter); // Get persisted counter value

            if (!NeoCounter.IsMissing(nc))
            {
                result = NeoCounter.GetCurrentNumber(nc);
            }

            return(result); // Return the current value for this counter
        }
Exemple #10
0
        // Use case example: domain = user script hash, counter = NeoCounters.UserPointsCounter
        // TakeNextNumber semantics: return the current number and then advance the counter ...like at the grocery store
        public static BigInteger TakeNextNumber(NeoVersionedAppUser vau, byte[] domain, NeoCounters counter)
        {
            NeoCounter nc = NeoCounter.GetElement(vau, domain, (int)counter); // Get persisted counter value

            if (NeoTrace.VERBOSE)
            {
                NeoCounter.LogExt("TakeNextNumber", nc);
            }

            if (NeoCounter.IsMissing(nc)) // Create persist the new counter entity
            {
                if (NeoTrace.VERBOSE)
                {
                    NeoCounter.LogExt("TakeNextNumber.domain and counter is missing", nc);
                }
                nc = NeoCounter.New(); // Create a new counter entity
                if (NeoTrace.VERBOSE)
                {
                    NeoCounter.LogExt("TakeNextNumber.putnew", nc);
                }
                NeoCounter.PutElement(nc, vau, domain, (int)counter); // Persist the new counter entity with a value of zero
            }

            if (NeoTrace.VERBOSE)
            {
                NeoCounter.LogExt("TakeNextNumber.exists", nc);
            }
            BigInteger currentNextNumber = NeoCounter.GetCurrentNumber(nc);

            if (NeoTrace.VERBOSE)
            {
                NeoTraceRuntime.TraceRuntime("currentNextNumber", currentNextNumber);
            }
            BigInteger newNextNumber = currentNextNumber + 1;

            if (NeoTrace.VERBOSE)
            {
                NeoTraceRuntime.TraceRuntime("nextNumber", newNextNumber);
            }
            NeoCounter.SetCurrentNumber(nc, newNextNumber);
            if (NeoTrace.VERBOSE)
            {
                NeoCounter.LogExt("TakeNextNumber.putincr", nc);
            }
            NeoCounter.PutElement(nc, vau, domain, (int)counter); // Persist the new counter

            return(currentNextNumber);
        }
        /// <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>NeoCounter</returns>
        public static NeoCounter GetElement(NeoVersionedAppUser vau, byte[] domain, int index)
        {
            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);

            NeoCounter e;

            //byte[] bkey;
            byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, index, _bSTA));
            if (NeoTrace.RUNTIME)
            {
                TraceRuntime("Get(bkey).NeoCounter.bsta", bsta.Length, bsta);
            }
            if (bsta.Length == 0)
            {
                e = NeoCounter.Missing();
            }
            else // not MISSING
            {
                int ista = (int)bsta.AsBigInteger();
                NeoEntityModel.EntityState sta = (NeoEntityModel.EntityState)ista;
                if (sta == NeoEntityModel.EntityState.TOMBSTONED)
                {
                    e = NeoCounter.Tombstone();
                }
                else // not MISSING && not TOMBSTONED
                {
                    e = new NeoCounter();
                    BigInteger CurrentNumber = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, NeoStorageKey.StorageKey(nsk, index, _bCurrentNumber)).AsBigInteger(); // Template: NPCLevel4CGetElement_cs.txt

                    e._currentNumber = CurrentNumber;                                                                                                                           // NPCLevel4DBuryElement_cs.txt
                    e._state         = sta;
                    e._state         = NeoEntityModel.EntityState.GETTED;                                                                                                       /* OVERRIDE */
                }
            }
            if (NeoTrace.RUNTIME)
            {
                LogExt("Get(bkey).NeoCounter.e", e);
            }
            return(e);
        }
        public static NeoCounter 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;

            NeoCounter e;

            byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sSTA);
            if (NeoTrace.RUNTIME)
            {
                TraceRuntime("Get(skey).NeoCounter.bsta", bsta.Length, bsta);
            }
            if (bsta.Length == 0)
            {
                e = NeoCounter.Missing();
            }
            else // not MISSING
            {
                int ista = (int)bsta.AsBigInteger();
                NeoEntityModel.EntityState sta = (NeoEntityModel.EntityState)ista;
                e = new NeoCounter();

                BigInteger CurrentNumber = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sCurrentNumber).AsBigInteger(); //NPCLevel2IGet_cs.txt
                if (NeoTrace.RUNTIME)
                {
                    TraceRuntime("Get(skey).e._currentNumber", e._currentNumber);                   // Template: NPCLevel2Part2_cs.txt
                }
                e._currentNumber = CurrentNumber;
                e._state         = sta;
                e._state         = NeoEntityModel.EntityState.GETTED; /* OVERRIDE */
            }
            if (NeoTrace.RUNTIME)
            {
                LogExt("Get(skey).NeoCounter", e);
            }
            return(e);
        }
Exemple #13
0
        public static BigInteger TakeNextNumber(NeoVersionedAppUser vau, NeoCounters counter)
        {
            NeoCounter nc = NeoCounter.GetElement(vau, DOMAINAC, (int)counter); // Get persisted counter value

            if (NeoTrace.VERBOSE)
            {
                NeoCounter.LogExt("TakeNextNumber", nc);
            }

            if (NeoCounter.IsMissing(nc))
            {
                nc = NeoCounter.New(); // Create a new counter value
                if (NeoTrace.VERBOSE)
                {
                    NeoCounter.LogExt("TakeNextNumber.putnew", nc);
                }
                NeoCounter.PutElement(nc, vau, DOMAINAC, (int)counter); // Persist the new counter
            }
            else // Get and increment counter value by 1
            {
                BigInteger newNumber = NeoCounter.GetCurrentNumber(nc);
                if (NeoTrace.VERBOSE)
                {
                    NeoTraceRuntime.TraceRuntime("newNumber", newNumber);
                }
                newNumber = newNumber + 1;
                if (NeoTrace.VERBOSE)
                {
                    NeoTraceRuntime.TraceRuntime("newNumber", newNumber);
                }
                NeoCounter.SetCurrentNumber(nc, newNumber);
                if (NeoTrace.VERBOSE)
                {
                    NeoCounter.LogExt("TakeNextNumber.putincr", nc);
                }
                NeoCounter.PutElement(nc, vau, DOMAINAC, (int)counter); // Persist the new counter
            }

            return(NeoCounter.GetCurrentNumber(nc));
        }
Exemple #14
0
        // Use case example: domain = user script hash, counter = NeoCounters.UserPointsCounter
        public static BigInteger GiveBackLastNumber(NeoVersionedAppUser vau, byte[] domain, NeoCounters counter)
        {
            NeoCounter nc = NeoCounter.GetElement(vau, domain, (int)counter); // Get persisted counter value

            if (NeoTrace.VERBOSE)
            {
                NeoCounter.LogExt("GiveBackLastNumber", nc);
            }

            if (NeoCounter.IsMissing(nc))
            {
                nc = NeoCounter.New(); // Create a new counter value
            }
            else // Get and decrement counter value by 1
            {
                BigInteger currentNumber = NeoCounter.GetCurrentNumber(nc);
                if (NeoTrace.VERBOSE)
                {
                    NeoTraceRuntime.TraceRuntime("currentNumber", currentNumber);
                }
                currentNumber = currentNumber - 1;
                if (NeoTrace.VERBOSE)
                {
                    NeoTraceRuntime.TraceRuntime("currentNumber", currentNumber);
                }
                NeoCounter.SetCurrentNumber(nc, currentNumber);
                if (NeoTrace.VERBOSE)
                {
                    NeoCounter.LogExt("GiveBackLastNumber", nc);
                }
                NeoCounter.PutElement(nc, vau, domain, (int)counter); // Persist the incremented current value of the counter
                if (NeoTrace.VERBOSE)
                {
                    NeoCounter.LogExt("GiveBackLastNumber", nc);
                }
            }

            return(NeoCounter.GetCurrentNumber(nc));
        }
        public static bool Put(NeoCounter e, string key)
        {
            if (key.Length == 0)
            {
                return(false);
            }
            if (NeoTrace.RUNTIME)
            {
                LogExt("Put(skey).NeoCounter", 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);
            }

            // no readonly fields byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, _skeyTag + _sSTA);
            // no readonly fields if (NeoTrace.RUNTIME) TraceRuntime("Put(skey).bsta", bsta.Length, bsta);
            // no readonly fields bool isMissing = false; if (bsta.Length == 0) isMissing = true;

            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 + _sCurrentNumber, e._currentNumber); // Template: NPCLevel2EPut_cs.txt
            if (NeoTrace.RUNTIME)
            {
                LogExt("Put(skey).NeoCounter", e);                   // Template: NPCLevel2FGet_cs.txt
            }
            return(true);
        }
        public static NeoCounter 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);

            NeoCounter 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 = NeoCounter.Missing();
            }
            else // not MISSING
            {
                int ista = (int)bsta.AsBigInteger();
                NeoEntityModel.EntityState sta = (NeoEntityModel.EntityState)ista;
                e = new NeoCounter();

                BigInteger CurrentNumber = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, Helper.Concat(_bkeyTag, _bCurrentNumber)).AsBigInteger(); //NPCLevel2GGet_cs.txt
                e._currentNumber = CurrentNumber;                                                                                                              // Template: NPCLevel2HGet_cs.txt
                e._state         = sta;
                e._state         = NeoEntityModel.EntityState.GETTED;                                                                                          /* OVERRIDE */
            }
            if (NeoTrace.RUNTIME)
            {
                LogExt("Get(bkey).NeoCounter", e);
            }
            return(e);
        }
        public static bool Put(NeoCounter 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);

            // no readonly fields byte[] bsta = Neo.SmartContract.Framework.Services.Neo.Storage.Get(ctx, Helper.Concat(_bkeyTag, _bSTA));
            // no readonly fields if (NeoTrace.RUNTIME) TraceRuntime("Put(bkey).bsta", bsta.Length, bsta);
            // no readonly fields bool isMissing = false; if (bsta.Length == 0) isMissing = true;

            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, _bCurrentNumber), e._currentNumber); // Template: NPCLevel2CPut_cs.txt
            if (NeoTrace.RUNTIME)
            {
                LogExt("Put(bkey).NeoCounter", e);                   // Template: NPCLevel2DPut_cs.txt
            }
            return(true);
        }
 public static void LogExt(string label, NeoCounter e)
 {
     TraceRuntime(label, e._currentNumber, e._state);
 }
 public static BigInteger GetCurrentNumber(NeoCounter e)
 {
     return(e._currentNumber);
 }
 // Deletable methods
 public static bool IsBuried(NeoCounter e)
 {
     return(e._state == NeoEntityModel.EntityState.TOMBSTONED);
 }
 public static void Set(NeoCounter e, BigInteger CurrentNumber) // Template: NPCLevel1Set_cs.txt
 {
     { e._currentNumber = CurrentNumber;  e._state = NeoEntityModel.EntityState.SET; }
 }
 // Persistable methods
 public static bool IsMissing(NeoCounter e)
 {
     return(e._state == NeoEntityModel.EntityState.MISSING);
 }
        // Accessors

        public static void SetCurrentNumber(NeoCounter e, BigInteger value) // Template: NPCLevel1SetXGetX_cs.txt
        {
            e._currentNumber = value; e._state = NeoEntityModel.EntityState.SET;
        }
 // EntityState wrapper methods
 public static bool IsNull(NeoCounter e)
 {
     return(e._state == NeoEntityModel.EntityState.NULL);
 }
Exemple #25
0
        public static object Main()
        {
            object result = false;

            NeoVersionedAppUser vau = NeoVersionedAppUser.New(_AppName, _AppVersionMajor, _AppVersionMinor, _AppVersionBuild, _OwnerAccountScriptHash);

            NeoCounter counter1 = NeoCounter.New(1234);

            NeoCounter.Put(counter1, "MyCounter1");
            NeoCounter.Log("counter1", counter1);
            counter1 = NeoCounter.Get("MyCounter1");
            NeoCounter.Log("counter1", counter1);

            NeoCounter counter2 = NeoCounter.New(5678);

            NeoCounter.PutElement(counter2, vau, DOMAIN_MYCOUNTER2, 0);
            NeoCounter.Log("counter2", counter2);
            counter2 = NeoCounter.GetElement(vau, DOMAIN_MYCOUNTER2, 0);
            NeoCounter.Log("counter2", counter2);

            BigInteger nextNumber3 = NeoCounter.TakeNextNumber(vau, NeoCounter.NeoCounters.PointCounter);

            NeoTrace.Trace("nextNumber3", nextNumber3);
            nextNumber3 = NeoCounter.TakeNextNumber(vau, NeoCounter.NeoCounters.PointCounter);
            NeoTrace.Trace("nextNumber3", nextNumber3);
            nextNumber3 = NeoCounter.TakeNextNumber(vau, NeoCounter.NeoCounters.PointCounter);
            NeoTrace.Trace("nextNumber3", nextNumber3);

            BigInteger nextNumber5 = NeoCounter.TakeNextNumber(vau, DOMAIN_MYCOUNTER5, NeoCounter.NeoCounters.RequisitionCounter);

            NeoTrace.Trace("nextNumber5", nextNumber5);
            nextNumber5 = NeoCounter.TakeNextNumber(vau, DOMAIN_MYCOUNTER5, NeoCounter.NeoCounters.RequisitionCounter);
            NeoTrace.Trace("nextNumber5", nextNumber5);
            nextNumber5 = NeoCounter.TakeNextNumber(vau, DOMAIN_MYCOUNTER5, NeoCounter.NeoCounters.RequisitionCounter);
            NeoTrace.Trace("nextNumber5", nextNumber5);

            int iteration = 0;

            while (true)
            {
                if (iteration >= 10)
                {
                    break;
                }
                NeoTrace.Trace("iteration", iteration);

                BigInteger nextIndex = NeoCounter.TakeNextNumber(vau, NeoCounter.NeoCounters.UserCounter);
                NeoTrace.Trace("nextIndex", nextIndex);

                UserLedgerEntry e = UserLedgerEntry.New(_User1AccountScriptHash, _User1PassphraseScriptHash);
                UserLedgerEntry.Log("e.put1", e);
                UserLedgerEntry.SetUserScriptHash(e, _User2AccountScriptHash);
                UserLedgerEntry.Log("e.put2", e);
                UserLedgerEntry.SetPassphraseScriptHash(e, _User2PassphraseScriptHash);
                UserLedgerEntry.Log("e.put3", e);

                UserLedgerEntry.PutElement(e, vau, DOMAIN_USERLEDGER, (int)nextIndex);
                iteration++;
            }

            iteration = 0;
            BigInteger nUsers = NeoCounter.GetNextNumber(vau, NeoCounter.NeoCounters.UserCounter);

            UserLedgerEntry[] users = new UserLedgerEntry[(int)nUsers];
            while (true)
            {
                if (iteration >= nUsers)
                {
                    break;
                }
                NeoTrace.Trace("iteration", iteration);

                UserLedgerEntry e = UserLedgerEntry.GetElement(vau, DOMAIN_USERLEDGER, iteration);
                UserLedgerEntry.Log("e.get", e);
                users[iteration] = e;
                UserLedgerEntry.Log("users[iteration]", users[iteration]);
                iteration++;
            }

            result = users;
            return(result);
        }