Add ETH and USDC balance check before start/restart bot and autoswap
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user