Skip to content

Commit

Permalink
chore: add IMembership and IProposal descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
josemarinas committed Jun 3, 2024
1 parent 1d77116 commit c15b236
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ title: Proposals

## The `IProposal` Interface

:::note
This page is a stub and work in progress
:::
The `IProposal` interface is used to create and execute proposals containing actions and a description.

Create and execute proposals containing actions and a description.

### Interface `IProposal`
The interface is defined as follows:

```solidity
interface IProposal {
Expand Down Expand Up @@ -41,3 +37,61 @@ interface IProposal {
function proposalCount() external view returns (uint256);
}
```

Thi interface contains two events and one function

### `ProposalCreated` event

This event should be emmited when a proposal is created. It contains the following parameters:

- `proposalId`: The ID of the proposal.
- `creator`: The creator of the proposal.
- `startDate`: The start block number of the proposal.
- `endDate`: The end block number of the proposal.
- `metadata`: This should contain an metadata ipfs hash or any other type of link to the metadata of the proposal.
- `actions`: The actions that will be executed if the proposal passes.
- `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.

### `ProposalExecuted` event

This event should be emmited when a proposal is executed. It contains the proposal ID as a parameter.

### `proposalCount` function

This function should return the proposal count determining the next proposal ID.

## Usage

```solidity
contract MyPlugin is IProposal {
uint256 public proposalCount;
function createProposal(
uint64 _startDate,
uint64 _endDate,
bytes calldata _metadata,
IDAO.Action[] calldata _actions,
uint256 _allowFailureMap
) external {
proposalCount++;
emit ProposalCreated(
proposalCount,
msg.sender,
_startDate,
_endDate,
_metadata,
_actions,
_allowFailureMap
);
}
function proposalCount() external view returns (uint256) {
return proposalCount;
}
function executeProposal(uint256 _proposalId) external {
// Execute the proposal
emit ProposalExecuted(_proposalId);
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ title: Membership

## The `IMembership` Interface

:::note
This page is a stub and work in progress
:::

Introduce members to the DAO upon installation through [the `IMembership` interface](./02-membership.md).

### Interface IMembership
The IMembership interface is used to define the notion of membership to the DAO.This interface is implemented by DAO plugins that define either by having a list of members or by having a contract that defines the membership.
The interface is defined as follows:

```solidity title=
/// @notice An interface to be implemented by DAO plugins that define membership.
Expand All @@ -35,10 +30,56 @@ interface IMembership {
}
```

### Introducing Members directly
The interface contains three events and one function.

### `MembersAdded` event

The members added event should be emitted when members are added to the DAO plugin. It only contains one `address[] members` parameter that references the list of new members being added.

- `members`: The list of new members being added.

### `MembersRemoved` event

The members added event should be emitted when members are removed from the DAO plugin. It only contains one `address[] members` parameter that references the list of members being removed.

### `MembershipContractAnnounced` event

This event should be emmited during the initialization of the membership plugin to announce the membership being defined by a contract. It contains the defining contract as a parameter.

### `isMember` function

This is a simple function that should be implemented in the plugin contract that introduces the members to the DAO. It checks if an account is a member of the DAO and returns a boolean value.

## Usage

```solidity
event MembersAdded(address[] members)
event MembersRemoved(address[] members)
```
contract MyPlugin is IMembership {
address public membershipContract;
constructor(address tokenAddress) {
// Initialize the membership contract
// ...
membershipContract = tokenAddress;
emit MembershipContractAnnounced(tokenAddress);
}
function isMember(address _account) external view returns (bool) {
// Check if the account is a member of the DAO
// ...
}
// Other plugin functions
function addMembers(address[] memory _members) external {
// Add members to the DAO
// ...
emit MembersAdded(_members);
}
function removeMembers(address[] memory _members) external {
// Remove members from the DAO
// ...
emit MembersRemoved(_members);
}
}

0 comments on commit c15b236

Please sign in to comment.