public Task <decimal> UpdateBlockRewardBalancesAsync(IDbConnection con, IDbTransaction tx, Block block, PoolConfig pool) { if (block.Reward == 0) { return(Task.FromResult(0m)); } var blockRewardRemaining = block.Reward; // Distribute funds to configured reward recipients foreach (var recipient in poolConfig.RewardRecipients.Where(x => !x.Percentage.Equals(0))) { var amount = block.Reward * (recipient.Percentage / 100.0m); var address = recipient.Address; blockRewardRemaining -= amount; // skip transfers from pool wallet to pool wallet if (address != poolConfig.Address) { logger.Info(() => $"Adding {FormatAmount(amount)} to balance of {address}"); balanceRepo.AddAmount(con, tx, poolConfig.Id, poolConfig.Coin.Type, address, amount, $"Reward for block {block.BlockHeight}"); } } // Deduct static reserve for tx fees blockRewardRemaining -= EthereumConstants.StaticTransactionFeeReserve; //EVR return(Task.FromResult(blockRewardRemaining)); }
public Task CalculateBlockEffortAsync(Block block, double accumulatedBlockShareDiff) { block.Effort = accumulatedBlockShareDiff / block.NetworkDifficulty; return(Task.FromResult(true)); }