using DiscordRewards; using GethPlugin; namespace TestNetRewarder { public class RequestBuilder : IRewardGiver { private readonly Dictionary> rewards = new Dictionary>(); public void Give(RewardConfig reward, EthAddress receiver) { if (rewards.ContainsKey(reward.RoleId)) { rewards[reward.RoleId].Add(receiver); } else { rewards.Add(reward.RoleId, new List { receiver }); } } public GiveRewardsCommand Build(MarketAverage[] marketAverages, string[] lines) { var result = new GiveRewardsCommand { Rewards = rewards.Select(p => new RewardUsersCommand { RewardId = p.Key, UserAddresses = p.Value.Select(v => v.Address).ToArray() }).ToArray(), Averages = marketAverages, EventsOverview = lines }; rewards.Clear(); return result; } } }