Skip to content

Commit

Permalink
fix: add missing natspec docs
Browse files Browse the repository at this point in the history
Fix LOW-8 from MixBytes Voting V2 audit
  • Loading branch information
folkyatina committed Jun 28, 2022
1 parent da73dde commit 28e02f8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions apps/voting/contracts/Voting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,19 @@ contract Voting is IForwarder, AragonApp {
* @notice Tells whether a vote #`_voteId` can be executed or not
* @dev Initialization check is implicitly provided by `voteExists()` as new votes can only be
* created via `newVote(),` which requires initialization
* @param _voteId Vote identifier
* @return True if the given vote can be executed, false otherwise
*/
function canExecute(uint256 _voteId) public view voteExists(_voteId) returns (bool) {
return _canExecute(_voteId);
}

/**
* @notice Tells whether `_sender` can participate in the main phase of the vote #`_voteId`
* @notice Tells whether `_voter` can participate in the main phase of the vote #`_voteId`
* @dev Initialization check is implicitly provided by `voteExists()` as new votes can only be
* created via `newVote(),` which requires initialization
* @param _voteId Vote identifier
* @param _voter address of the voter to check
* @return True if the given voter can participate in the main phase of a certain vote, false otherwise
*/
function canVote(uint256 _voteId, address _voter) external view voteExists(_voteId) returns (bool) {
Expand All @@ -262,6 +265,8 @@ contract Voting is IForwarder, AragonApp {
* @notice Tells whether `_sender` can participate in the objection phase of the vote #`_voteId`
* @dev Initialization check is implicitly provided by `voteExists()` as new votes can only be
* created via `newVote(),` which requires initialization
* @param _voteId Vote identifier
* @param _voter address of the voter to check
* @return True if the given voter can participate in the objection phase of a certain vote, false otherwise
*/
function canObject(uint256 _voteId, address _voter) external view voteExists(_voteId) returns (bool) {
Expand Down Expand Up @@ -319,6 +324,7 @@ contract Voting is IForwarder, AragonApp {
/**
* @dev Return the state of a voter for a given vote by its ID
* @param _voteId Vote identifier
* @param _voter address of the voter
* @return VoterState of the requested voter for a certain vote
*/
function getVoterState(uint256 _voteId, address _voter) public view voteExists(_voteId) returns (VoterState) {
Expand Down Expand Up @@ -424,7 +430,7 @@ contract Voting is IForwarder, AragonApp {
return false;
}

// Objection time ended?
// One can cast at least 'no' vote
if (_isVoteOpenForObjection(vote_)) {
return false;
}
Expand Down Expand Up @@ -462,15 +468,15 @@ contract Voting is IForwarder, AragonApp {
}

/**
* @dev Internal function to check if a vote is still open
* @dev Internal function to check if a vote is still open for both support and objection
* @return True if less than voteTime has passed since the vote start
*/
function _isVoteOpen(Vote storage vote_) internal view returns (bool) {
return getTimestamp64() < vote_.startDate.add(voteTime) && !vote_.executed;
}

/**
* @dev Internal function to check if a vote is still possible to object
* @dev Internal function to check if a vote is still open for objection
* @return True if less than voteTime + objectionTime has passed since the vote start
*/
function _isVoteOpenForObjection(Vote storage vote_) internal view returns (bool) {
Expand Down

0 comments on commit 28e02f8

Please sign in to comment.