Add ETH and USDC balance check before start/restart bot and autoswap

This commit is contained in:
2025-09-23 14:03:46 +07:00
parent d13ac9fd21
commit 40f3c66694
23 changed files with 847 additions and 284 deletions

View File

@@ -891,11 +891,15 @@ public class EvmManager : IEvmManager
public async Task<decimal> GetFee(string chainName)
{
var chain = ChainService.GetChain(chainName);
var web3 = new Web3(chain.RpcUrl);
var etherPrice = (await GetPrices(new List<string> { "ethereum" }))["ethereum"]["usd"];
var fee = await GmxService.GetFee(web3, etherPrice);
return fee;
try
{
return await _web3ProxyService.GetEstimatedGasFeeUsdAsync();
}
catch (Exception ex)
{
Console.Error.WriteLine($"Error getting estimated gas fee: {ex.Message}");
return 0;
}
}
public async Task<List<Trade>> GetOrders(Account account, Ticker ticker)