/// <param name="altCoinKeyNumber">https://github.com/satoshilabs/slips/blob/master/slip-0044.md</param> public BitcoinForkProvider( string thisCoinSymbol, int altCoinKeyNumber, Network network, ILogger logger, WalletOperationService walletOperationService, EventHistoryService eventHistoryService, RandomEntropyService randomEntropyService, VersionControl versionControl, IConfiguration configuration) : base( thisCoinSymbol, logger, walletOperationService, eventHistoryService, randomEntropyService, versionControl, configuration) { _walletOperationService = walletOperationService; AltCoinKeyNumber = altCoinKeyNumber; net = network; _withdrawalFee = decimal.Parse( configuration[$"{thisCoinSymbol}:WithdrawalFee"] ?? throw new ArgumentException($"{thisCoinSymbol}:WithdrawalFee")); ProviderLookup[ThisCoinSymbol] = this; }
public EthereumTokenProvider( string thisCoinSymbol, string contractAddress, int decimalPlaces, ILogger logger, WalletOperationService walletOperationService, EventHistoryService eventHistoryService, RandomEntropyService randomEntropyService, VersionControl versionControl, IConfiguration configuration) : base( thisCoinSymbol, logger, walletOperationService, eventHistoryService, randomEntropyService, versionControl, configuration) { _contractAddress = contractAddress; _decimalPlaces = decimalPlaces; _walletOperationService = walletOperationService; _eventHistoryService = eventHistoryService; Web3Url = configuration["ETH:Web3Url"] ?? throw new ArgumentException("ETH:Web3Url"); _web3 = new Web3(Web3Url); _withdrawalGasPriceGwei = decimal.Parse( configuration["ETH:WithdrawalGasPriceGwei"] ?? throw new ArgumentException("ETH:WithdrawalGasPriceGwei")); }
public LitecoinProvider( ILogger <LitecoinProvider> logger, WalletOperationService walletOperationService, EventHistoryService eventHistoryService, RandomEntropyService randomEntropyService, VersionControl versionControl, IConfiguration configuration) : base( LTC, 2, NBitcoin.Altcoins.Litecoin.Instance.Testnet, logger, walletOperationService, eventHistoryService, randomEntropyService, versionControl, configuration) { //node = Node.Connect(net); //node.VersionHandshake(); //var chain = node.GetChain(); // TODO: process new blocks since last checkpoint - the Node.Connect doesn't work as it should, use local if (GetType() == typeof(EthereumProvider)) { // Do not implicitly call in (mocked) subclasses ProviderLookup[ThisCoinSymbol] = this; } }
public EthereumProvider( ILogger<EthereumProvider> logger, WalletOperationService walletOperationService, EventHistoryService eventHistoryService, RandomEntropyService randomEntropyService, VersionControl versionControl, IConfiguration configuration ) : base( ETH, logger, walletOperationService, eventHistoryService, randomEntropyService, versionControl, configuration) { _walletOperationService = walletOperationService; _eventHistoryService = eventHistoryService; _versionControl = versionControl; Web3Url = configuration["ETH:Web3Url"] ?? throw new ArgumentException("ETH:Web3Url"); _web3 = new Web3(Web3Url); _withdrawalGasPriceGwei = decimal.Parse( configuration["ETH:WithdrawalGasPriceGwei"] ?? throw new ArgumentException("ETH:WithdrawalGasPriceGwei")); if (GetType() == typeof(EthereumProvider)) { // Do not implicitly call in (mocked) subclasses ProviderLookup[ThisCoinSymbol] = this; } }
public TradeEventProcessor( TradingOrderService tradingOrderService, EventHistoryService eventHistoryService, UserService userService, ILogger <TradeEventProcessor> logger) { _tradingOrderService = tradingOrderService; _eventHistoryService = eventHistoryService; _userService = userService; _logger = logger; }
public WalletEventListener( EventHistoryService eventHistoryService, WalletOperationService walletOperationService, VersionControl versionControl, ILogger <WalletEventListener> logger) { _eventHistoryService = eventHistoryService; _walletOperationService = walletOperationService; _versionControl = versionControl; _logger = logger; }
public ProcessorFactory( VersionControl versionControl, EventHistoryService eventHistoryService, WalletOperationService walletOperationService, ILogger <WalletCommandProcessor> processorLogger) { _processorLogger = processorLogger; VersionControl = versionControl; EventHistoryService = eventHistoryService; WalletOperationService = walletOperationService; }
/// <summary> /// Created via ProcessorFactory. /// </summary> public WalletCommandProcessor( VersionControl versionControl, EventHistoryService eventHistoryService, WalletOperationService walletOperationService, ILogger logger) { _logger = logger; VersionControl = versionControl; EventHistoryService = eventHistoryService; WalletOperationService = walletOperationService; }
public MockedEthereumProvider( ILogger <MockedEthereumProvider> logger, WalletOperationService walletOperationService, EventHistoryService eventHistoryService, RandomEntropyService randomEntropyService, VersionControl versionControl, IConfiguration configuration) : base(logger, walletOperationService, eventHistoryService, randomEntropyService, versionControl, configuration) { ProviderLookup[ThisCoinSymbol] = this; }
/// <summary> /// </summary> public TradingOrderService( TradingRepository tradingRepository, EventHistoryService eventHistoryService, ILogger <TradingOrderService> logger) { _eventHistoryService = eventHistoryService; _logger = logger; OrderBook = tradingRepository.OrderBook(); HiddenOrders = tradingRepository.HiddenOrders(); OrderHistory = tradingRepository.OrderHistory(); TransactionHistory = tradingRepository.TransactionHistory(); }
public ProcessorFactory( VersionControl versionControl, TradingOrderService tradingOrderService, UserService userService, EventHistoryService eventHistoryService, ILogger<TradeCommandProcessor> tradeOrderPersistenceProcessorLogger) { _tradeOrderPersistenceProcessorLogger = tradeOrderPersistenceProcessorLogger; VersionControl = versionControl; TradingOrderService = tradingOrderService; UserService = userService; EventHistoryService = eventHistoryService; }
/// <summary> /// Created via ProcessorFactory. /// </summary> public TradeCommandProcessor( VersionControl versionControl, TradingOrderService tradingOrderService, UserService userService, EventHistoryService eventHistoryService, ILogger <TradeCommandProcessor> logger) { _logger = logger; VersionControl = versionControl; TradingOrderService = tradingOrderService; UserService = userService; EventHistoryService = eventHistoryService; }
public DatabaseGenerator( VersionControl versionControl, EventHistoryService eventHistoryService, TradingRepository tradingRepository, AccountRepository accountRepository, TradeEventProcessor tradeEventProcessor, ILogger <DatabaseGenerator> logger) { _versionControl = versionControl; _eventHistoryService = eventHistoryService; _tradingRepository = tradingRepository; _accountRepository = accountRepository; _tradeEventProcessor = tradeEventProcessor; _logger = logger; }
public JsonResult Inactivate(int id) { using (var service = new EventService()) { //get the event var even = service.Get(id); //create the history entry using (var historyService = new EventHistoryService()) { EventHistory history = new EventHistory(even, EventStatus.InActive, DateTime.Now); historyService.Create(history); } //update status and database even.Status = EventStatus.InActive; service.Update(even); } return(Json(true)); }
protected SimpleProvider( string thisCoinSymbol, ILogger logger, WalletOperationService walletOperationService, EventHistoryService eventHistoryService, RandomEntropyService randomEntropyService, VersionControl versionControl, IConfiguration configuration ) : base(logger) { ThisCoinSymbol = thisCoinSymbol ?? throw new ArgumentNullException(nameof(thisCoinSymbol)); _walletOperationService = walletOperationService ?? throw new ArgumentNullException(nameof(walletOperationService)); _eventHistoryService = eventHistoryService ?? throw new ArgumentNullException(nameof(eventHistoryService)); _randomEntropyService = randomEntropyService ?? throw new ArgumentNullException(nameof(randomEntropyService)); _versionControl = versionControl ?? throw new ArgumentNullException(nameof(versionControl)); }
public static void Test() { try { using (var init = new EventHistoryService()) { Console.WriteLine("Generating Events..."); EventStatus status = EventStatus.Sent; var events = init.GetWhere(EventHistoryService.StatusCol == status); Console.WriteLine("Events grabbed successfully.\nAll tests successful...\n"); foreach (EventHistory e in events) { Console.WriteLine(e.ToString()); } } } catch (Exception ex) { Console.WriteLine(ex); Console.ReadKey(); } }
public XchangeCryptTokenProvider( ILogger <XchangeCryptTokenProvider> logger, WalletOperationService walletOperationService, EventHistoryService eventHistoryService, RandomEntropyService randomEntropyService, VersionControl versionControl, IConfiguration configuration) : base( "XCT", "0x59efc1a03a94b48cc2412065560909481c94b053", 18, logger, walletOperationService, eventHistoryService, randomEntropyService, versionControl, configuration) { if (GetType() == typeof(XchangeCryptTokenProvider)) { // Do not implicitly call in (mocked) subclasses ProviderLookup[ThisCoinSymbol] = this; } }
//private Node node; public BitcoinProvider( ILogger <BitcoinProvider> logger, WalletOperationService walletOperationService, EventHistoryService eventHistoryService, RandomEntropyService randomEntropyService, VersionControl versionControl, IConfiguration configuration) : base( BTC, 0, Network.TestNet, logger, walletOperationService, eventHistoryService, randomEntropyService, versionControl, configuration) { if (GetType() == typeof(BitcoinProvider)) { // Do not implicitly call in (mocked) subclasses ProviderLookup[ThisCoinSymbol] = this; } }
public static void Test() { try { Console.WriteLine("Connecting to database..."); using (var init = new InitDatabaseService()) { Console.WriteLine("Connection successful.\nResetting the database..."); init.Reset(); Console.WriteLine("Reset successful.\nLoading data..."); //create dummy pharmacy Pharmacy pharm = new Pharmacy(1, "CSV Pharmacy", "19187661052", "1400 chrissartin street"); using (var service = new PharmacyService()) { service.Create(pharm); } //create dummy patient Patient patient = new Patient(1, "Chris", "Sartin", new DateTime(2000, DateTime.Today.Month, DateTime.Today.Day), "77777", "19183994836", "*****@*****.**", pharm); Patient patient1 = new Patient(2, "Matthew", "Miller", new DateTime(2000, DateTime.Today.Month, DateTime.Today.Day), "8675309", "19187661052", "*****@*****.**", pharm); using (var service = new PatientService()) { service.Create(patient); service.Create(patient1); } //create dummy drug Drug drug = new Drug(1, "Taco Medication"); using (var service = new DrugService()) { service.Create(drug); } //create dummy prescription Prescription prescription = new Prescription(1, patient, drug, 7, 7); Prescription prescription1 = new Prescription(2, patient1, drug, 6, 6); using (var service = new PrescriptionService()) { service.Create(prescription); service.Create(prescription1); } EventRefill RefillEvent; //create dummy event using (var service = new EventService()) { //create dummy eventRefill Event Event = new Event(patient, "this is a message", EventStatus.ToSend, EventType.REFILL); Event Event1 = new Event(patient, "refill test event", EventStatus.Sent, EventType.REFILL); Event Event2 = new Event(patient1, "this is a test", EventStatus.Fill, EventType.REFILL); RefillEvent = new EventRefill(prescription, Event); EventRefill RefillEvent1 = new EventRefill(prescription1, Event1); EventRefill RefillEvent2 = new EventRefill(prescription1, Event2); using (var service2 = new EventRefillService()) { service.Create(Event); service2.Create(RefillEvent); service.Create(Event1); service2.Create(RefillEvent1); service.Create(Event2); service2.Create(RefillEvent2); } //create dummy birthdayevent Event BirthdayEvent = new Event(patient, "this is a message", EventStatus.ToSend, EventType.BIRTHDAY); service.Create(BirthdayEvent); //create dummy recallevent Event = new Event(patient, "this is a message", EventStatus.ToSend, EventType.REFILL); EventRecall RecallEvent = new EventRecall(Event); using (var service2 = new EventRecallService()) { service.Create(Event); service2.Create(RecallEvent); } //create dummy eventhistory EventHistory history = new EventHistory(Event, EventStatus.InActive, new DateTime(2000, 7, 14)); using (var service2 = new EventHistoryService()) { service2.Create(history); } } //create dummy pharmacist in the pharmacy Pharmacist pharmacist = new Pharmacist("James", "Taco", "*****@*****.**", "18884443333", new byte[] { 0 }, new byte[] { 0 }); Pharmacist pharmacist1 = new Pharmacist("Matthew", "Miller", "*****@*****.**", "19187661052", new byte[] { 0 }, new byte[] { 0 }); Pharmacist pharmacist2 = new Pharmacist("Luke", "Thorne", "*****@*****.**", "14056932048", new byte[] { 0 }, new byte[] { 0 }); Pharmacist pharmacist3 = new Pharmacist("Emily", "Pielemeier", "*****@*****.**", "13177536066", new byte[] { 0 }, new byte[] { 0 }); Pharmacist pharmacist4 = new Pharmacist("Tom", "Hartnett", "*****@*****.**", "14696671743", new byte[] { 0 }, new byte[] { 0 }); using (var service = new PharmacistService()) { service.Create(pharmacist); service.Create(pharmacist1); service.Create(pharmacist2); service.Create(pharmacist3); service.Create(pharmacist4); } //create dummy fillhistory FillHistory fill = new FillHistory(RefillEvent, pharmacist, new DateTime(2000, 7, 14)); using (var service = new FillHistoryService()) { service.Create(fill); } //create dummy sysadmins (us) SystemAdmin admin = new SystemAdmin("testing", "the stuff", "*****@*****.**", "19184661052", new byte[] { 0 }, new byte[] { 0 }); SystemAdmin admin1 = new SystemAdmin("Tom", "Hartnett", "*****@*****.**", "14696671743", new byte[] { 0 }, new byte[] { 0 }); SystemAdmin admin2 = new SystemAdmin("Luke", "Thorne", "*****@*****.**", "14056932048", new byte[] { 0 }, new byte[] { 0 }); SystemAdmin admin3 = new SystemAdmin("Jon", "Hartnett", "*****@*****.**", "14696671064", new byte[] { 0 }, new byte[] { 0 }); SystemAdmin admin4 = new SystemAdmin("Emily", "Pielemeier", "*****@*****.**", "13177536066", new byte[] { 0 }, new byte[] { 0 }); using (var service = new SystemAdminService()) { service.Create(admin); service.Create(admin1); service.Create(admin2); service.Create(admin3); service.Create(admin4); } //create dummy job Job job = new Job(pharm, pharmacist, true, false); using (var service = new JobService()) { service.Create(job); Job j1 = new Job(pharm, pharmacist1, true, true); service.Create(j1); Job j2 = new Job(pharm, pharmacist2, true, true); service.Create(j2); Job j3 = new Job(pharm, pharmacist3, true, true); service.Create(j3); Job j4 = new Job(pharm, pharmacist4, true, true); service.Create(j4); } init.LoadFromFile(@"..\..\App_Data\Scrubbed_Data.xlsx - Sheet1.csv", pharm); Console.WriteLine("Loading data successful.\nAll tests successful..."); } } catch (Exception ex) { Console.WriteLine(ex); Console.ReadKey(); } }