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

merge contracts #2

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
14 changes: 7 additions & 7 deletions packages/contracts/src/IVocdoniProposal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ pragma solidity ^0.8.17;
import {IDAO} from "@aragon/osx/core/dao/IDAO.sol";

/// @title IVocdoniProposal
/// @notice An interface to be implemented by DAO plugins that create and execute off-chain proposals.
/// @dev Slighly modified from the original Aragon OSx IProposal interface.
/// @notice An interface to be implemented by DAO plugins that create and execute gasless proposals.
/// @dev Slightly modified from the original Aragon OSx IProposal interface.
interface IVocdoniProposal {
/// @notice Emitted when a proposal is created.
/// @param proposalId The ID of the proposal.
/// @param vochainProposalId The ID of the proposal in the Vochain.
/// @param creator The creator of the proposal.
/// @param startDate The start date of the proposal in seconds.
/// @param endDate The end date of the proposal in seconds.
/// @param expirationDate The expiration date of the proposal in seconds.
/// @param voteEndDate The vote end date of the proposal in seconds.
/// @param tallyEndDate The tally end date of the proposal in seconds.
/// @param actions The actions that will be executed if the proposal passes.
/// @param allowFailureMap A bitmap allowing the proposal to succeed, even if individual actions might revert. If the bit at index `i` is 1, the proposal succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.
event ProposalCreated(
uint256 indexed proposalId,
bytes32 indexed vochainProposalId,
address indexed creator,
uint64 startDate,
uint64 endDate,
uint64 expirationDate,
uint64 voteEndDate,
uint64 tallyEndDate,
IDAO.Action[] actions,
uint256 allowFailureMap
);
Expand All @@ -35,4 +35,4 @@ interface IVocdoniProposal {
/// @notice Returns the proposal count determining the next proposal ID.
/// @return The proposal count.
function proposalCount() external view returns (uint256);
}
}
93 changes: 52 additions & 41 deletions packages/contracts/src/IVocdoniVoting.sol
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.17;

import {IDAO} from "@aragon/osx/core/dao/IDAO.sol";

/// @title IVocdoniVoting
/// @author Vocdoni
/// @notice The Vocdoni off-chain voting contract interface for the OSX plugin.
/// @notice The voting Proposal is managed off-chain on the Vocdoni blockchain.
/// @notice The Vocdoni gasless voting contract interface for the OSX plugin.
/// @notice The voting Proposal is managed gasless on the Vocdoni blockchain.
interface IVocdoniVoting {
/// @notice Emitted when one or more committee members are added.
/// @param newMembers The addresses of the new committee members.
event CommitteeMembersAdded(address[] indexed newMembers);
/// @notice Emitted when one or more execution multisig members are added.
/// @param newMembers The addresses of the new execution multisig members.
event ExecutionMultisigMembersAdded(address[] newMembers);

/// @notice Emitted when one or more committee member are removed.
/// @param removedMembers The addresses of the removed committee members.
event CommitteeMembersRemoved(address[] indexed removedMembers);
/// @notice Emitted when one or more execution multisig member are removed.
/// @param removedMembers The addresses of the removed execution multisig members.
event ExecutionMultisigMembersRemoved(address[] removedMembers);

/// @notice Emitted when the tally of a proposal is set.
/// @param proposalId The ID of the proposal.
Expand All @@ -25,7 +23,7 @@ interface IVocdoniVoting {
/// @param proposalId The ID of the proposal.
event TallyApproval(uint256 indexed proposalId, address indexed approver);

/// @notice Thrown if the address list length is out of bounds.
/// @notice Thrown if the address list length is out of bounds.
/// @param limit The limit value.
/// @param actual The actual value.
error AddresslistLengthOutOfBounds(uint16 limit, uint256 actual);
Expand All @@ -35,15 +33,15 @@ interface IVocdoniVoting {
/// @param actual The actual value.
error MinApprovalsOutOfBounds(uint16 limit, uint16 actual);

/// @notice Thrown if the minimal duration value is out of bounds (less than one hour or greater than 1 year).
/// @notice Thrown if the vote phase duration is out of bounds (more than 1 year or less than 1 hour).
/// @param limit The limit value.
/// @param actual The actual value.
error MinDurationOutOfBounds(uint64 limit, uint64 actual);
error VoteDurationOutOfBounds(uint64 limit, uint64 actual);

/// @notice Trown if the maximum proposal expiration time is out of bounds (more than 1 year).
/// @notice Trown if the tally phase duration is out of bounds (more than 1 year or less than 1 hour).
/// @param limit The limit value.
/// @param actual The actual value.
error ExpirationTimeOutOfBounds(uint64 limit, uint64 actual);
error TallyDurationOutOfBounds(uint64 limit, uint64 actual);

/// @notice Thrown if the start date is invalid.
/// @param limit The limit value.
Expand All @@ -53,20 +51,20 @@ interface IVocdoniVoting {
/// @notice Thrown if the end date is invalid.
/// @param limit The limit value.
/// @param actual The actual value.
error InvalidEndDate(uint64 limit, uint64 actual);
error InvalidVoteEndDate(uint64 limit, uint64 actual);

/// @notice Thrown if the expiration date is invalid.
/// @param limit The expiration date.
/// @notice Thrown if the tally end date is invalid.
/// @param limit The tally end date.
/// @param actual The actual value.
error InvalidExpirationDate(uint64 limit, uint64 actual);
error InvalidTallyEndDate(uint64 limit, uint64 actual);

/// @notice Thrown if the plugin settings are updated too recently.
/// @param lastUpdate The block number of the last update.
error PluginSettingsUpdatedTooRecently(uint64 lastUpdate);

/// @notice Thrown if the committee is updated too recently.
/// @notice Thrown if the execution multisig is updated too recently.
/// @param lastUpdate The block number of the last update.
error CommitteeUpdatedTooRecently(uint64 lastUpdate);
error ExecutionMultisigUpdatedTooRecently(uint64 lastUpdate);

/// @notice Thrown if the proposal is already executed.
/// @param proposalId The ID of the proposal.
Expand All @@ -85,7 +83,7 @@ interface IVocdoniVoting {
/// @param sender The sender.
error TallyAlreadyApprovedBySender(address sender);

/// @notice Thrown if the proposal tally is not approved by enough committee members.
/// @notice Thrown if the proposal tally is not approved by enough execution multisig members.
/// @param minApprovals The minimum number of approvals required.
/// @param actualApprovals The actual number of approvals.
error NotEnoughApprovals(uint16 minApprovals, uint16 actualApprovals);
Expand All @@ -94,42 +92,54 @@ interface IVocdoniVoting {
/// @param addr The address
error InvalidAddress(address addr);

/// @notice Thrown if the prosal is not in the tally phase
/// @param endDate The end date of the proposal
/// @param expirationDate The expiration date of the proposal
/// @notice Thrown if the proposal is not in the tally phase
/// @param voteEndDate The end date of the proposal
/// @param tallyEndDate The tally end date of the proposal
/// @param currentTimestamp The current timestamp
error ProposalNotInTallyPhase(uint64 endDate, uint64 expirationDate, uint256 currentTimestamp);
error ProposalNotInTallyPhase(
uint64 voteEndDate,
uint64 tallyEndDate,
uint256 currentTimestamp
);

/// @notice Thrown if the msg.sender does not have enough voting power
/// @param required The required voting power
error NotEnoughVotingPower(uint256 required);

/// @notice Thrown if the msg.sender is not a committee member
/// @notice Thrown if the msg.sender is not a execution multisig member
/// @param sender The sender
error OnlyCommittee(address sender);
error OnlyExecutionMultisig(address sender);

/// @notice Thrown if the support threshold is not reached
/// @param currentSupport The current support
/// @param supportThreshold The support threshold
error SupportThresholdNotReached(uint256 currentSupport, uint32 supportThreshold);

/// @notice Thrown if the minimum participation is not reached
/// @param currentParticipation The current participation
/// @param minParticipation The minimum participation
error MinParticipationNotReached(uint256 currentParticipation,uint32 minParticipation);
/// @param currentVotingPower The current voting power
/// @param minVotingPower The minimum voting power to reach
error MinParticipationNotReached(uint256 currentVotingPower, uint256 minVotingPower);

/// @notice Thrown if the total voting power is invalid
/// @param totalVotingPower The total voting power
error InvalidTotalVotingPower(uint256 totalVotingPower);

/// @notice Thrown if invalid list length
/// @param length The actual length
error InvalidListLength(uint256 length);

/// @notice Adds new committee members.
/// @param _members The addresses of the new committee members.
function addCommitteeMembers(address[] calldata _members) external;
/// @notice Adds new execution multisig members.
/// @param _members The addresses of the new execution multisig members.
function addExecutionMultisigMembers(address[] calldata _members) external;

/// @notice Removes committee members.
/// @param _members The addresses of the committee members to remove.
function removeCommitteeMembers(address[] calldata _members) external;
/// @notice Removes execution multisig members.
/// @param _members The addresses of the execution multisig members to remove.
function removeExecutionMultisigMembers(address[] calldata _members) external;

/// @notice Returns whether an address is a committee member.
/// @notice Returns whether an address is a execution ultisig member.
/// @param _member The address to check.
/// @return Whether the address is a committee member.
function isCommitteeMember(address _member) external view returns (bool);
/// @return Whether the address is a execution multisig member.
function isExecutionMultisigMember(address _member) external view returns (bool);

/// @notice Sets the tally of a given proposal.
/// @param _proposalId The ID of the proposal to set the tally of.
Expand All @@ -138,9 +148,10 @@ interface IVocdoniVoting {

/// @notice Approves a proposal tally.
/// @param _proposalId The ID of the proposal to approve.
/// @param _tryExecution Whether to try to execute the proposal if the tally is approved.
function approveTally(uint256 _proposalId, bool _tryExecution) external;

/// @notice Executes a proposal.
/// @param _proposalId The ID of the proposal to execute.
function executeProposal(uint256 _proposalId) external;
}
}
8 changes: 5 additions & 3 deletions packages/contracts/src/VocdoniProposalUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IVocdoniProposal} from "./IVocdoniProposal.sol";
import {IDAO} from "@aragon/osx/core/dao/IDAO.sol";

/// @title VocdoniProposalUpgradeable
/// @notice An abstract contract containing the traits and internal functionality to create and execute off-chain proposals that can be inherited by upgradeable DAO plugins.
/// @notice An abstract contract containing the traits and internal functionality to create and execute gasless proposals that can be inherited by upgradeable DAO plugins.
/// @dev Slighly modified from the original Aragon OSx ProposalUpgradeable contract.
abstract contract VocdoniProposalUpgradeable is IVocdoniProposal, ERC165Upgradeable {
using CountersUpgradeable for CountersUpgradeable.Counter;
Expand All @@ -25,7 +25,9 @@ abstract contract VocdoniProposalUpgradeable is IVocdoniProposal, ERC165Upgradea
/// @param _interfaceId The ID of the interface.
/// @return Returns `true` if the interface is supported.
function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {
return _interfaceId == type(IVocdoniProposal).interfaceId || super.supportsInterface(_interfaceId);
return
_interfaceId == type(IVocdoniProposal).interfaceId ||
super.supportsInterface(_interfaceId);
}

/// @notice Creates a proposal ID.
Expand Down Expand Up @@ -53,4 +55,4 @@ abstract contract VocdoniProposalUpgradeable is IVocdoniProposal, ERC165Upgradea

/// @notice This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain (see [OpenZeppelin's guide about storage gaps](https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps)).
uint256[49] private __gap;
}
}
Loading
Loading