Skip to content

Commit 2343553

Browse files
authored
Merge pull request #221 from ekpyron/updateDAO
Update DAO contracts.
2 parents 5d154c0 + 048ee8d commit 2343553

File tree

9 files changed

+1352
-22
lines changed

9 files changed

+1352
-22
lines changed

test/DAO/DAO.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ contract DAOInterface {
221221
address _recipient,
222222
uint _amount,
223223
bytes _transactionData
224-
) constant returns (bool _codeChecksOut);
224+
) view returns (bool _codeChecksOut);
225225

226226
/// @notice Vote on proposal `_proposalID` with `_supportsProposal`
227227
/// @param _proposalID The proposal ID
@@ -320,11 +320,11 @@ contract DAOInterface {
320320
function halveMinQuorum() returns (bool _success);
321321

322322
/// @return total number of proposals ever created
323-
function numberOfProposals() constant returns (uint _numberOfProposals);
323+
function numberOfProposals() view returns (uint _numberOfProposals);
324324

325325
/// @param _proposalID Id of the new curator proposal
326326
/// @return Address of the new DAO
327-
function getNewDAOAddress(uint _proposalID) constant returns (address _newDAO);
327+
function getNewDAOAddress(uint _proposalID) view returns (address _newDAO);
328328

329329
/// @param _account The address of the account which is checked.
330330
/// @return Whether the account is blocked (not allowed to transfer tokens) or not.
@@ -455,7 +455,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
455455
p.recipient = _recipient;
456456
p.amount = _amount;
457457
p.description = _description;
458-
p.proposalHash = sha3(_recipient, _amount, _transactionData);
458+
p.proposalHash = keccak256(_recipient, _amount, _transactionData);
459459
p.votingDeadline = now + _debatingPeriod;
460460
p.open = true;
461461
//p.proposalPassed = False; // that's default
@@ -482,9 +482,9 @@ contract DAO is DAOInterface, Token, TokenCreation {
482482
address _recipient,
483483
uint _amount,
484484
bytes _transactionData
485-
) noEther constant returns (bool _codeChecksOut) {
485+
) noEther view returns (bool _codeChecksOut) {
486486
Proposal p = proposals[_proposalID];
487-
return p.proposalHash == sha3(_recipient, _amount, _transactionData);
487+
return p.proposalHash == keccak256(_recipient, _amount, _transactionData);
488488
}
489489

490490

@@ -543,7 +543,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
543543
|| !p.open
544544
|| p.proposalPassed // anyone trying to call us recursively?
545545
// Does the transaction code match the proposal?
546-
|| p.proposalHash != sha3(p.recipient, p.amount, _transactionData)) {
546+
|| p.proposalHash != keccak256(p.recipient, p.amount, _transactionData)) {
547547

548548
revert();
549549
}
@@ -851,12 +851,12 @@ contract DAO is DAOInterface, Token, TokenCreation {
851851
return false;
852852
}
853853

854-
function actualBalance() constant returns (uint _actualBalance) {
854+
function actualBalance() view returns (uint _actualBalance) {
855855
return this.balance - sumOfProposalDeposits;
856856
}
857857

858858

859-
function minQuorum(uint _value) internal constant returns (uint _minQuorum) {
859+
function minQuorum(uint _value) internal view returns (uint _minQuorum) {
860860
// minimum of 20% and maximum of 53.33%
861861
return totalSupply / minQuorumDivisor +
862862
(_value * totalSupply) / (3 * (actualBalance() + rewardToken[address(this)]));
@@ -892,12 +892,12 @@ contract DAO is DAOInterface, Token, TokenCreation {
892892
);
893893
}
894894

895-
function numberOfProposals() constant returns (uint _numberOfProposals) {
895+
function numberOfProposals() view returns (uint _numberOfProposals) {
896896
// Don't count index 0. It's used by isBlocked() and exists from start
897897
return proposals.length - 1;
898898
}
899899

900-
function getNewDAOAddress(uint _proposalID) constant returns (address _newDAO) {
900+
function getNewDAOAddress(uint _proposalID) view returns (address _newDAO) {
901901
return proposals[_proposalID].splitData[0].newDAO;
902902
}
903903

test/DAO/Token.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ contract TokenInterface {
4747

4848
/// @param _owner The address from which the balance will be retrieved
4949
/// @return The balance
50-
function balanceOf(address _owner) public constant returns (uint256 balance);
50+
function balanceOf(address _owner) public view returns (uint256 balance);
5151

5252
/// @notice Send `_amount` tokens to `_to` from `msg.sender`
5353
/// @param _to The address of the recipient
@@ -77,7 +77,7 @@ contract TokenInterface {
7777
function allowance(
7878
address _owner,
7979
address _spender
80-
) public constant returns (uint256 remaining);
80+
) public view returns (uint256 remaining);
8181

8282
event Transfer(address indexed _from, address indexed _to, uint256 _amount);
8383
event Approval(
@@ -96,7 +96,7 @@ contract Token is TokenInterface {
9696
// inadvertently also transferred ether
9797
modifier noEther() {if (msg.value > 0) revert(); _; }
9898

99-
function balanceOf(address _owner) public constant returns (uint256 balance) {
99+
function balanceOf(address _owner) public view returns (uint256 balance) {
100100
return balances[_owner];
101101
}
102102

@@ -146,7 +146,7 @@ contract Token is TokenInterface {
146146
return true;
147147
}
148148

149-
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
149+
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
150150
return allowed[_owner][_spender];
151151
}
152152
}

test/DAO/TokenCreation.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ contract TokenCreationInterface {
7373

7474
/// @return The divisor used to calculate the token creation rate during
7575
/// the creation phase
76-
function divisor() constant returns (uint divisor);
76+
function divisor() view returns (uint divisor);
7777

7878
event FuelingToDate(uint value);
7979
event CreatedToken(address indexed to, uint amount);
@@ -135,7 +135,7 @@ contract TokenCreation is TokenCreationInterface, Token {
135135
}
136136
}
137137

138-
function divisor() constant returns (uint divisor) {
138+
function divisor() view returns (uint divisor) {
139139
// The number of (base unit) tokens per wei is calculated
140140
// as `msg.value` * 20 / `divisor`
141141
// The fueling period starts with a 1:1 ratio

0 commit comments

Comments
 (0)