[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: feat/add multivote to contracts #111

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: add multivote contract and byte code
  • Loading branch information
seanmc9 committed Oct 7, 2022
commit 79072b212e603bcca0418dd5057557379444194f
13 changes: 13 additions & 0 deletions packages/hardhat/contracts/governance/Governor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,19 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
emit ContestCanceled();
}

/**
* @dev See {IGovernor-castMultiVote}.
*/
function castMultiVote(uint256[] memory proposalIds, uint8[] memory supportInputs, uint256[] memory numVotes) public virtual override returns (uint256 balance) {
address voter = _msgSender();
for(uint i=0; i<proposalIds.length; i++){
if (i == proposalIds.length - 1) {
return _castVote(proposalIds[i], voter, supportInputs[i], numVotes[i], "");
}
_castVote(proposalIds[i], voter, supportInputs[i], numVotes[i], "");
}
}

/**
* @dev See {IGovernor-castVote}.
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/hardhat/contracts/governance/IGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ abstract contract IGovernor is IERC165 {
string memory proposalDescription
) public virtual returns (uint256 proposalId);

/**
* @dev Cast multivote
*
*/
function castMultiVote(uint256[] memory proposalIds, uint8[] memory supportInputs, uint256[] memory numVotes) public virtual returns (uint256 balance);

/**
* @dev Cast a vote
*
Expand Down
Loading