예제 #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);
        }