Exemplo n.º 1
0
        /// <summary>
        /// helper method to retrieve the stored group unlock block height
        /// </summary>
        /// <param name="groupNumber"></param>
        /// <returns></returns>
        public static uint GetGroupUnlockBlock(BigInteger groupNumber)
        {
            if (groupNumber <= 0)
            {
                return(0);
            }

            StorageMap unlockBlock = Storage.CurrentContext.CreateMap(StorageKeys.GroupUnlockPrefix());

            return((uint)unlockBlock.Get(groupNumber.AsByteArray()).AsBigInteger());
        }
Exemplo n.º 2
0
        /// <summary>
        /// set the block number that a specific group is allowed to participate in the ICO
        /// </summary>
        /// <param name="groupNumber"></param>
        /// <param name="unlockBlockNumber">group will be able to participate at this block height</param>
        /// <returns></returns>
        public static bool SetGroupUnlockBlock(BigInteger groupNumber, uint unlockBlockNumber)
        {
            if (groupNumber <= 0 || unlockBlockNumber <= 0)
            {
                return(false);
            }

            if (Helpers.VerifyIsAdminAccount())
            {
                Runtime.Notify("SetGroupUnlockBlock() groupNumber / unlockBlockNumber", groupNumber, unlockBlockNumber);
                StorageMap unlockBlocks = Storage.CurrentContext.CreateMap(StorageKeys.GroupUnlockPrefix());
                unlockBlocks.Put(groupNumber.AsByteArray(), unlockBlockNumber);
                return(true);
            }

            return(false);
        }