コード例 #1
0
        private async Task <WithdrawCurrencyModel> CreateWithdrawModel(Cryptopia.Entity.ApplicationUser user, WithdrawCurrencyModel model)
        {
            var currencyData = await CurrencyReader.GetCurrency(model.Symbol);

            var balanceData = await BalanceReader.GetCurrencyBalance(User.Identity.GetUserId(), currencyData.CurrencyId);

            var addressBook = await AddressBookReader.GetAddressBook(User.Identity.GetUserId(), currencyData.CurrencyId);

            var verificationData = await UserVerificationReader.GetVerificationStatus(User.Identity.GetUserId());

            var estimatedCoinNzd = await BalanceEstimationService.GetNZDPerCoin(currencyData.CurrencyId);

            model                  = user.GetTwoFactorModel(TwoFactorComponent.Withdraw, model);
            model.Name             = currencyData.Name;
            model.CurrencyId       = currencyData.CurrencyId;
            model.CurrencyType     = currencyData.Type;
            model.Symbol           = balanceData.Symbol;
            model.Balance          = balanceData.Available;
            model.Fee              = currencyData.WithdrawFee;
            model.WithdrawFeeType  = currencyData.WithdrawFeeType;
            model.MinWithdraw      = currencyData.WithdrawMin;
            model.MaxWithdraw      = currencyData.WithdrawMax;
            model.AddressBookOnly  = !user.IsUnsafeWithdrawEnabled;
            model.AddressBook      = addressBook;
            model.AddressType      = currencyData.AddressType;
            model.HasWithdrawLimit = verificationData.Limit > 0;
            model.WithdrawLimit    = verificationData.Limit;
            model.WithdrawTotal    = verificationData.Current;
            model.EstimatedCoinNZD = estimatedCoinNzd;
            model.Instructions     = currencyData.WithdrawInstructions;
            model.Message          = currencyData.WithdrawMessage;
            model.MessageType      = currencyData.WithdrawMessageType.ToString().ToLower();
            model.Decimals         = currencyData.CurrencyDecimals;
            return(model);
        }
コード例 #2
0
        private async Task <TransferCurrencyModel> CreateTransferModel(Cryptopia.Entity.ApplicationUser user, TransferCurrencyModel model)
        {
            var currencyData = await CurrencyReader.GetCurrency(model.Symbol);

            var balanceData = await BalanceReader.GetCurrencyBalance(User.Identity.GetUserId(), currencyData.CurrencyId);

            var verificationData = await UserVerificationReader.GetVerificationStatus(User.Identity.GetUserId());

            var estimatedCoinNzd = await BalanceEstimationService.GetNZDPerCoin(currencyData.CurrencyId);

            model                  = user.GetTwoFactorModel(TwoFactorComponent.Transfer, model);
            model.Name             = currencyData.Name;
            model.CurrencyId       = currencyData.CurrencyId;
            model.Symbol           = balanceData.Symbol;
            model.Balance          = balanceData.Available;
            model.HasWithdrawLimit = verificationData.Limit > 0;
            model.WithdrawLimit    = verificationData.Limit;
            model.WithdrawTotal    = verificationData.Current;
            model.EstimatedCoinNZD = estimatedCoinNzd;
            return(model);
        }