Enhance user authentication by adding optional OwnerWalletAddress parameter in LoginRequest and UserService. Update UserController and related components to support the new wallet address functionality, ensuring better user profile management and validation in trading operations.

This commit is contained in:
2025-11-17 13:48:05 +07:00
parent 8697f1598d
commit 06ef33b7ab
15 changed files with 1802 additions and 28 deletions

View File

@@ -163,25 +163,20 @@ namespace Managing.Application.ManageBot
}
}
private async Task ValidateKudaiStakingRequirements(User user)
private async Task ValidateKudaiStakingRequirements(User user)
{
// Use the user's wallet address directly
if (string.IsNullOrEmpty(user.OwnerWalletAddress))
{
// Get user's accounts to find their wallet address
var userAccounts = await _accountService.GetAccountsByUserAsync(user, true, true);
var evmAccount = userAccounts.FirstOrDefault(acc =>
acc.Exchange == TradingExchanges.Evm ||
acc.Exchange == TradingExchanges.GmxV2);
throw new InvalidOperationException(
"To copy trade the Kudai strategy, you must have a wallet address configured in your profile.");
}
if (evmAccount == null)
{
throw new InvalidOperationException(
"To copy trade the Kudai strategy, you must have an EVM-compatible account (GMX V2 or EVM exchange).");
}
// Check KUDAI staked balance
var kudaiStakedBalance = await _evmManager.GetKudaiStakedBalance(user.OwnerWalletAddress);
// Check KUDAI staked balance
var kudaiStakedBalance = await _evmManager.GetKudaiStakedBalance(evmAccount.Key);
// Check GBC staked NFT count
var gbcStakedCount = await _evmManager.GetGbcStakedCount(evmAccount.Key);
// Check GBC staked NFT count
var gbcStakedCount = await _evmManager.GetGbcStakedCount(user.OwnerWalletAddress);
// Requirements: 100 million KUDAI OR 10 GBC NFTs
const decimal requiredKudaiAmount = 100_000_000m; // 100 million