Skip to content

Commit

Permalink
f: added new way to query proposal ids
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaniza committed Jun 14, 2024
1 parent 013a81c commit 30de301
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion packages/contracts/src/TokenVoting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ contract TokenVoting is
mapping(uint256 => Proposal) internal proposals;

/// @dev TODO: added during offsite to allow aragonette to fetch via incrementing proposal IDs
uint256[] public proposalIdsByCount;
uint256[] private proposalIdsByCount;

/// @notice The struct storing the voting settings.
VotingSettings private votingSettings;
Expand Down Expand Up @@ -630,6 +630,26 @@ contract TokenVoting is
allowFailureMap = proposal_.allowFailureMap;
}

/// @dev TODO Added to keep API same when querying by autoincrementing counter
function getProposalByIndex(
uint _idx

Check warning on line 635 in packages/contracts/src/TokenVoting.sol

View workflow job for this annotation

GitHub Actions / checks

Rule is set with explicit type [var/s: uint]

Check warning on line 635 in packages/contracts/src/TokenVoting.sol

View workflow job for this annotation

GitHub Actions / formatting-linting / checks

Rule is set with explicit type [var/s: uint]

Check warning on line 635 in packages/contracts/src/TokenVoting.sol

View workflow job for this annotation

GitHub Actions / formatting-linting / checks

Rule is set with explicit type [var/s: uint]
)
public
view
virtual
returns (
bool open,
bool executed,
ProposalParameters memory parameters,
Tally memory tally,
IDAO.Action[] memory actions,
uint256 allowFailureMap
)
{
uint proposalId = proposalIdsByCount[_idx];

Check warning on line 649 in packages/contracts/src/TokenVoting.sol

View workflow job for this annotation

GitHub Actions / checks

Rule is set with explicit type [var/s: uint]

Check warning on line 649 in packages/contracts/src/TokenVoting.sol

View workflow job for this annotation

GitHub Actions / formatting-linting / checks

Rule is set with explicit type [var/s: uint]

Check warning on line 649 in packages/contracts/src/TokenVoting.sol

View workflow job for this annotation

GitHub Actions / formatting-linting / checks

Rule is set with explicit type [var/s: uint]
return getProposal(proposalId);
}

/// @inheritdoc ITokenVoting
function isSupportThresholdReached(uint256 _proposalId) public view virtual returns (bool) {
Proposal storage proposal_ = proposals[_proposalId];
Expand Down

0 comments on commit 30de301

Please sign in to comment.