Exemplo n.º 1
0
        /// <summary>
        /// get the maximum number of LX that can be purchased by groupNumber during the public sale
        /// </summary>
        /// <param name="groupNumber"></param>
        /// <returns></returns>
        public static BigInteger GetGroupMaxContribution(BigInteger groupNumber)
        {
            StorageMap contributionLimits = Storage.CurrentContext.CreateMap(StorageKeys.GroupContributionAmountPrefix());
            BigInteger maxContribution    = contributionLimits.Get(groupNumber.AsByteArray()).AsBigInteger();

            if (maxContribution > 0)
            {
                return(maxContribution);
            }

            return(ICOContract.MaximumContributionAmount());
        }
Exemplo n.º 2
0
        /// <summary>
        /// allow administrator to set the maximum contribution amount allowed for a presale group
        /// </summary>
        /// <param name="groupNumber"></param>
        /// <param name="maxContribution">max number of LX that can be purchased by this group</param>
        /// <returns></returns>
        public static bool SetGroupMaxContribution(BigInteger groupNumber, uint maxContribution)
        {
            if (groupNumber <= 0 || maxContribution <= 0)
            {
                return(false);
            }

            if (Helpers.VerifyIsAdminAccount())
            {
                StorageMap contributionLimits = Storage.CurrentContext.CreateMap(StorageKeys.GroupContributionAmountPrefix());
                contributionLimits.Put(groupNumber.AsByteArray(), maxContribution);
                return(true);
            }

            return(false);
        }