コード例 #1
0
        public CollateralFederationMember CollateralAddressOwner(VotingManager votingManager, VoteKey voteKey, string address)
        {
            CollateralFederationMember member = (this.federationMembers.Cast <CollateralFederationMember>().FirstOrDefault(x => x.CollateralMainchainAddress == address));

            if (member != null)
            {
                return(member);
            }

            List <Poll> approvedPolls = votingManager.GetApprovedPolls();

            member = approvedPolls
                     .Where(x => !x.IsExecuted && x.VotingData.Key == voteKey)
                     .Select(x => this.GetMember(x.VotingData))
                     .FirstOrDefault(x => x.CollateralMainchainAddress == address);

            if (member != null)
            {
                return(member);
            }

            List <Poll> pendingPolls = votingManager.GetPendingPolls();

            member = pendingPolls
                     .Where(x => x.VotingData.Key == voteKey)
                     .Select(x => this.GetMember(x.VotingData))
                     .FirstOrDefault(x => x.CollateralMainchainAddress == address);

            if (member != null)
            {
                return(member);
            }

            List <VotingData> scheduledVotes = votingManager.GetScheduledVotes();

            member = scheduledVotes
                     .Where(x => x.Key == voteKey)
                     .Select(x => this.GetMember(x))
                     .FirstOrDefault(x => x.CollateralMainchainAddress == address);

            return(member);
        }