private async Task <string> MakeItRain(long balance) { const long fee = 10; var walletCount = _wallets.Count; if (walletCount == 0) { return(string.Empty); } var availableBalance = balance - fee; var amountPerWallet = availableBalance / walletCount; var actualFee = balance - (amountPerWallet * walletCount); foreach (var walletPair in _wallets) { try { var user = walletPair.Key; _logger.LogInformation($"Notify {user}"); await user.SendMessageAsync($"The rain fell on you little turtle! {amountPerWallet / 100.0M} TRTL is on its way to your wallet!"); } catch (Exception e) { _logger.LogWarning(e, "Exception while notifying user"); } } return(await _walletService.SendToMany(amountPerWallet, actualFee, _wallets.Values)); }
private async Task <string> MakeItRain(long balance) { const long fee = 10; int walletCount = _wallets.Count; if (walletCount == 0) { return(string.Empty); } long availableBalance = balance - fee; long amountPerWallet = availableBalance / walletCount; long actualFee = balance - (amountPerWallet * walletCount); return(await _walletService.SendToMany(amountPerWallet, actualFee, _wallets.Values)); }
private async Task <string> MakeItRain(long balance) { const long fee = 10; int walletCount = _wallets.Count; if (walletCount == 0) { return(string.Empty); } long availableBalance = balance - fee; long amountPerWallet = availableBalance / walletCount; long actualFee = balance - (amountPerWallet * walletCount); foreach (var walletPair in _wallets) { var user = walletPair.Key; await user.SendMessageAsync($"The rain fell on you little turtle! {amountPerWallet / 100.0M} TRTL is on it's way to your wallet!"); } return(await _walletService.SendToMany(amountPerWallet, actualFee, _wallets.Values)); }