示例#1
0
        /// <summary>
        /// retrieve the group number the whitelisted address is in
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        public static BigInteger GetWhitelistGroupNumber(byte[] address)
        {
            if (address.Length != 20)
            {
                return(0);
            }

            StorageMap kycWhitelist = Storage.CurrentContext.CreateMap(StorageKeys.KYCWhitelistPrefix());

            return(kycWhitelist.Get(address).AsBigInteger());
        }
示例#2
0
        /// <summary>
        /// remove an address from the whitelist
        /// </summary>
        /// <param name="address"></param>
        public static bool RevokeAddress(byte[] address)
        {
            if (address.Length != 20)
            {
                return(false);
            }

            if (Helpers.VerifyWitness(ICOTemplate.KycMiddlewareKey))
            {
                StorageMap kycWhitelist = Storage.CurrentContext.CreateMap(StorageKeys.KYCWhitelistPrefix());
                kycWhitelist.Delete(address);
                return(true);
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// remove an address from the whitelist
        /// </summary>
        /// <param name="address"></param>
        public static bool RevokeAddress(byte[] address)
        {
            if (address.Length != 20)
            {
                return(false);
            }

            if (Helpers.VerifyIsAdminAccount())
            {
                StorageMap kycWhitelist = Storage.CurrentContext.CreateMap(StorageKeys.KYCWhitelistPrefix());
                kycWhitelist.Delete(address);
                return(true);
            }
            return(false);
        }
示例#4
0
        /// <summary>
        /// add an address to the kyc whitelist
        /// </summary>
        /// <param name="address"></param>
        public static bool AddAddress(byte[] address, int groupNumber)
        {
            if (address.Length != 20 || groupNumber <= 0 || groupNumber > 4)
            {
                return(false);
            }

            if (Helpers.VerifyWitness(ICOTemplate.KycMiddlewareKey))
            {
                StorageMap kycWhitelist = Storage.CurrentContext.CreateMap(StorageKeys.KYCWhitelistPrefix());
                kycWhitelist.Put(address, groupNumber);
                return(true);
            }
            return(false);
        }
示例#5
0
        /// <summary>
        /// add an address to the kyc whitelist
        /// </summary>
        /// <param name="address"></param>
        public static bool AddAddress(byte[] address, int groupNumber)
        {
            if (address.Length != 20 || groupNumber <= 0)
            {
                return(false);
            }

            if (Helpers.VerifyIsAdminAccount())
            {
                StorageMap kycWhitelist = Storage.CurrentContext.CreateMap(StorageKeys.KYCWhitelistPrefix());
                kycWhitelist.Put(address, groupNumber);
                return(true);
            }
            return(false);
        }