From 212f60d5f1bd3d4c98b7f42e97c2318cf220d293 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Fri, 30 Mar 2018 02:31:08 -0300 Subject: [PATCH] updated to new solidity keywords and linting --- contracts/democracy/DelegationProxy.sol | 20 +++++++++---------- .../democracy/DelegationProxyInterface.sol | 18 ++++++++--------- contracts/democracy/DelegationProxyView.sol | 2 +- contracts/democracy/Democracy.sol | 2 ++ contracts/democracy/DemocracyInterface.sol | 2 +- contracts/democracy/DemocracyStorage.sol | 2 +- contracts/democracy/ProposalManager.sol | 4 ++-- .../democracy/ProposalManagerInterface.sol | 2 +- contracts/democracy/TrustNetwork.sol | 2 +- contracts/democracy/TrustNetworkInterface.sol | 2 +- 10 files changed, 29 insertions(+), 27 deletions(-) diff --git a/contracts/democracy/DelegationProxy.sol b/contracts/democracy/DelegationProxy.sol index b50ecfb..fd7d094 100644 --- a/contracts/democracy/DelegationProxy.sol +++ b/contracts/democracy/DelegationProxy.sol @@ -39,7 +39,7 @@ contract DelegationProxy is DelegationProxyInterface { */ function delegatedTo(address _who) public - constant + view returns (address) { return delegatedToAt(_who, block.number); @@ -52,7 +52,7 @@ contract DelegationProxy is DelegationProxyInterface { */ function delegationOf(address _who) public - constant + view returns(address) { return delegationOfAt(_who, block.number); @@ -69,7 +69,7 @@ contract DelegationProxy is DelegationProxyInterface { MiniMeTokenInterface _token ) public - constant + view returns(uint256 _total) { return influenceOfAt(_who, _token, block.number); @@ -86,7 +86,7 @@ contract DelegationProxy is DelegationProxyInterface { address _token ) public - constant + view returns(uint256 _total) { return delegatedInfluenceFromAt(_who, _token, block.number, address(this)); @@ -105,7 +105,7 @@ contract DelegationProxy is DelegationProxyInterface { uint _block ) public - constant + view returns(uint256 _total) { return delegatedInfluenceFromAt(_who, _token, _block, address(this)); @@ -123,7 +123,7 @@ contract DelegationProxy is DelegationProxyInterface { uint _block ) public - constant + view returns (address directDelegate) { Delegation[] storage checkpoints = delegations[_who]; @@ -155,7 +155,7 @@ contract DelegationProxy is DelegationProxyInterface { uint _block ) public - constant + view returns(address finalDelegate) { finalDelegate = delegatedToAt(_who, _block); @@ -182,7 +182,7 @@ contract DelegationProxy is DelegationProxyInterface { address _childProxy ) public - constant + view returns(uint256 _total) { Delegation[] storage checkpoints = delegations[_who]; @@ -238,7 +238,7 @@ contract DelegationProxy is DelegationProxyInterface { uint _block ) public - constant + view returns(uint256 _total) { if (delegationOfAt(_who, _block) == _who) { //is endpoint of delegation? @@ -286,7 +286,7 @@ contract DelegationProxy is DelegationProxyInterface { * @param _block The block number to retrieve the value at. * @return The delegation being queried. */ - function _getMemoryAt(Delegation[] storage checkpoints, uint _block) internal constant returns (Delegation d) { + function _getMemoryAt(Delegation[] storage checkpoints, uint _block) internal view returns (Delegation d) { // Case last checkpoint is the one; if (_block >= checkpoints[checkpoints.length-1].fromBlock) { d = checkpoints[checkpoints.length-1]; diff --git a/contracts/democracy/DelegationProxyInterface.sol b/contracts/democracy/DelegationProxyInterface.sol index e7d1252..2d43997 100644 --- a/contracts/democracy/DelegationProxyInterface.sol +++ b/contracts/democracy/DelegationProxyInterface.sol @@ -34,7 +34,7 @@ contract DelegationProxyInterface { */ function delegatedTo(address _who) public - constant + view returns (address directDelegate); /** @@ -44,7 +44,7 @@ contract DelegationProxyInterface { */ function delegationOf(address _who) public - constant + view returns(address finalDelegate); /** @@ -58,7 +58,7 @@ contract DelegationProxyInterface { MiniMeTokenInterface _token ) public - constant + view returns(uint256 _total); /** @@ -72,7 +72,7 @@ contract DelegationProxyInterface { address _token ) public - constant + view returns(uint256 _total); /** @@ -88,7 +88,7 @@ contract DelegationProxyInterface { uint _block ) public - constant + view returns(uint256 _total); /** @@ -103,7 +103,7 @@ contract DelegationProxyInterface { uint _block ) public - constant + view returns (address directDelegate); /** @@ -117,7 +117,7 @@ contract DelegationProxyInterface { uint _block ) public - constant + view returns(address finalDelegate); /** @@ -135,7 +135,7 @@ contract DelegationProxyInterface { address _childProxy ) public - constant + view returns(uint256 _total); /** @@ -151,7 +151,7 @@ contract DelegationProxyInterface { uint _block ) public - constant + view returns(uint256 _total); diff --git a/contracts/democracy/DelegationProxyView.sol b/contracts/democracy/DelegationProxyView.sol index a230511..20936a8 100644 --- a/contracts/democracy/DelegationProxyView.sol +++ b/contracts/democracy/DelegationProxyView.sol @@ -29,7 +29,7 @@ contract DelegationProxyView is DelegationProxy { uint _block ) public - constant + view returns(address finalDelegate) { bytes32 searchIndex = keccak256(_who, _block); diff --git a/contracts/democracy/Democracy.sol b/contracts/democracy/Democracy.sol index acc347c..cf7e290 100644 --- a/contracts/democracy/Democracy.sol +++ b/contracts/democracy/Democracy.sol @@ -1,8 +1,10 @@ pragma solidity ^0.4.21; + import "./DemocracyInterface.sol"; import "./ProposalManager.sol"; import "./FeeRecycler.sol"; + contract Democracy is DemocracyInterface { mapping (bytes32 => Allowance) topicAllowance; diff --git a/contracts/democracy/DemocracyInterface.sol b/contracts/democracy/DemocracyInterface.sol index 070f3d6..0cbd457 100644 --- a/contracts/democracy/DemocracyInterface.sol +++ b/contracts/democracy/DemocracyInterface.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.17; +pragma solidity ^0.4.21; import "./DemocracyStorage.sol"; diff --git a/contracts/democracy/DemocracyStorage.sol b/contracts/democracy/DemocracyStorage.sol index 58c7d62..9e13a8f 100644 --- a/contracts/democracy/DemocracyStorage.sol +++ b/contracts/democracy/DemocracyStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.17; +pragma solidity ^0.4.21; import "../deploy/InstanceStorage.sol"; import "../token/MiniMeTokenInterface.sol"; diff --git a/contracts/democracy/ProposalManager.sol b/contracts/democracy/ProposalManager.sol index a3a3d29..904f2aa 100644 --- a/contracts/democracy/ProposalManager.sol +++ b/contracts/democracy/ProposalManager.sol @@ -79,7 +79,7 @@ contract ProposalManager is ProposalManagerInterface, Controlled { function getProposal(uint _proposalId) public - constant + view returns ( bytes32 topic, bytes32 txHash, @@ -92,7 +92,7 @@ contract ProposalManager is ProposalManagerInterface, Controlled { function getProposalTxHash(uint _proposalId) public - constant + view returns(bytes32) { return proposals[_proposalId].txHash; diff --git a/contracts/democracy/ProposalManagerInterface.sol b/contracts/democracy/ProposalManagerInterface.sol index ce17361..4e4ff7e 100644 --- a/contracts/democracy/ProposalManagerInterface.sol +++ b/contracts/democracy/ProposalManagerInterface.sol @@ -50,7 +50,7 @@ contract ProposalManagerInterface { event ProposalResult(uint256 _proposalId, Vote finalResult); function addProposal(bytes32 _topic, bytes32 _txHash, uint _visibilityFee) public returns (uint); - function getProposal(uint _id) public constant returns (bytes32 topic, bytes32 txHash, bool approved); + function getProposal(uint _id) public view returns (bytes32 topic, bytes32 txHash, bool approved); function voteProposal(uint _proposal, Vote _vote) public; function tabulateVote(uint _proposal, address _delegator) public; function tabulateVeto(uint _proposal, address _delegator) public; diff --git a/contracts/democracy/TrustNetwork.sol b/contracts/democracy/TrustNetwork.sol index 8b73ca0..7634e21 100644 --- a/contracts/democracy/TrustNetwork.sol +++ b/contracts/democracy/TrustNetwork.sol @@ -40,7 +40,7 @@ contract TrustNetwork is TrustNetworkInterface, Controlled { topics[topicId] = newTopic(vote, veto); } - function getTopic(bytes32 _topicId) public constant returns (DelegationProxyInterface vote, DelegationProxyInterface veto) { + function getTopic(bytes32 _topicId) public view returns (DelegationProxyInterface vote, DelegationProxyInterface veto) { Topic memory topic = topics[_topicId]; vote = topic.voteDelegation; veto = topic.vetoDelegation; diff --git a/contracts/democracy/TrustNetworkInterface.sol b/contracts/democracy/TrustNetworkInterface.sol index 004c1ce..773d96b 100644 --- a/contracts/democracy/TrustNetworkInterface.sol +++ b/contracts/democracy/TrustNetworkInterface.sol @@ -5,7 +5,7 @@ import "./DelegationProxyInterface.sol"; contract TrustNetworkInterface { function addTopic(bytes32 topicId, bytes32 parentTopic) public; - function getTopic(bytes32 _topicId) public constant returns (DelegationProxyInterface vote, DelegationProxyInterface veto); + function getTopic(bytes32 _topicId) public view returns (DelegationProxyInterface vote, DelegationProxyInterface veto); function getVoteDelegation(bytes32 _topicId) public view returns (DelegationProxyInterface voteDelegation); function getVetoDelegation(bytes32 _topicId) public view returns (DelegationProxyInterface vetoDelegation); } \ No newline at end of file