@@ -36,9 +36,8 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
3636 uint256 limitExponentValue;// an upper limit for numberOfBoostedProposals
3737 //in the threshold calculation to prevent overflow
3838 uint256 quietEndingPeriod; //quite ending period
39- uint256 proposingRepReward;//proposer reputation reward.
40- uint256 votersReputationLossRatio;//Unsuccessful pre booster
41- //voters lose votersReputationLossRatio% of their reputation.
39+ uint256 proposingRepReward;//deprecated
40+ uint256 votersReputationLossRatio;//deprecated
4241 uint256 minimumDaoBounty;
4342 uint256 daoBountyConst;//The DAO downstake for each proposal is calculate according to the formula
4443 //(daoBountyConst * averageBoostDownstakes)/100 .
@@ -65,7 +64,7 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
6564 address callbacks; // should fulfill voting callbacks interface.
6665 ProposalState state;
6766 uint256 winningVote; //the winning vote.
68- address proposer;
67+ address proposer; //deprecated - will not be set
6968 //the proposal boosted period limit . it is updated for the case of quiteWindow mode.
7069 uint256 currentBoostedVotePeriodLimit;
7170 bytes32 paramsHash;
@@ -80,8 +79,6 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
8079 bool daoRedeemItsWinnings;
8180 // vote reputation
8281 mapping (uint256 => uint256 ) votes;
83- // vote reputation
84- mapping (uint256 => uint256 ) preBoostedVotes;
8582 // a mapping between address and voterBitmap
8683 // voterBitmap : bits 0-127 the voter reputation.
8784 // bits 247 indicate if the vote was during regular or preBoosted state.
@@ -112,10 +109,11 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
112109 uint256 _amount
113110 );
114111
112+ //this event definition is here to maintain subgraph competability
115113 event RedeemReputation (bytes32 indexed _proposalId ,
116- address indexed _organization ,
117- address indexed _beneficiary ,
118- uint256 _amount
114+ address indexed _organization ,
115+ address indexed _beneficiary ,
116+ uint256 _amount
119117 );
120118
121119 event StateChange (bytes32 indexed _proposalId , ProposalState _proposalState );
@@ -192,8 +190,8 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
192190 * state (stable) before boosted.
193191 * _params[4] -_thresholdConst
194192 * _params[5] -_quietEndingPeriod
195- * _params[6] -_proposingRepReward
196- * _params[7] -_votersReputationLossRatio
193+ * _params[6] - deprected - set to 0
194+ * _params[7] -deprected - set to 0
197195 * _params[8] -_minimumDaoBounty
198196 * _params[9] -_daoBountyConst
199197 * _params[10] -_activationTime
@@ -208,7 +206,6 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
208206 {
209207 require (_params[0 ] <= 100 && _params[0 ] >= 50 , "50 <= queuedVoteRequiredPercentage <= 100 " );
210208 require (_params[4 ] <= 16000 && _params[4 ] > 1000 , "1000 < thresholdConst <= 16000 " );
211- require (_params[7 ] <= 100 , "votersReputationLossRatio <= 100 " );
212209 require (_params[2 ] >= _params[5 ], "boostedVotePeriodLimit >= quietEndingPeriod " );
213210 require (_params[8 ] > 0 , "minimumDaoBounty should be > 0 " );
214211 require (_params[9 ] > 0 , "daoBountyConst should be > 0 " );
@@ -233,8 +230,8 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
233230 thresholdConst:uint216 (_params[4 ]).fraction (uint216 (1000 )),
234231 limitExponentValue:limitExponent,
235232 quietEndingPeriod: _params[5 ],
236- proposingRepReward: _params[ 6 ] ,
237- votersReputationLossRatio:_params[ 7 ] ,
233+ proposingRepReward: 0 ,
234+ votersReputationLossRatio: 0 ,
238235 minimumDaoBounty:_params[8 ],
239236 daoBountyConst:_params[9 ],
240237 activationTime:_params[10 ],
@@ -254,12 +251,11 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
254251 * [1] voterReputationReward
255252 * [2] proposerReputationReward
256253 */
257- // solhint-disable-next-line function-max-lines, code-complexity
254+ // solhint-disable-next-line code-complexity
258255 function redeem (bytes32 _proposalId , address _beneficiary ) public returns (uint [3 ] memory rewards ) {
259256 Proposal storage proposal = proposals[_proposalId];
260257 require ((proposal.state == ProposalState.Executed)|| (proposal.state == ProposalState.ExpiredInQueue),
261258 "Proposal should be Executed or ExpiredInQueue " );
262- Parameters memory params = parameters[proposal.paramsHash];
263259 //as staker
264260 Staker storage staker = proposal.stakers[_beneficiary];
265261 uint256 totalWinningStakes = proposal.stakes[proposal.winningVote];
@@ -292,49 +288,11 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
292288 .sub (proposal.daoBounty);
293289 proposal.daoRedeemItsWinnings = true ;
294290 }
295-
296- //as voter
297- uint256 voter = proposal.voters[_beneficiary];
298- uint256 voterReputation = uint256 (uint128 (voter));
299- bool voterPreBoosted = (voter >> PREBOOSTED_BIT_INDEX & 1 == 1 );
300- uint8 voterVote = uint8 (voter >> VOTE_BIT_INDEX);
301- if ((voterReputation != 0 ) && (voterPreBoosted)) {
302- if (proposal.state == ProposalState.ExpiredInQueue) {
303- //give back reputation for the voter
304- rewards[1 ] = ((voterReputation.mul (params.votersReputationLossRatio))/ 100 );
305- } else if (proposal.winningVote == voterVote) {
306- uint256 lostReputation;
307- if (proposal.winningVote == YES) {
308- lostReputation = proposal.preBoostedVotes[NO];
309- } else {
310- lostReputation = proposal.preBoostedVotes[YES];
311- }
312- lostReputation = (lostReputation.mul (params.votersReputationLossRatio))/ 100 ;
313- rewards[1 ] = ((voterReputation.mul (params.votersReputationLossRatio))/ 100 )
314- .add ((voterReputation.mul (lostReputation))/ proposal.preBoostedVotes[proposal.winningVote]);
315- }
316- proposal.voters[_beneficiary] = 0 ;
317- }
318- //as proposer
319- if ((proposal.proposer == _beneficiary)&& (proposal.winningVote == YES)&& (proposal.proposer != address (0 ))) {
320- rewards[2 ] = params.proposingRepReward;
321- proposal.proposer = address (0 );
322- }
323291 if (rewards[0 ] != 0 ) {
324292 proposal.totalStakes = proposal.totalStakes.sub (rewards[0 ]);
325293 require (stakingToken.transfer (_beneficiary, rewards[0 ]), "transfer to beneficiary failed " );
326294 emit Redeem (_proposalId, organizations[proposal.organizationId], _beneficiary, rewards[0 ]);
327295 }
328- if (rewards[1 ].add (rewards[2 ]) != 0 ) {
329- VotingMachineCallbacksInterface (proposal.callbacks)
330- .mintReputation (rewards[1 ].add (rewards[2 ]), _beneficiary, _proposalId);
331- emit RedeemReputation (
332- _proposalId,
333- organizations[proposal.organizationId],
334- _beneficiary,
335- rewards[1 ].add (rewards[2 ])
336- );
337- }
338296 }
339297
340298 /**
@@ -438,8 +396,8 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
438396 _params[3 ],
439397 _params[4 ],
440398 _params[5 ],
441- _params[ 6 ] ,
442- _params[ 7 ] ,
399+ uint256 ( 0 ) ,
400+ uint256 ( 0 ) ,
443401 _params[8 ],
444402 _params[9 ],
445403 _params[10 ])
@@ -649,7 +607,6 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
649607 // solhint-disable-next-line not-rely-on-time
650608 proposal.times[0 ] = now ;//submitted time
651609 proposal.currentBoostedVotePeriodLimit = parameters[_paramsHash].boostedVotePeriodLimit;
652- proposal.proposer = _proposer;
653610 proposal.winningVote = NO;
654611 proposal.paramsHash = _paramsHash;
655612 if (organizations[proposal.organizationId] == address (0 )) {
@@ -730,11 +687,6 @@ contract GenesisProtocolLogic is IntVoteInterfaceEvents {
730687 voter = voter | PREBOOSTED_BIT_SET;
731688 }
732689 proposal.voters[_voter] = voter;
733- if ((proposal.state == ProposalState.PreBoosted) || (proposal.state == ProposalState.Queued)) {
734- proposal.preBoostedVotes[_vote] = rep.add (proposal.preBoostedVotes[_vote]);
735- uint256 reputationDeposit = (params.votersReputationLossRatio.mul (rep))/ 100 ;
736- VotingMachineCallbacksInterface (proposal.callbacks).burnReputation (reputationDeposit, _voter, _proposalId);
737- }
738690 emit VoteProposal (_proposalId, organizations[proposal.organizationId], _voter, _vote, rep);
739691 return _execute (_proposalId);
740692 }
0 commit comments