Skip to content

Commit 8e6ba3d

Browse files
authored
Solc v 0.4.25 (#18)
organization - > organizationId
1 parent 88f3cd2 commit 8e6ba3d

22 files changed

+76
-77
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ dist: trusty
33
language: node_js
44

55
node_js:
6-
- "8.11.4"
6+
- "8.12.0"
77

88
before_install:
99
- sudo apt-get update -qq

contracts/Migrations.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.4.24;
1+
pragma solidity ^0.4.25;
22

33

44
contract Migrations {

contracts/Reputation.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.4.24;
1+
pragma solidity ^0.4.25;
22

33
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
44

contracts/VotingMachines/AbsoluteVote.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.4.24;
1+
pragma solidity ^0.4.25;
22

33
import "../Reputation.sol";
44
import "./IntVoteInterface.sol";
@@ -23,7 +23,7 @@ contract AbsoluteVote is IntVoteInterface {
2323

2424
struct Proposal {
2525
address owner; // the proposal's owner
26-
bytes32 organization; // the address of the organization that owns the proposal
26+
bytes32 organizationId; // the organization Id
2727
address callbacks;
2828
uint numOfChoices;
2929
bytes32 paramsHash; // the hash of the parameters of the proposal
@@ -34,7 +34,7 @@ contract AbsoluteVote is IntVoteInterface {
3434
}
3535

3636
event AVVoteProposal(bytes32 indexed _proposalId, bool _isOwnerVote);
37-
event RefreshReputation(bytes32 indexed _proposalId, bytes32 indexed _organization, address indexed _voter,uint _reputation);
37+
event RefreshReputation(bytes32 indexed _proposalId, bytes32 indexed _organizationId, address indexed _voter,uint _reputation);
3838

3939

4040
mapping(bytes32=>Parameters) public parameters; // A mapping from hashes to parameters
@@ -64,7 +64,7 @@ contract AbsoluteVote is IntVoteInterface {
6464
* generated by calculating keccak256 of a incremented counter.
6565
* @param _numOfChoices number of voting choices
6666
* @param _paramsHash defined the parameters of the voting machine used for this proposal
67-
* @param _organization address
67+
* @param _organization address
6868
* @return proposal's id.
6969
*/
7070
function propose(uint _numOfChoices, bytes32 _paramsHash, address, address _organization)
@@ -82,11 +82,11 @@ contract AbsoluteVote is IntVoteInterface {
8282
proposal.numOfChoices = _numOfChoices;
8383
proposal.paramsHash = _paramsHash;
8484
proposal.callbacks = msg.sender;
85-
proposal.organization = keccak256(abi.encodePacked(msg.sender,_organization));
85+
proposal.organizationId = keccak256(abi.encodePacked(msg.sender,_organization));
8686
proposal.owner = msg.sender;
8787
proposal.open = true;
8888
proposals[proposalId] = proposal;
89-
emit NewProposal(proposalId, proposal.organization, _numOfChoices, msg.sender, _paramsHash);
89+
emit NewProposal(proposalId, proposal.organizationId, _numOfChoices, msg.sender, _paramsHash);
9090
return proposalId;
9191
}
9292

@@ -98,9 +98,9 @@ contract AbsoluteVote is IntVoteInterface {
9898
if (! parameters[proposals[_proposalId].paramsHash].allowOwner) {
9999
return false;
100100
}
101-
bytes32 organization = proposals[_proposalId].organization;
101+
bytes32 organizationId = proposals[_proposalId].organizationId;
102102
deleteProposal(_proposalId);
103-
emit CancelProposal(_proposalId, organization);
103+
emit CancelProposal(_proposalId, organizationId);
104104
return true;
105105
}
106106

@@ -241,7 +241,7 @@ contract AbsoluteVote is IntVoteInterface {
241241
proposal.votes[voter.vote] = (proposal.votes[voter.vote]).sub(voter.reputation);
242242
proposal.totalVotes = (proposal.totalVotes).sub(voter.reputation);
243243
delete proposal.voters[_voter];
244-
emit CancelVoting(_proposalId, proposal.organization, _voter);
244+
emit CancelVoting(_proposalId, proposal.organizationId, _voter);
245245
}
246246

247247
function deleteProposal(bytes32 _proposalId) internal {
@@ -267,7 +267,7 @@ contract AbsoluteVote is IntVoteInterface {
267267
if (proposal.votes[cnt] > totalReputation*precReq/100) {
268268
Proposal memory tmpProposal = proposal;
269269
deleteProposal(_proposalId);
270-
emit ExecuteProposal(_proposalId, tmpProposal.organization, cnt, totalReputation);
270+
emit ExecuteProposal(_proposalId, tmpProposal.organizationId, cnt, totalReputation);
271271
ProposalExecuteInterface(tmpProposal.callbacks).executeProposal(_proposalId,int(cnt));
272272
return true;
273273
}
@@ -307,7 +307,7 @@ contract AbsoluteVote is IntVoteInterface {
307307
vote: _vote
308308
});
309309
// Event:
310-
emit VoteProposal(_proposalId, proposal.organization, _voter, _vote, reputation);
310+
emit VoteProposal(_proposalId, proposal.organizationId, _voter, _vote, reputation);
311311
emit AVVoteProposal(_proposalId, (_voter != msg.sender));
312312
// execute the proposal if this vote was decisive:
313313
return _execute(_proposalId);

contracts/VotingMachines/GenesisProtocol.sol

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.4.24;
1+
pragma solidity ^0.4.25;
22

33
import "./IntVoteInterface.sol";
44
import { RealMath } from "../libs/RealMath.sol";
@@ -62,7 +62,7 @@ contract GenesisProtocol is IntVoteInterface {
6262
}
6363

6464
struct Proposal {
65-
bytes32 organization; // the organization unique identifier the proposal is target to.
65+
bytes32 organizationId; // the organization unique identifier the proposal is target to.
6666
address callbacks; // should fulfill voting callbacks interface.
6767
uint numOfChoices;
6868
uint votersStakes;
@@ -88,10 +88,10 @@ contract GenesisProtocol is IntVoteInterface {
8888
mapping(address => Staker ) stakers;
8989
}
9090

91-
event Stake(bytes32 indexed _proposalId, bytes32 indexed _organization, address indexed _staker,uint _vote,uint _amount);
92-
event Redeem(bytes32 indexed _proposalId, bytes32 indexed _organization, address indexed _beneficiary,uint _amount);
93-
event RedeemDaoBounty(bytes32 indexed _proposalId, bytes32 indexed _organization, address indexed _beneficiary,uint _amount);
94-
event RedeemReputation(bytes32 indexed _proposalId, bytes32 indexed _organization, address indexed _beneficiary,uint _amount);
91+
event Stake(bytes32 indexed _proposalId, bytes32 indexed _organizationId, address indexed _staker,uint _vote,uint _amount);
92+
event Redeem(bytes32 indexed _proposalId, bytes32 indexed _organizationId, address indexed _beneficiary,uint _amount);
93+
event RedeemDaoBounty(bytes32 indexed _proposalId, bytes32 indexed _organizationId, address indexed _beneficiary,uint _amount);
94+
event RedeemReputation(bytes32 indexed _proposalId, bytes32 indexed _organizationId, address indexed _beneficiary,uint _amount);
9595
event GPExecuteProposal(bytes32 indexed _proposalId, ExecutionState _executionState);
9696

9797
mapping(bytes32=>Parameters) public parameters; // A mapping from hashes to parameters
@@ -102,11 +102,10 @@ contract GenesisProtocol is IntVoteInterface {
102102
uint constant public YES = 1;
103103
uint public proposalsCnt; // Total number of proposals
104104
mapping(bytes32=>uint) public orgBoostedProposalsCnt;
105+
mapping(bytes32=>OrderStatisticTree.Tree) proposalsExpiredTimes; //proposals expired times
105106
StandardToken public stakingToken;
106107
mapping(bytes=>bool) stakeSignatures; //stake signatures
107108
address constant GEN_TOKEN_ADDRESS = 0x543Ff227F64Aa17eA132Bf9886cAb5DB55DCAddf;
108-
mapping(bytes32=>OrderStatisticTree.Tree) proposalsExpiredTimes; //proposals expired times
109-
110109
// Digest describing the data the user signs according EIP 712.
111110
// Needs to match what is passed to Metamask.
112111
bytes32 public constant DELEGATION_HASH_EIP712 =
@@ -160,7 +159,7 @@ contract GenesisProtocol is IntVoteInterface {
160159
Proposal memory proposal;
161160
proposal.numOfChoices = _numOfChoices;
162161
proposal.callbacks = msg.sender;
163-
proposal.organization = keccak256(abi.encodePacked(msg.sender,_organization));
162+
proposal.organizationId = keccak256(abi.encodePacked(msg.sender,_organization));
164163

165164
proposal.state = ProposalState.PreBoosted;
166165
// solium-disable-next-line security/no-block-members
@@ -170,7 +169,7 @@ contract GenesisProtocol is IntVoteInterface {
170169
proposal.winningVote = NO;
171170
proposal.paramsHash = _paramsHash;
172171
proposals[proposalId] = proposal;
173-
emit NewProposal(proposalId, proposal.organization, _numOfChoices, _proposer, _paramsHash);
172+
emit NewProposal(proposalId, proposal.organizationId, _numOfChoices, _proposer, _paramsHash);
174173
return proposalId;
175174
}
176175

@@ -367,12 +366,12 @@ contract GenesisProtocol is IntVoteInterface {
367366
}
368367

369368
/**
370-
* @dev getProposalOrganization return the organization for a given proposal
369+
* @dev getProposalOrganization return the organizationId for a given proposal
371370
* @param _proposalId the ID of the proposal
372371
* @return bytes32 organization identifier
373372
*/
374373
function getProposalOrganization(bytes32 _proposalId) external view returns(bytes32) {
375-
return (proposals[_proposalId].organization);
374+
return (proposals[_proposalId].organizationId);
376375
}
377376

378377
/**
@@ -507,11 +506,11 @@ contract GenesisProtocol is IntVoteInterface {
507506
if (amount != 0) {
508507
proposal.totalStakes[1] = proposal.totalStakes[1].sub(amount);
509508
require(stakingToken.transfer(_beneficiary, amount));
510-
emit Redeem(_proposalId,proposal.organization,_beneficiary,amount);
509+
emit Redeem(_proposalId,proposal.organizationId,_beneficiary,amount);
511510
}
512511
if (reputation != 0 ) {
513512
VotingMachineCallbacksInterface(proposal.callbacks).mintReputation(reputation,_beneficiary,_proposalId);
514-
emit RedeemReputation(_proposalId,proposal.organization,_beneficiary,reputation);
513+
emit RedeemReputation(_proposalId,proposal.organizationId,_beneficiary,reputation);
515514
}
516515
}
517516

@@ -550,7 +549,7 @@ contract GenesisProtocol is IntVoteInterface {
550549
require(VotingMachineCallbacksInterface(proposal.callbacks).stakingTokenTransfer(stakingToken,_beneficiary,potentialAmount,_proposalId));
551550
proposal.stakers[_beneficiary].amountForBounty = 0;
552551
redeemedAmount = potentialAmount;
553-
emit RedeemDaoBounty(_proposalId,proposal.organization,_beneficiary,redeemedAmount);
552+
emit RedeemDaoBounty(_proposalId,proposal.organizationId,_beneficiary,redeemedAmount);
554553
}
555554
}
556555

@@ -561,7 +560,7 @@ contract GenesisProtocol is IntVoteInterface {
561560
*/
562561
function shouldBoost(bytes32 _proposalId) public view returns(bool) {
563562
Proposal memory proposal = proposals[_proposalId];
564-
return (_score(_proposalId) >= threshold(proposal.paramsHash,proposal.organization));
563+
return (_score(_proposalId) >= threshold(proposal.paramsHash,proposal.organizationId));
565564
}
566565

567566
/**
@@ -575,28 +574,28 @@ contract GenesisProtocol is IntVoteInterface {
575574

576575
/**
577576
* @dev getBoostedProposalsCount return the number of boosted proposal for an organization
578-
* @param _organization the organization identifier
577+
* @param _organizationId the organization identifier
579578
* @return uint number of boosted proposals
580579
*/
581-
function getBoostedProposalsCount(bytes32 _organization) public view returns(uint) {
580+
function getBoostedProposalsCount(bytes32 _organizationId) public view returns(uint) {
582581
uint expiredProposals;
583-
if (proposalsExpiredTimes[_organization].count() != 0) {
582+
if (proposalsExpiredTimes[_organizationId].count() != 0) {
584583
// solium-disable-next-line security/no-block-members
585-
expiredProposals = proposalsExpiredTimes[_organization].rank(now);
584+
expiredProposals = proposalsExpiredTimes[_organizationId].rank(now);
586585
}
587-
return orgBoostedProposalsCnt[_organization].sub(expiredProposals);
586+
return orgBoostedProposalsCnt[_organizationId].sub(expiredProposals);
588587
}
589588

590589
/**
591590
* @dev threshold return the organization's score threshold which required by
592591
* a proposal to shift to boosted state.
593592
* This threshold is dynamically set and it depend on the number of boosted proposal.
594-
* @param _organization the organization identifier
593+
* @param _organizationId the organization identifier
595594
* @param _paramsHash the organization parameters hash
596595
* @return int organization's score threshold.
597596
*/
598-
function threshold(bytes32 _paramsHash,bytes32 _organization) public view returns(int) {
599-
uint boostedProposals = getBoostedProposalsCount(_organization);
597+
function threshold(bytes32 _paramsHash,bytes32 _organizationId) public view returns(int) {
598+
uint boostedProposals = getBoostedProposalsCount(_organizationId);
600599
int216 e = 2;
601600

602601
Parameters memory params = parameters[_paramsHash];
@@ -738,23 +737,23 @@ contract GenesisProtocol is IntVoteInterface {
738737
proposal.state = ProposalState.Boosted;
739738
// solium-disable-next-line security/no-block-members
740739
proposal.boostedPhaseTime = now;
741-
proposalsExpiredTimes[proposal.organization].insert(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
742-
orgBoostedProposalsCnt[proposal.organization]++;
740+
proposalsExpiredTimes[proposal.organizationId].insert(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
741+
orgBoostedProposalsCnt[proposal.organizationId]++;
743742
}
744743
}
745744

746745
if ((proposal.state == ProposalState.Boosted) ||
747746
(proposal.state == ProposalState.QuietEndingPeriod)) {
748747
// solium-disable-next-line security/no-block-members
749748
if ((now - proposal.boostedPhaseTime) >= proposal.currentBoostedVotePeriodLimit) {
750-
proposalsExpiredTimes[proposal.organization].remove(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
749+
proposalsExpiredTimes[proposal.organizationId].remove(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
751750
proposal.state = ProposalState.Executed;
752-
orgBoostedProposalsCnt[tmpProposal.organization] = orgBoostedProposalsCnt[tmpProposal.organization].sub(1);
751+
orgBoostedProposalsCnt[tmpProposal.organizationId] = orgBoostedProposalsCnt[tmpProposal.organizationId].sub(1);
753752
executionState = ExecutionState.BoostedTimeOut;
754753
} else if (proposal.votes[proposal.winningVote] > executionBar) {
755754
// someone crossed the absolute vote execution bar.
756-
orgBoostedProposalsCnt[tmpProposal.organization] = orgBoostedProposalsCnt[tmpProposal.organization].sub(1);
757-
proposalsExpiredTimes[proposal.organization].remove(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
755+
orgBoostedProposalsCnt[tmpProposal.organizationId] = orgBoostedProposalsCnt[tmpProposal.organizationId].sub(1);
756+
proposalsExpiredTimes[proposal.organizationId].remove(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
758757
proposal.state = ProposalState.Executed;
759758
executionState = ExecutionState.BoostedBarCrossed;
760759
}
@@ -767,7 +766,7 @@ contract GenesisProtocol is IntVoteInterface {
767766
}
768767
proposal.daoBountyRemain = daoBountyRemain;
769768
}
770-
emit ExecuteProposal(_proposalId, proposal.organization, proposal.winningVote, totalReputation);
769+
emit ExecuteProposal(_proposalId, proposal.organizationId, proposal.winningVote, totalReputation);
771770
emit GPExecuteProposal(_proposalId, executionState);
772771
ProposalExecuteInterface(proposal.callbacks).executeProposal(_proposalId,int(proposal.winningVote));
773772
}
@@ -816,7 +815,7 @@ contract GenesisProtocol is IntVoteInterface {
816815
amount = amount - ((params.stakerFeeRatioForVoters*amount)/100);
817816
proposal.totalStakes[0] = amount.add(proposal.totalStakes[0]);
818817
// Event:
819-
emit Stake(_proposalId, proposal.organization, _staker, _vote, _amount);
818+
emit Stake(_proposalId, proposal.organizationId, _staker, _vote, _amount);
820819
// execute the proposal if this vote was decisive:
821820
return _execute(_proposalId);
822821
}
@@ -866,13 +865,13 @@ contract GenesisProtocol is IntVoteInterface {
866865
if ((proposal.state == ProposalState.QuietEndingPeriod) ||
867866
((proposal.state == ProposalState.Boosted) && ((_now - proposal.boostedPhaseTime) >= (params.boostedVotePeriodLimit - params.quietEndingPeriod)))) {
868867
//quietEndingPeriod
869-
proposalsExpiredTimes[proposal.organization].remove(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
868+
proposalsExpiredTimes[proposal.organizationId].remove(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
870869
if (proposal.state != ProposalState.QuietEndingPeriod) {
871870
proposal.currentBoostedVotePeriodLimit = params.quietEndingPeriod;
872871
proposal.state = ProposalState.QuietEndingPeriod;
873872
}
874873
proposal.boostedPhaseTime = _now;
875-
proposalsExpiredTimes[proposal.organization].insert(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
874+
proposalsExpiredTimes[proposal.organizationId].insert(proposal.boostedPhaseTime + proposal.currentBoostedVotePeriodLimit);
876875
}
877876
proposal.winningVote = _vote;
878877
}
@@ -887,7 +886,7 @@ contract GenesisProtocol is IntVoteInterface {
887886
VotingMachineCallbacksInterface(proposal.callbacks).burnReputation(reputationDeposit,_voter,_proposalId);
888887
}
889888
// Event:
890-
emit VoteProposal(_proposalId, proposal.organization, _voter, _vote, rep);
889+
emit VoteProposal(_proposalId, proposal.organizationId, _voter, _vote, rep);
891890
// execute the proposal if this vote was decisive:
892891
return _execute(_proposalId);
893892
}

contracts/VotingMachines/IntVoteInterface.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
pragma solidity ^0.4.24;
1+
pragma solidity ^0.4.25;
22

33
interface IntVoteInterface {
44
//When implementing this interface please do not only override function and modifier,
55
//but also to keep the modifiers on the overridden functions.
66
modifier onlyProposalOwner(bytes32 _proposalId) {revert(); _;}
77
modifier votable(bytes32 _proposalId) {revert(); _;}
88

9-
event NewProposal(bytes32 indexed _proposalId, bytes32 indexed _organization, uint _numOfChoices, address _proposer, bytes32 _paramsHash);
10-
event ExecuteProposal(bytes32 indexed _proposalId, bytes32 indexed _organization, uint _decision, uint _totalReputation);
11-
event VoteProposal(bytes32 indexed _proposalId, bytes32 indexed _organization, address indexed _voter, uint _vote, uint _reputation);
12-
event CancelProposal(bytes32 indexed _proposalId, bytes32 indexed _organization );
13-
event CancelVoting(bytes32 indexed _proposalId, bytes32 indexed _organization, address indexed _voter);
9+
event NewProposal(bytes32 indexed _proposalId, bytes32 indexed _organizationId, uint _numOfChoices, address _proposer, bytes32 _paramsHash);
10+
event ExecuteProposal(bytes32 indexed _proposalId, bytes32 indexed _organizationId, uint _decision, uint _totalReputation);
11+
event VoteProposal(bytes32 indexed _proposalId, bytes32 indexed _organizationId, address indexed _voter, uint _vote, uint _reputation);
12+
event CancelProposal(bytes32 indexed _proposalId, bytes32 indexed _organizationId );
13+
event CancelVoting(bytes32 indexed _proposalId, bytes32 indexed _organizationId, address indexed _voter);
1414

1515
/**
1616
* @dev register a new proposal with the given parameters. Every proposal has a unique ID which is being
1717
* generated by calculating keccak256 of a incremented counter.
1818
* @param _numOfChoices number of voting choices
1919
* @param _proposalParameters defines the parameters of the voting machine used for this proposal
2020
* @param _proposer address
21-
* @param _organization address
21+
* @param _organization address - if this address is zero the msg.sender will be used as the organization address.
2222
* @return proposal's id.
2323
*/
2424
function propose(

contracts/VotingMachines/ProposalExecuteInterface.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.4.24;
1+
pragma solidity ^0.4.25;
22

33
interface ProposalExecuteInterface {
44
function executeProposal(bytes32 _proposalId,int _decision) external returns(bool);

0 commit comments

Comments
 (0)