Fixes for bots running (#22)
* Fixes for bots running * Up botmanager * Add cooldown * Refact can open position * Add cooldown Period and MaxLossStreak * Add agentName * Add env variable for botManager * Always enable Botmanager * Fix bot handle * Fix get positions * Add Ticker url * Dont start stopped bot * fix
This commit is contained in:
@@ -24,7 +24,7 @@ public class UserService : IUserService
|
||||
"0x23AA99254cfaA2c374bE2bA5B55C68018cCdFCb3", // Local optiflex
|
||||
"0x932167388dD9aad41149b3cA23eBD489E2E2DD78", // Embedded wallet
|
||||
"0x66CB57Fe3f53cE57376421106dFDa2D39186cBd0", // Embedded wallet optiflex
|
||||
"0x7baBf95621f22bEf2DB67E500D022Ca110722FaD", // DevCowchain
|
||||
"0x7baBf95621f22bEf2DB67E500D022Ca110722FaD", // DevCowchain
|
||||
"0xc8bC497534d0A43bAb2BBA9BA94d46D9Ddfaea6B" // DevCowchain2
|
||||
];
|
||||
|
||||
@@ -47,7 +47,8 @@ public class UserService : IUserService
|
||||
if (!message.Equals("KaigenTeamXCowchain"))
|
||||
{
|
||||
_logger.LogWarning($"Message {message} not starting with KaigenTeamXCowchain");
|
||||
throw new Exception($"Message not good : {message} - Address : {address} - User : {name} - Signature : {signature}");
|
||||
throw new Exception(
|
||||
$"Message not good : {message} - Address : {address} - User : {name} - Signature : {signature}");
|
||||
}
|
||||
|
||||
// if (!authorizedAddresses.Contains(recoveredAddress))
|
||||
@@ -106,11 +107,19 @@ public class UserService : IUserService
|
||||
{
|
||||
account
|
||||
};
|
||||
|
||||
// Update user with the new account
|
||||
await _userRepository.UpdateUser(user);
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public User GetUser(string name)
|
||||
{
|
||||
return _userRepository.GetUserByNameAsync(name).Result;
|
||||
}
|
||||
|
||||
public async Task<User> GetUserByAddressAsync(string address)
|
||||
{
|
||||
var account = await _accountService.GetAccountByKey(address, true, false);
|
||||
@@ -118,4 +127,18 @@ public class UserService : IUserService
|
||||
user.Accounts = _accountService.GetAccountsByUser(user).ToList();
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<User> UpdateAgentName(User user, string agentName)
|
||||
{
|
||||
// Check if agent name is already used
|
||||
var existingUser = await _userRepository.GetUserByAgentNameAsync(agentName);
|
||||
if (existingUser != null)
|
||||
{
|
||||
throw new Exception("Agent name already used");
|
||||
}
|
||||
|
||||
user.AgentName = agentName;
|
||||
await _userRepository.UpdateUser(user);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user