* Move PrivateKeys.cs * Update gitignore * Update gitignore * updt * Extract GmxServiceTests.cs * Refact * update todo * Update code * Fix hashdata * Replace static token hashed datas * Set allowance * Add get orders * Add get orders tests * Add ignore * add close orders * revert * Add get gas limit * Start increasePosition. Todo: Finish GetExecutionFee and estimateGas * little refact * Update gitignore * Fix namespaces and clean repo * Add tests samples * Add execution fee * Add increase position * Handle backtest on the frontend * Add tests * Update increase * Test increase * fix increase * Fix size * Start get position * Update get positions * Fix get position * Update rpc and trade mappers * Finish close position * Fix leverage
74 lines
2.0 KiB
C#
74 lines
2.0 KiB
C#
using Managing.Common;
|
|
using Managing.Domain.Evm;
|
|
|
|
namespace Managing.Infrastructure.Evm.Services;
|
|
|
|
public static class ChainService
|
|
{
|
|
//private const string RPC_ARBITRUM = "https://convincing-smart-arm.arbitrum-mainnet.discover.quiknode.pro/561ad3fa1db431a2c728c2fdb1a62e8f94acf703/";
|
|
private const string RPC_ARBITRUM =
|
|
"https://convincing-smart-arm.arbitrum-mainnet.quiknode.pro/561ad3fa1db431a2c728c2fdb1a62e8f94acf703";
|
|
|
|
private const string RPC_ARBITRUM_GOERLI = "https://arb-goerli.g.alchemy.com/v2/ZMkIiKtNvgY03UtWOjho0oqkQrNt_pyc";
|
|
private const string RPC_ETHEREUM = "https://mainnet.infura.io/v3/58f44d906ab345beadd03dd2b76348af";
|
|
private const string RPC_ETHEREUM_GOERLI = "https://eth-goerli.g.alchemy.com/v2/xbc-eM-vxBmM9Uf1-RjjGjLp8Ng-FIc6";
|
|
|
|
public static Chain GetChain(string chainName)
|
|
{
|
|
if (string.IsNullOrEmpty(chainName))
|
|
throw new Exception("Chain name is null or empty");
|
|
|
|
return GetChains().FirstOrDefault(c => c.Name == chainName);
|
|
}
|
|
|
|
public static List<Chain> GetChains()
|
|
{
|
|
var chains = new List<Chain>()
|
|
{
|
|
GetArbitrum(),
|
|
GetEthereum(),
|
|
//GetArbitrumGoerli(),
|
|
//GetGoerli()
|
|
};
|
|
|
|
return chains;
|
|
}
|
|
|
|
public static Chain GetArbitrum()
|
|
{
|
|
return new Chain()
|
|
{
|
|
Name = Constants.Chains.Arbitrum,
|
|
RpcUrl = RPC_ARBITRUM,
|
|
ChainId = 42161
|
|
};
|
|
}
|
|
|
|
public static Chain GetEthereum()
|
|
{
|
|
return new Chain()
|
|
{
|
|
Name = Constants.Chains.Ethereum,
|
|
RpcUrl = RPC_ETHEREUM,
|
|
ChainId = 1
|
|
};
|
|
}
|
|
|
|
public static Chain GetArbitrumGoerli()
|
|
{
|
|
return new Chain()
|
|
{
|
|
Name = Constants.Chains.ArbitrumGoerli,
|
|
RpcUrl = RPC_ARBITRUM_GOERLI
|
|
};
|
|
}
|
|
|
|
public static Chain GetGoerli()
|
|
{
|
|
return new Chain()
|
|
{
|
|
Name = Constants.Chains.Goerli,
|
|
RpcUrl = RPC_ETHEREUM_GOERLI
|
|
};
|
|
}
|
|
} |