{"author":"Digix Holdings","title":"Contract to claim voting results","fileName":"/contracts/interactive/DaoVotingClaims.sol","name":"DaoVotingClaims","abi":[{"constant":true,"inputs":[],"name":"resolver","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentQuarterIndex","outputs":[{"name":"_quarterIndex","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_configKey","type":"bytes32"}],"name":"getAddressConfig","outputs":[{"name":"_configValue","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"key","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposalId","type":"bytes32"},{"name":"_index","type":"uint256"},{"name":"_operations","type":"uint256"}],"name":"claimProposalVotingResult","outputs":[{"name":"_passed","type":"bool"},{"name":"_done","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_key","type":"bytes32"}],"name":"get_contract","outputs":[{"name":"_contract","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"claimOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"currentTimeInQuarter","outputs":[{"name":"_currentT","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isMainPhase","outputs":[{"name":"_isMainPhase","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isLockingPhase","outputs":[{"name":"_isLockingPhase","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_proposalId","type":"bytes32"},{"name":"_operations","type":"uint256"}],"name":"claimDraftVotingResult","outputs":[{"name":"_passed","type":"bool"},{"name":"_done","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_user","type":"address"}],"name":"isParticipant","outputs":[{"name":"_is","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_configKey","type":"bytes32"}],"name":"getBytesConfig","outputs":[{"name":"_configValue","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_configKey","type":"bytes32"}],"name":"getUintConfig","outputs":[{"name":"_configValue","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_proposalId","type":"bytes32"}],"name":"getInterResultKeyForBonusCalculation","outputs":[{"name":"_key","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isDaoNotReplaced","outputs":[{"name":"_isNotReplaced","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_ADDRESS","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_proposalId","type":"bytes32"}],"name":"isProposalPaused","outputs":[{"name":"_isPausedOrStopped","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_user","type":"address"}],"name":"isModerator","outputs":[{"name":"_is","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_resolver","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}],"bin":false,"opcodes":false,"source":"pragma solidity ^0.4.24;\n\nimport \"openzeppelin-solidity/contracts/ownership/Claimable.sol\";\nimport \"../common/DaoCommon.sol\";\nimport \"../service/DaoCalculatorService.sol\";\nimport \"./DaoFundingManager.sol\";\nimport \"./DaoRewardsManager.sol\";\nimport \"../lib/DaoIntermediateStructs.sol\";\nimport \"../lib/DaoStructs.sol\";\n\n\n/**\n@title Contract to claim voting results\n@author Digix Holdings\n*/\ncontract DaoVotingClaims is DaoCommon, Claimable {\n    using DaoIntermediateStructs for DaoIntermediateStructs.VotingCount;\n    using DaoIntermediateStructs for DaoIntermediateStructs.Users;\n    using DaoStructs for DaoStructs.IntermediateResults;\n\n    function daoCalculatorService()\n        internal\n        constant\n        returns (DaoCalculatorService _contract)\n    {\n        _contract = DaoCalculatorService(get_contract(CONTRACT_SERVICE_DAO_CALCULATOR));\n    }\n\n    function daoFundingManager()\n        internal\n        constant\n        returns (DaoFundingManager _contract)\n    {\n        _contract = DaoFundingManager(get_contract(CONTRACT_DAO_FUNDING_MANAGER));\n    }\n\n    function daoRewardsManager()\n        internal\n        constant\n        returns (DaoRewardsManager _contract)\n    {\n        _contract = DaoRewardsManager(get_contract(CONTRACT_DAO_REWARDS_MANAGER));\n    }\n\n    constructor(address _resolver) public {\n        require(init(CONTRACT_DAO_VOTING_CLAIMS, _resolver));\n    }\n\n\n    /**\n    @notice Function to claim the draft voting result (can only be called by the proposal proposer)\n    @dev The founder/or anyone is supposed to call this function after the claiming deadline has passed, to clean it up and close this proposal.\n         If this voting fails, the collateral will be refunded\n    @param _proposalId ID of the proposal\n    @param _operations Number of operations to do in this call\n    @return {\n      \"_passed\": \"Boolean, true if the draft voting has passed, false if the claiming deadline has passed or the voting has failed\",\n      \"_done\": \"Boolean, true if the calculation has finished\"\n    }\n    */\n    function claimDraftVotingResult(\n        bytes32 _proposalId,\n        uint256 _operations\n    )\n        public\n        ifDraftNotClaimed(_proposalId)\n        ifAfterDraftVotingPhase(_proposalId)\n        returns (bool _passed, bool _done)\n    {\n        // if after the claiming deadline, or the limit for non-digix proposals is reached, its auto failed\n        if (now > daoStorage().readProposalDraftVotingTime(_proposalId)\n                    .add(getUintConfig(CONFIG_DRAFT_VOTING_PHASE))\n                    .add(getUintConfig(CONFIG_VOTE_CLAIMING_DEADLINE))\n            || !isNonDigixProposalsWithinLimit(_proposalId))\n        {\n            daoStorage().setProposalDraftPass(_proposalId, false);\n            daoStorage().setDraftVotingClaim(_proposalId, true);\n            processCollateralRefund(_proposalId);\n            return (false, true);\n        }\n        require(isFromProposer(_proposalId));\n        senderCanDoProposerOperations();\n\n        // get the previously stored intermediary state\n        DaoStructs.IntermediateResults memory _currentResults;\n        (\n            _currentResults.countedUntil,\n            _currentResults.currentForCount,\n            _currentResults.currentAgainstCount,\n        ) = intermediateResultsStorage().getIntermediateResults(_proposalId);\n\n        // get the moderators to calculate in this transaction, based on intermediate state\n        address[] memory _moderators;\n        if (_currentResults.countedUntil == EMPTY_ADDRESS) {\n            _moderators = daoListingService().listModerators(\n                _operations,\n                true\n            );\n        } else {\n            _moderators = daoListingService().listModeratorsFrom(\n               _currentResults.countedUntil,\n               _operations,\n               true\n           );\n        }\n\n        // count the votes for this batch of moderators\n        DaoIntermediateStructs.VotingCount memory _voteCount;\n        (_voteCount.forCount, _voteCount.againstCount) = daoStorage().readDraftVotingCount(_proposalId, _moderators);\n\n        _currentResults.countedUntil = _moderators[_moderators.length-1];\n        _currentResults.currentForCount = _currentResults.currentForCount.add(_voteCount.forCount);\n        _currentResults.currentAgainstCount = _currentResults.currentAgainstCount.add(_voteCount.againstCount);\n\n        if (_moderators[_moderators.length-1] == daoStakeStorage().readLastModerator()) {\n            // this is the last iteration\n            _passed = processDraftVotingClaim(_proposalId, _currentResults);\n            _done = true;\n\n            // reset intermediate result for the proposal.\n            intermediateResultsStorage().resetIntermediateResults(_proposalId);\n        } else {\n            // update intermediate results\n            intermediateResultsStorage().setIntermediateResults(\n                _proposalId,\n                _currentResults.countedUntil,\n                _currentResults.currentForCount,\n                _currentResults.currentAgainstCount,\n                0\n            );\n        }\n    }\n\n\n    function processDraftVotingClaim(bytes32 _proposalId, DaoStructs.IntermediateResults _currentResults)\n        internal\n        returns (bool _passed)\n    {\n        if (\n            (_currentResults.currentForCount.add(_currentResults.currentAgainstCount) > daoCalculatorService().minimumDraftQuorum(_proposalId)) &&\n            (daoCalculatorService().draftQuotaPass(_currentResults.currentForCount, _currentResults.currentAgainstCount))\n        ) {\n            daoStorage().setProposalDraftPass(_proposalId, true);\n\n            // set startTime of first voting round\n            // and the start of first milestone.\n            uint256 _idealStartTime = daoStorage().readProposalDraftVotingTime(_proposalId).add(getUintConfig(CONFIG_DRAFT_VOTING_PHASE));\n            daoStorage().setProposalVotingTime(\n                _proposalId,\n                0,\n                getTimelineForNextVote(0, _idealStartTime)\n            );\n            _passed = true;\n        } else {\n            daoStorage().setProposalDraftPass(_proposalId, false);\n            processCollateralRefund(_proposalId);\n        }\n\n        daoStorage().setDraftVotingClaim(_proposalId, true);\n    }\n\n    /// NOTE: Voting round i-th is before milestone index i-th\n\n\n    /**\n    @notice Function to claim the  voting round results\n    @dev This function has two major steps:\n         - Counting the votes\n            + There is no need for this step if there are some conditions that makes the proposal auto failed\n            + The number of operations needed for this step is the number of participants in the quarter\n         - Calculating the bonus for the voters in the preceding round\n            + We can skip this step if this is the Voting round 0 (there is no preceding voting round to calculate bonus)\n            + The number of operations needed for this step is the number of participants who voted \"correctly\" in the preceding voting round\n         Step 1 will have to finish first before step 2. The proposer is supposed to call this function repeatedly,\n         until _done is true\n\n         If the voting round fails, the collateral will be returned back to the proposer\n    @param _proposalId ID of the proposal\n    @param _index Index of the  voting round\n    @param _operations Number of operations to do in this call\n    @return {\n      \"_passed\": \"Boolean, true if the  voting round passed, false if failed\"\n    }\n    */\n    function claimProposalVotingResult(bytes32 _proposalId, uint256 _index, uint256 _operations)\n        public\n        ifNotClaimed(_proposalId, _index)\n        ifAfterProposalRevealPhase(_proposalId, _index)\n        returns (bool _passed, bool _done)\n    {\n        require(isMainPhase());\n\n        // STEP 1\n        // If the claiming deadline is over, the proposal is auto failed, and anyone can call this function\n        // Here, _done is refering to whether STEP 1 is done\n        _done = true;\n        _passed = false; // redundant, put here just to emphasize that its false\n        // In other words, we only need to do Step 1 if its before the deadline\n        if (now < startOfMilestone(_proposalId, _index)\n                    .add(getUintConfig(CONFIG_VOTE_CLAIMING_DEADLINE)))\n        {\n            (_operations, _passed, _done) = countProposalVote(_proposalId, _index, _operations);\n            // from here on, _operations is the number of operations left, after Step 1 is done\n            if (!_done) return (_passed, false); // haven't done Step 1 yet, return. The value of _passed here is irrelevant\n        }\n\n        // STEP 2\n        // from this point onwards, _done refers to step 2\n        _done = false;\n\n\n        //TODO: until here\n        if (_index > 0) { // We only need to do bonus calculation if its a interim voting round\n            _done = calculateVoterBonus(_proposalId, _index, _operations, _passed);\n            if (!_done) return (_passed, false); // Step 2 is not done yet, return\n        } else {\n            // its the first voting round, we return the collateral if it fails, locks if it passes\n\n            _passed = _passed && isNonDigixProposalsWithinLimit(_proposalId); // can only pass if its within the non-digix proposal limit\n            if (_passed) {\n                daoStorage().setProposalCollateralStatus(\n                    _proposalId,\n                    COLLATERAL_STATUS_LOCKED\n                );\n\n            } else {\n                processCollateralRefund(_proposalId);\n            }\n        }\n\n        if (_passed) {\n            processSuccessfulVotingClaim(_proposalId, _index);\n        }\n        daoStorage().setVotingClaim(_proposalId, _index, true);\n        daoStorage().setProposalPass(_proposalId, _index, _passed);\n        _done = true;\n    }\n\n\n    // do the necessary steps after a successful voting round.\n    function processSuccessfulVotingClaim(bytes32 _proposalId, uint256 _index)\n        internal\n    {\n        // clear the intermediate results for the proposal, so that next voting rounds can reuse the same key <proposal_id> for the intermediate results\n        intermediateResultsStorage().resetIntermediateResults(_proposalId);\n\n        // if this was the final voting round, unlock their original collateral\n        uint256[] memory _milestoneFundings;\n        (_milestoneFundings,) = daoStorage().readProposalFunding(_proposalId);\n        if (_index == _milestoneFundings.length) {\n            processCollateralRefund(_proposalId);\n        }\n\n        // increase the non-digix proposal count accordingly\n        bool _isDigixProposal;\n        (,,,,,,,,,_isDigixProposal) = daoStorage().readProposal(_proposalId);\n        if (_index == 0 && !_isDigixProposal) {\n            daoStorage().addNonDigixProposalCountInQuarter(currentQuarterIndex());\n        }\n\n        // Add quarter point for the proposer\n        uint256 _funding = daoStorage().readProposalMilestone(_proposalId, _index);\n        daoPointsStorage().addQuarterPoint(\n            daoStorage().readProposalProposer(_proposalId),\n            getUintConfig(CONFIG_QUARTER_POINT_MILESTONE_COMPLETION_PER_10000ETH).mul(_funding).div(10000 ether),\n            currentQuarterIndex()\n        );\n    }\n\n\n    function getInterResultKeyForBonusCalculation(bytes32 _proposalId) public view returns (bytes32 _key) {\n        _key = keccak256(abi.encodePacked(\n            _proposalId,\n            INTERMEDIATE_BONUS_CALCULATION_IDENTIFIER\n        ));\n    }\n\n\n    // calculate and update the bonuses for voters who voted \"correctly\" in the preceding voting round\n    function calculateVoterBonus(bytes32 _proposalId, uint256 _index, uint256 _operations, bool _passed)\n        internal\n        returns (bool _done)\n    {\n        if (_operations == 0) return false;\n        address _countedUntil;\n        (_countedUntil,,,) = intermediateResultsStorage().getIntermediateResults(\n            getInterResultKeyForBonusCalculation(_proposalId)\n        );\n\n        address[] memory _voterBatch;\n        if (_countedUntil == EMPTY_ADDRESS) {\n            _voterBatch = daoListingService().listParticipants(\n                _operations,\n                true\n            );\n        } else {\n            _voterBatch = daoListingService().listParticipantsFrom(\n                _countedUntil,\n                _operations,\n                true\n            );\n        }\n        address _lastVoter = _voterBatch[_voterBatch.length - 1]; // this will fail if _voterBatch is empty. However, there is at least the proposer as a participant in the quarter.\n\n        DaoIntermediateStructs.Users memory _bonusVoters;\n        if (_passed) {\n\n            // give bonus points for all those who\n            // voted YES in the previous round\n            (_bonusVoters.users, _bonusVoters.usersLength) = daoStorage().readVotingRoundVotes(_proposalId, _index.sub(1), _voterBatch, true);\n        } else {\n            // give bonus points for all those who\n            // voted NO in the previous round\n            (_bonusVoters.users, _bonusVoters.usersLength) = daoStorage().readVotingRoundVotes(_proposalId, _index.sub(1), _voterBatch, false);\n        }\n        //TODO: to here\n        if (_bonusVoters.usersLength > 0) addBonusReputation(_bonusVoters.users, _bonusVoters.usersLength);\n\n        if (_lastVoter == daoStakeStorage().readLastParticipant()) {\n            // this is the last iteration\n\n            intermediateResultsStorage().resetIntermediateResults(\n                getInterResultKeyForBonusCalculation(_proposalId)\n            );\n            _done = true;\n        } else {\n            // this is not the last iteration yet, save the intermediate results\n            intermediateResultsStorage().setIntermediateResults(\n                getInterResultKeyForBonusCalculation(_proposalId),\n                _lastVoter, 0, 0, 0\n            );\n        }\n    }\n\n\n    // Count the votes for a Voting Round and find out if its passed\n    /// @return _operationsLeft The number of operations left after the calculations in this function\n    /// @return _passed Whether this voting round passed\n    /// @return _done Whether the calculation for this step 1 is already done. If its not done, this function will need to run again in subsequent transactions\n    /// until _done is true\n    function countProposalVote(bytes32 _proposalId, uint256 _index, uint256 _operations)\n        internal\n        returns (uint256 _operationsLeft, bool _passed, bool _done)\n    {\n        senderCanDoProposerOperations();\n        require(isFromProposer(_proposalId));\n\n        DaoStructs.IntermediateResults memory _currentResults;\n        (\n            _currentResults.countedUntil,\n            _currentResults.currentForCount,\n            _currentResults.currentAgainstCount,\n        ) = intermediateResultsStorage().getIntermediateResults(_proposalId);\n        address[] memory _voters;\n        if (_currentResults.countedUntil == EMPTY_ADDRESS) { // This is the first transaction to count votes for this voting round\n            _voters = daoListingService().listParticipants(\n                _operations,\n                true\n            );\n        } else {\n            _voters = daoListingService().listParticipantsFrom(\n                _currentResults.countedUntil,\n                _operations,\n                true\n            );\n\n            // If there's no voters left to count, this means that STEP 1 is already done, just return whether it was passed\n            // Note that _currentResults should already be storing the final tally of votes for this voting round, as already calculated in previous iterations of this function\n            if (_voters.length == 0) {\n                return (\n                    _operations,\n                    isVoteCountPassed(_currentResults, _proposalId, _index),\n                    true\n                );\n            }\n        }\n\n        address _lastVoter = _voters[_voters.length - 1];\n\n        DaoIntermediateStructs.VotingCount memory _count;\n        (_count.forCount, _count.againstCount) = daoStorage().readVotingCount(_proposalId, _index, _voters);\n\n        _currentResults.currentForCount = _currentResults.currentForCount.add(_count.forCount);\n        _currentResults.currentAgainstCount = _currentResults.currentAgainstCount.add(_count.againstCount);\n        intermediateResultsStorage().setIntermediateResults(\n            _proposalId,\n            _lastVoter,\n            _currentResults.currentForCount,\n            _currentResults.currentAgainstCount,\n            0\n        );\n\n        if (_lastVoter != daoStakeStorage().readLastParticipant()) {\n            return (0, false, false); // hasn't done STEP 1 yet. The parent function (claimProposalVotingResult) should return after this. More transactions are needed to continue the calculation\n        }\n\n        // If it comes to here, this means all votes have already been counted\n        // From this point, the IntermediateResults struct will store the total tally of the votes for this voting round until processSuccessfulVotingClaim() is called,\n        // which will reset it.\n\n        _operationsLeft = _operations.sub(_voters.length);\n        _done = true;\n\n        _passed = isVoteCountPassed(_currentResults, _proposalId, _index);\n    }\n\n\n    function isVoteCountPassed(DaoStructs.IntermediateResults _currentResults, bytes32 _proposalId, uint256 _index)\n        internal\n        view\n        returns (bool _passed)\n    {\n        _passed = (_currentResults.currentForCount.add(_currentResults.currentAgainstCount) > daoCalculatorService().minimumVotingQuorum(_proposalId, _index))\n                && (daoCalculatorService().votingQuotaPass(_currentResults.currentForCount, _currentResults.currentAgainstCount));\n    }\n\n\n    function processCollateralRefund(bytes32 _proposalId)\n        internal\n    {\n        daoStorage().setProposalCollateralStatus(_proposalId, COLLATERAL_STATUS_CLAIMED);\n        require(daoFundingManager().refundCollateral(daoStorage().readProposalProposer(_proposalId), _proposalId));\n    }\n\n\n    // add bonus reputation for voters that voted \"correctly\" in the preceding voting round\n    function addBonusReputation(address[] _voters, uint256 _n)\n        private\n    {\n        uint256 _qp = getUintConfig(CONFIG_QUARTER_POINT_VOTE);\n        uint256 _rate = getUintConfig(CONFIG_BONUS_REPUTATION_NUMERATOR);\n        uint256 _base = getUintConfig(CONFIG_BONUS_REPUTATION_DENOMINATOR);\n\n        uint256 _bonus = _qp.mul(_rate).mul(getUintConfig(CONFIG_REPUTATION_PER_EXTRA_QP_NUM))\n            .div(\n                _base.mul(getUintConfig(CONFIG_REPUTATION_PER_EXTRA_QP_DEN))\n            );\n\n        for (uint256 i = 0; i < _n; i++) {\n            daoPointsStorage().addReputation(_voters[i], _bonus);\n        }\n    }\n\n}\n","abiDocs":[{"constant":true,"inputs":[],"name":"resolver","payable":false,"stateMutability":"view","type":"function","signature":"resolver()","signatureHash":"04f3bcec"},{"constant":true,"inputs":[],"name":"currentQuarterIndex","outputs":[{"name":"_quarterIndex","type":"uint256","description":"the current quarter index"}],"payable":false,"stateMutability":"view","type":"function","details":"Quarter indexes starts from 1","return":"_quarterIndex the current quarter index","notice":"Get the current quarter index","signature":"currentQuarterIndex()","signatureHash":"0d7cc561"},{"constant":true,"inputs":[{"name":"_configKey","type":"bytes32"}],"name":"getAddressConfig","payable":false,"stateMutability":"view","type":"function","signature":"getAddressConfig(bytes32)","signatureHash":"1d8ccd04"},{"constant":true,"inputs":[],"name":"key","payable":false,"stateMutability":"view","type":"function","signature":"key()","signatureHash":"3943380c"},{"constant":false,"inputs":[{"name":"_proposalId","type":"bytes32","description":"ID of the proposal"},{"name":"_index","type":"uint256","description":"Index of the  voting round"},{"name":"_operations","type":"uint256","description":"Number of operations to do in this call"}],"name":"claimProposalVotingResult","outputs":[{"name":"_passed","type":"bool","description":"Boolean, true if the  voting round passed, false if failed"},{"name":"_done","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function","details":"This function has two major steps: - Counting the votes + There is no need for this step if there are some conditions that makes the proposal auto failed + The number of operations needed for this step is the number of participants in the quarter - Calculating the bonus for the voters in the preceding round + We can skip this step if this is the Voting round 0 (there is no preceding voting round to calculate bonus) + The number of operations needed for this step is the number of participants who voted \"correctly\" in the preceding voting round Step 1 will have to finish first before step 2. The proposer is supposed to call this function repeatedly, until _done is true If the voting round fails, the collateral will be returned back to the proposer","return":"{ \"_passed\": \"Boolean, true if the  voting round passed, false if failed\" }","notice":"Function to claim the  voting round results","signature":"claimProposalVotingResult(bytes32,uint256,uint256)","signatureHash":"3d554f39"},{"constant":true,"inputs":[{"name":"_key","type":"bytes32","description":"the resolver key to look up"}],"name":"get_contract","outputs":[{"name":"_contract","type":"address","description":"the address of the contract"}],"payable":false,"stateMutability":"view","type":"function","details":"Get the address of a contract","return":"_contract the address of the contract","signature":"get_contract(bytes32)","signatureHash":"3f83acff"},{"constant":false,"inputs":[],"name":"claimOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","details":"Allows the pendingOwner address to finalize the transfer.","signature":"claimOwnership()","signatureHash":"4e71e0c8"},{"constant":true,"inputs":[],"name":"currentTimeInQuarter","outputs":[{"name":"_currentT","type":"uint256","description":"the current relative time in the quarter"}],"payable":false,"stateMutability":"view","type":"function","details":"For example: the currentTimeInQuarter of the first second of any quarter is 1","return":"_currentT the current relative time in the quarter","notice":"Get the current relative time in the quarter","signature":"currentTimeInQuarter()","signatureHash":"560a25ea"},{"constant":true,"inputs":[],"name":"isMainPhase","outputs":[{"name":"_isMainPhase","type":"bool","description":"true if it is in a main phase"}],"payable":false,"stateMutability":"view","type":"function","details":"The main phase is where all the governance activities could take plase. If the DAO is replaced, there can never be any more main phase.","return":"_isMainPhase true if it is in a main phase","notice":"Check if it is currently in a main phase.","signature":"isMainPhase()","signatureHash":"68533060"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","details":"Allows the current owner to relinquish control of the contract.","notice":"Renouncing to ownership will leave the contract without an owner. It will not be possible to call the functions with the `onlyOwner` modifier anymore.","signature":"renounceOwnership()","signatureHash":"715018a6"},{"constant":true,"inputs":[],"name":"isLockingPhase","outputs":[{"name":"_isLockingPhase","type":"bool","description":"true if it is in the locking phase"}],"payable":false,"stateMutability":"view","type":"function","details":"No governance activities can happen in the locking phase. The locking phase is from t=0 to t=CONFIG_LOCKING_PHASE_DURATION-1","return":"_isLockingPhase true if it is in the locking phase","notice":"Check if it is currently in the locking phase","signature":"isLockingPhase()","signatureHash":"7d6fed80"},{"constant":true,"inputs":[],"name":"owner","payable":false,"stateMutability":"view","type":"function","signature":"owner()","signatureHash":"8da5cb5b"},{"constant":false,"inputs":[{"name":"_proposalId","type":"bytes32","description":"ID of the proposal"},{"name":"_operations","type":"uint256","description":"Number of operations to do in this call"}],"name":"claimDraftVotingResult","outputs":[{"name":"_passed","type":"bool","description":"Boolean, true if the draft voting has passed, false if the claiming deadline has passed or the voting has failed"},{"name":"_done","type":"bool","description":"Boolean, true if the calculation has finished"}],"payable":false,"stateMutability":"nonpayable","type":"function","details":"The founder/or anyone is supposed to call this function after the claiming deadline has passed, to clean it up and close this proposal. If this voting fails, the collateral will be refunded","return":"{ \"_passed\": \"Boolean, true if the draft voting has passed, false if the claiming deadline has passed or the voting has failed\", \"_done\": \"Boolean, true if the calculation has finished\" }","notice":"Function to claim the draft voting result (can only be called by the proposal proposer)","signature":"claimDraftVotingResult(bytes32,uint256)","signatureHash":"90e353df"},{"constant":true,"inputs":[{"name":"_user","type":"address"}],"name":"isParticipant","payable":false,"stateMutability":"view","type":"function","notice":"Check if a user is a participant in the current quarter","signature":"isParticipant(address)","signatureHash":"929066f5"},{"constant":true,"inputs":[{"name":"_configKey","type":"bytes32"}],"name":"getBytesConfig","payable":false,"stateMutability":"view","type":"function","signature":"getBytesConfig(bytes32)","signatureHash":"93ddad08"},{"constant":true,"inputs":[{"name":"_configKey","type":"bytes32"}],"name":"getUintConfig","payable":false,"stateMutability":"view","type":"function","signature":"getUintConfig(bytes32)","signatureHash":"b1e2b9dd"},{"constant":true,"inputs":[{"name":"_proposalId","type":"bytes32"}],"name":"getInterResultKeyForBonusCalculation","payable":false,"stateMutability":"view","type":"function","signature":"getInterResultKeyForBonusCalculation(bytes32)","signatureHash":"c66c9efd"},{"constant":true,"inputs":[],"name":"isDaoNotReplaced","outputs":[{"name":"_isNotReplaced","type":"bool","description":"true if it is not replaced, false if it has already been replaced"}],"payable":false,"stateMutability":"view","type":"function","return":"_isNotReplaced true if it is not replaced, false if it has already been replaced","notice":"Check if the DAO contracts have been replaced by a new set of contracts","signature":"isDaoNotReplaced()","signatureHash":"d70d9358"},{"constant":true,"inputs":[],"name":"CONTRACT_ADDRESS","payable":false,"stateMutability":"view","type":"function","signature":"CONTRACT_ADDRESS()","signatureHash":"db4ecbc1"},{"constant":true,"inputs":[],"name":"pendingOwner","payable":false,"stateMutability":"view","type":"function","signature":"pendingOwner()","signatureHash":"e30c3978"},{"constant":false,"inputs":[{"name":"newOwner","type":"address","description":"The address to transfer ownership to."}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","details":"Allows the current owner to set the pendingOwner address.","signature":"transferOwnership(address)","signatureHash":"f2fde38b"},{"constant":true,"inputs":[{"name":"_proposalId","type":"bytes32"}],"name":"isProposalPaused","outputs":[{"name":"_isPausedOrStopped","type":"bool","description":"true if the proposal is paused(or stopped)"}],"payable":false,"stateMutability":"view","type":"function","details":"If a proposal is paused/stopped (by the PRLs): proposer cannot call for voting, a current on-going voting round can still pass, but no funding can be withdrawn.A paused proposal can still be unpausedIf a proposal is stopped, this function also returns true","return":"_isPausedOrStopped true if the proposal is paused(or stopped)","notice":"Check if a proposal is currently paused/stopped","signature":"isProposalPaused(bytes32)","signatureHash":"f94f0f33"},{"constant":true,"inputs":[{"name":"_user","type":"address"}],"name":"isModerator","payable":false,"stateMutability":"view","type":"function","notice":"Check if a user is a moderator in the current quarter","signature":"isModerator(address)","signatureHash":"fa6f3936"},{"inputs":[{"name":"_resolver","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event","signature":"OwnershipRenounced(address)","signatureHash":"f8df3114"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event","signature":"OwnershipTransferred(address,address)","signatureHash":"8be0079c"}]}
