protected void OnEditHistCommand(string file) { try { if (file.Equals("history")) { file = _cli.Settings.App.History; } if (file.Equals("config")) { file = _cli.Settings.App.Config; if (string.IsNullOrEmpty(file)) { Console.WriteLine("Enter path to config file:"); file = Console.ReadLine(); } } String editor = Environment.GetEnvironmentVariable("EDITOR"); var exec = SpookUtils.LocateExec(editor); Console.WriteLine("Editor: " + exec); using (System.Diagnostics.Process pProcess = new System.Diagnostics.Process()) { pProcess.StartInfo.FileName = exec; pProcess.StartInfo.Arguments = file; //argument pProcess.StartInfo.UseShellExecute = true; pProcess.StartInfo.RedirectStandardOutput = false; pProcess.Start(); pProcess.WaitForExit(); } } catch (Exception e) { Console.WriteLine(e); } }
protected override Phantasma.Numerics.BigInteger PullFee(Timestamp time, string platform) { platform = platform.ToLower(); CachedFee fee; string logMessage = ""; switch (platform) { case NeoWallet.NeoPlatform: return(Phantasma.Numerics.UnitConversion.ToBigInteger(0.1m, DomainSettings.FiatTokenDecimals)); case EthereumWallet.EthereumPlatform: if (_feeCache.TryGetValue(platform, out fee)) { if ((Timestamp.Now - fee.Time) < 60) { logMessage = $@"PullFee({platform}): Cached fee pulled: {fee.Value}, GAS limit: {_cli.Settings.Oracle.EthGasLimit}, calculated fee: {fee.Value * _cli.Settings.Oracle.EthGasLimit}"; logger.Debug(logMessage); return(fee.Value * _cli.Settings.Oracle.EthGasLimit); } } var newFee = SpookUtils.GetNormalizedFee(_cli.Settings.Oracle.EthFeeURLs.ToArray()); fee = new CachedFee(Timestamp.Now, UnitConversion.ToBigInteger(newFee, 9)); // 9 for GWEI _feeCache[platform] = fee; var logMessage2 = $@"PullFee({platform}): New fee pulled: {fee.Value}, GAS limit: {_cli.Settings.Oracle.EthGasLimit}, calculated fee: {fee.Value * _cli.Settings.Oracle.EthGasLimit}"; logger.Debug(logMessage2); return(fee.Value * _cli.Settings.Oracle.EthGasLimit); case BSCWallet.BSCPlatform: //CachedFee fee; if (_feeCache.TryGetValue(platform, out fee)) { if ((Timestamp.Now - fee.Time) < 60) { logMessage = $@"PullFee({platform}): Cached fee pulled: {fee.Value}, GAS limit: {_cli.Settings.Oracle.EthGasLimit}, calculated fee: {fee.Value * _cli.Settings.Oracle.EthGasLimit}"; logger.Debug(logMessage); return(fee.Value * _cli.Settings.Oracle.EthGasLimit); } } var newBSCFee = SpookUtils.GetNormalizedFee(_cli.Settings.Oracle.BscFeeURLs.ToArray()); fee = new CachedFee(Timestamp.Now, UnitConversion.ToBigInteger(newBSCFee, 9)); // 9 for GWEI _feeCache[platform] = fee; logMessage = $@"PullFee({platform}): New fee pulled: {fee.Value}, GAS limit: {_cli.Settings.Oracle.EthGasLimit}, calculated fee: {fee.Value * _cli.Settings.Oracle.EthGasLimit}"; logger.Debug(logMessage); return(fee.Value * _cli.Settings.Oracle.EthGasLimit); default: throw new OracleException($"Support for {platform} fee not implemented in this node"); } }