private bool CheckTokenWasReceived(List <Transaction> transactions, UserWatchlist watchListLine) { return(transactions?.Any(t => { var receiver = InputDecoder.GetTokenCountAndAddressFromInput(t.Input).To; if (receiver.Equals(watchListLine.Address, StringComparison.CurrentCultureIgnoreCase)) { return true; } return false; }) ?? false); }
private bool CheckNumberOfContractTokenWasSent(List <Transaction> transactions, UserWatchlist watchListLine) { return(transactions?.Any(t => { if (t.To != null && t.To.Equals(watchListLine.Address, StringComparison.CurrentCultureIgnoreCase)) { var value = (double)Web3.Convert.FromWei(InputDecoder.GetTokenCountAndAddressFromInput(t.Input).Value, watchListLine.TokenDecimalPlaces); if (value == watchListLine.NotificationOptions.NumberOfContractTokenWasSent) { return true; } } return false; }) ?? false); }
private bool CheckNumberTokenWasReceived(List <Transaction> transactions, UserWatchlist watchListLine) { return(transactions?.Any(t => { var receiver = InputDecoder.GetTokenCountAndAddressFromInput(t.Input); var value = (double)Web3.Convert.FromWei(receiver.Value, watchListLine.NotificationOptions.TokenReceivedDecimalPlaces); if (receiver.To != null && receiver.To.Equals(watchListLine.Address, StringComparison.CurrentCultureIgnoreCase) && value == watchListLine.NotificationOptions.NumberOfTokenOrEtherWasReceived) { return true; } return false; }) ?? false); }
private bool CheckNumberOfTokenWasSent(List <Transaction> transactions, UserWatchlist watchListLine) { return(transactions?.Any(t => { if ((t.To?.Equals(watchListLine.NotificationOptions.TokenOrEtherSentName, StringComparison.CurrentCultureIgnoreCase) ?? false) && (t.From?.Equals(watchListLine.Address, StringComparison.CurrentCultureIgnoreCase) ?? false)) { var value = (double)Web3.Convert.FromWei(InputDecoder.GetTokenCountAndAddressFromInput(t.Input).Value, watchListLine.NotificationOptions.TokenSentDecimalPlaces); if (value >= watchListLine.NotificationOptions.NumberOfTokenOrEtherThatWasSentFrom && value <= watchListLine.NotificationOptions.NumberOfTokenOrEtherThatWasSentTo) { return true; } } return false; }) ?? false); }