From 628a023fc62b5c85225531c30da9df47ebaf8be2 Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Tue, 20 Oct 2020 23:31:09 -0700 Subject: [PATCH] fix bugs --- contracts/GovernanceAggregator.sol | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/contracts/GovernanceAggregator.sol b/contracts/GovernanceAggregator.sol index 83e6cf9..c8af3f7 100644 --- a/contracts/GovernanceAggregator.sol +++ b/contracts/GovernanceAggregator.sol @@ -18,16 +18,10 @@ contract GovernanceAggregator { Governance.ProposalState state; } - function getAllProposals( - Governance governance, - uint256 from, - uint256 to - ) public view returns (Proposal[] memory proposals) { - uint256 proposalCount = governance.proposalCount(); - to = to == 0 ? proposalCount : to; - proposals = new Proposal[](proposalCount); + function getAllProposals(Governance governance) public view returns (Proposal[] memory proposals) { + proposals = new Proposal[](governance.proposalCount()); - for (from; from < to; from++) { + for (uint256 i = 0; i < proposals.length; i++) { ( address proposer, address target, @@ -37,9 +31,9 @@ contract GovernanceAggregator { uint256 againstVotes, bool executed, bool extended - ) = governance.proposals(from); + ) = governance.proposals(i + 1); - proposals[from] = Proposal({ + proposals[i] = Proposal({ proposer: proposer, target: target, startTime: startTime, @@ -48,7 +42,7 @@ contract GovernanceAggregator { againstVotes: againstVotes, executed: executed, extended: extended, - state: governance.state(from) + state: governance.state(i + 1) }); } }