コード例 #1
0
        /// <summary>
        /// helper method to retrieve the stored group unlock block height
        /// </summary>
        /// <param name="groupNumber"></param>
        /// <returns></returns>
        public static uint GetGroupUnlockTime(BigInteger groupNumber)
        {
            BigInteger unlockTime = 0;

            if (groupNumber <= 0 || groupNumber > 4)
            {
                return(0);
            }
            else if (groupNumber > 0 && groupNumber <= 4)
            {
                unlockTime = (uint)ICOTemplate.PresaleStartTime();
            }
            return((uint)unlockTime);
        }
コード例 #2
0
        /// <summary>
        /// get the maximum number of NOS that can be purchased by groupNumber during the public sale
        /// </summary>
        /// <param name="groupNumber"></param>
        /// <returns></returns>
        public static BigInteger GetGroupMaxContribution(BigInteger groupNumber)
        {
            BigInteger maxContribution           = 0;
            uint       latestTimeStamp           = Helpers.GetBlockTimestamp();
            uint       publicSaleMaxContribution = (uint)ICOTemplate.MaximumContributionAmount();
            uint       publicSaleEndTime         = (uint)ICOTemplate.PublicSaleEndTime();

            //If latest block timestamp is larger than presale start and smaller than presale end: check presale tier contributions.
            if (latestTimeStamp >= (uint)ICOTemplate.PresaleStartTime() && latestTimeStamp <= (uint)ICOTemplate.PresaleEndTime())
            {
                //Presale has not ended. Only presale can participate.
                if (groupNumber == 1)
                {
                    //Pre-sale tier 1.
                    maxContribution = (uint)ICOTemplate.PresaleTierOne();
                }
                else if (groupNumber == 2)
                {
                    //Pre-sale tier 2.
                    maxContribution = (uint)ICOTemplate.PresaleTierTwo();
                }
                else if (groupNumber == 3)
                {
                    //Pre-sale tier 3.
                    maxContribution = (uint)ICOTemplate.PresaleTierThree();
                }
                else if (groupNumber == 4)
                {
                    //Tier 4
                    maxContribution = (uint)ICOTemplate.PresaleTierFour();
                }
            }
            //Otherwise we're in the public sale; get the publicSaleMaxContribution
            //publicSaleMaxContribution returns the max contribution based on the presale phase using Helpers.GetPublicSaleMaxContribution()
            else if (groupNumber > 0 && groupNumber <= 4 && latestTimeStamp >= (uint)ICOTemplate.PublicSaleStartTime() && latestTimeStamp <= publicSaleEndTime)
            {
                maxContribution = publicSaleMaxContribution;
            }

            return(maxContribution);
        }