-
Notifications
You must be signed in to change notification settings - Fork 13
chore: Add DAO Docs to new docuemntation structure #184
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1e9a83a
chore: add DAO docs
josemarinas e1b8e2f
Update docs/advanced/dao/00-introduction.md
josemarinas e7ca6a4
Update docs/advanced/dao/00-introduction.md
josemarinas 80207f3
chore: add info about DAO creation events
josemarinas 840317b
chore: add dao creation schema
josemarinas 635dfc8
fix: remove broken links and add todo comment to remember updating th…
clauBv23 7525ce5
Merge branch 'staging' into dao-docs-fix
clauBv23 9ac0002
fix links on dao creation page and add todo note for remembering fixi…
clauBv23 12c7c11
feat: beautify table, marking the function's names and constant ids a…
clauBv23 77ee5d6
Merge branch 'staging' into f/add-dao-docs
clauBv23 db2e53a
Merge branch 'f/add-dao-docs' into dao-docs-fix
clauBv23 3fe6016
fix broken links
clauBv23 88a8d59
fix: reference optimised img
clauBv23 d910a59
fix: rephrase
clauBv23 43e540a
Merge pull request #192 from aragon/dao-docs-fix
clauBv23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
title: Introduction | ||
sidebar_label: Introduction | ||
sidebar_position: 0 | ||
--- | ||
|
||
## The DAO Contract: The Identity and Basis of Your Organization | ||
|
||
In this section, you will learn about the core functionality of every Aragon OSx DAO. | ||
|
||
The `DAO` contract is the identity and basis of your | ||
organization. It is the address carrying the DAO’s ENS name, metadata, | ||
and holding the funds. Furthermore, it has **six base functionalities** being commonly found in other DAO frameworks in the ecosystem. | ||
|
||
### 1. Execution of Arbitrary Actions | ||
|
||
The most important and basic functionality of your DAO is the **execution of arbitrary actions**, | ||
which allows you to execute the DAO's own functions as well as | ||
interacting with the rest of the world, i.e., calling methods in other | ||
contracts and sending assets to other addresses. | ||
|
||
:::note | ||
|
||
Typically, actions are scheduled in a proposal in a governance [plugin installed to your DAO](/docs/advanced/plugin/index.md). | ||
::: | ||
|
||
Multiple `Action` structs can be put into one `Action[]` array and executed in a single transaction via the `execute` function. To learn more about actions and advanced features of the DAO executor, visit the [A Deep Dive Into Actions](/docs/1.4.0/osx/how-it-works/core/dao/actions) section. | ||
|
||
### 2. Asset Management | ||
|
||
The DAO provides basic **asset management** functionality to deposit, withdraw, and keep track of | ||
|
||
- native | ||
- [ERC-20 (Token Standard)](https://eips.ethereum.org/EIPS/eip-20), | ||
- [ERC-721 (NFT Standard)](https://eips.ethereum.org/EIPS/eip-721), and | ||
- [ERC-1155 (Multi Token Standard)](https://eips.ethereum.org/EIPS/eip-1155) | ||
|
||
tokens in the treasury. | ||
In the future, more advanced asset management and finance functionality can be added to your DAO in the form of [plugins](/docs/1.4.0/osx/how-it-works/core/plugins/). | ||
|
||
### 3. Upgradeability | ||
|
||
Your DAO contract has the ability to be upgraded to a newer version (see [Upgrade your DAO](/docs/1.4.0/osx/how-to-guides/dao/protocol-upgrades)) | ||
if a new version of Aragon OSx is released in the future. These | ||
upgrades allow your DAO to smoothly transition to a new protocol version | ||
unlocking new features. | ||
|
||
### 4. Callback Handling | ||
|
||
To interact with the DAO, external contracts might require certain callback functions to be present. | ||
Examples are the `onERC721Received` and `onERC1155Received` / `onERC1155BatchReceived` functions required by the [ERC-721 (NFT Standard)](https://eips.ethereum.org/EIPS/eip-721) and [ERC-1155 (Multi Token Standard)](https://eips.ethereum.org/EIPS/eip-1155) tokens. | ||
Our `CallbackHandler` allows to register the required callback responses dynamically so that the DAO contract does not need to be upgraded. | ||
|
||
### 5. Signature Validation | ||
|
||
Currently, | ||
externally owned accounts (EOAs) can sign messages with their | ||
associated private keys, but contracts cannot. | ||
An exemplary use case is a decentralized exchange with an off-chain | ||
order book, where buy/sell orders are signed messages. | ||
To accept such a request, both, the external service provider and caller | ||
need to follow a standard with which the signed message of the caller | ||
can be validated. | ||
|
||
By supporting the [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) standard, your DAO can validate signatures via its `isValidSignature` function that forwards the call to a signature validator contract. | ||
|
||
### 6. Permission Management | ||
|
||
Lastly, | ||
it is essential that only the right entities (e.g., the DAO itself or | ||
trusted addresses) have permission to use the above-mentioned | ||
functionalities. This is why Aragon OSx DAOs contain a flexible and | ||
battle-tested **permission manager** being able to assign | ||
permissions for the above functionalities to specific addresses. | ||
Although possible, the permissions to execute arbitrary actions or | ||
upgrade the DAO should not be given to EOAs as this poses a security | ||
risk to the organization if the account is compromised or acts | ||
adversarial. Instead, the permissions for the above-mentioned | ||
functionalities are better restricted to the `DAO` contract itself and triggered through governance [plugins](/docs/1.4.0/osx/how-it-works/core/plugins/) that you can install on your DAO. | ||
|
||
To learn more, visit the [permission manager](/docs/1.4.0/osx/how-it-works/core/permissions/) section. |
clauBv23 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
title: Creation | ||
sidebar_label: Creation | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Dao Creation | ||
|
||
Two framework contracts manage the `DAO` contract creation process: | ||
|
||
- The [`DAOFactory`](docs/osx/reference-guide/framework/dao/DAOFactory). | ||
- The [`DAORegistry`](docs/osx/reference-guide/framework/dao/DAORegistry). | ||
|
||
The `DAOFactory` is the contract that creates and sets up a `DAO` for you. The `DAORegistry` is used by the `DAOFactory` to register the DAOs that are created. Plugins are installed in the DAO by the `PluginSetupProcessor`. | ||
|
||
 | ||
clauBv23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## `DAOFactory` | ||
|
||
The `DAOFactory` creates and sets up a `DAO` for you in four steps with the `createDao` function. The function requires the `DAOSettings` including: | ||
|
||
- The trusted forwarder address for future [ERC-2771 (Meta Transaction)](https://eips.ethereum.org/EIPS/eip-2771) compatibility that is set to `address(0)` for now | ||
- The ENS name (to be registered under the `dao.eth` domain) | ||
- The [ERC-4824 (Common Interfaces for DAOs)](https://eips.ethereum.org/EIPS/eip-4824) `daoURI` | ||
- Optional metadata | ||
|
||
The DAO also requires an array of `PluginSettings` containing `PluginSetup` and its respective setup data for the plugins to be installed in the DAO. | ||
|
||
When the `createDao` function is called in the `DAOFactory` this triggers a four step process for creating a DAO: | ||
|
||
1. Creates a new DAO by deploying an [ERC-1967](https://eips.ethereum.org/EIPS/eip-1967) proxy pointing to the latest Aragon OSx `DAO` implementation and becomes the initial owner. | ||
2. Registers the new contract in the [`DAORegistry`](docs/osx/how-it-works/framework/dao-creation/#daoregistry). | ||
3. Installs the plugins using the `PluginSetupProcessor` (see also the section about [the plugin setup process](docs/osx/how-it-works/framework/plugin-management/plugin-setup/)). | ||
4. Sets the [native permissions](docs/osx/how-it-works/core/permissions/#permissions-native-to-the-dao-contract) of the `DAO` and revokes its own ownership. | ||
|
||
### Plugins | ||
|
||
When calling `createDao` an array of `PluginSettings` are requested. A DAO cannot be created without at least one plugin. The DAO contract works as a permission manager system but it is agnostic to the type of governance that you want to use to manage the DAO. We currently provide two plugins that can be used for governing your DAO: | ||
|
||
- [`Multisig`](https://link-to-more-info/) | ||
- [`TokenVoting`](https://link-to-more-info/) | ||
clauBv23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
If none of this options meet your requirements you can also build your own governance plugin, check our tutorial on ["How to build a plugin?"](https://www.notion.so/Docs-9b7b0c1fdf894cdeb6413dcd255a8896?pvs=21) to get started. | ||
|
||
## `DAORegistry` | ||
|
||
The `DAORegistry` is used by the `DAOFactory` and contains the `register` function | ||
|
||
@aragon/framework/dao/DAORegistry.sol | ||
|
||
```solidity | ||
function register( | ||
IDAO dao, | ||
address creator, | ||
string calldata subdomain | ||
) external auth(REGISTER_DAO_PERMISSION_ID); | ||
|
||
``` | ||
|
||
the `register` function requires the `REGISTER_DAO_PERMISSION_ID`, this permission currently held only by the `DAOFactory`. This implies that the only way of creating DAOs that get registered in our `DAORegistry` is via the `createDao` function in the `DaoFactory` contract. | ||
|
||
If the requested ENS `subdomain` name [is valid](docs/osx/how-it-works/framework/ens-names) and not taken, the `DAORegistry` registers the subdomain and adds the `DAO` contract address to the `DAORegistry`. | ||
If the `subdomain` parameter is non-empty (not `""`) and still available, the ENS name will be registered. If the registration was successful, an event a `DAORegistered` event is emmited. This event contains the DAO address, the creator address and the subdomain. | ||
|
||
In case you want to verify that you DAO got registered in the `DAORegistry` you can call `entries(address)` and it will return `true` if the DAO is registered | ||
|
||
For more details visit the [`DAORegistry` reference guide entry](docs/osx/reference-guide/framework/dao/DAORegistry). | ||
|
||
## Events | ||
|
||
When creating a DAO there is 2 main events that you'll be looking for: | ||
clauBv23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- `DAORegistered` | ||
- `InstallationApplied` | ||
|
||
When the `createDao` function is called in the `DAORegistry` emits the `DaoRegistered` event. This event contains the DAO address, the creator address and the subdomain. | ||
|
||
```solidity | ||
event DAORegistered( | ||
address indexed dao, | ||
address indexed creator, | ||
string subdomain | ||
); | ||
``` | ||
|
||
The `InstallationApplied` event is emitted when the `PluginSetupProcessor` finishes installing the plugins in the DAO. | ||
|
||
```solidity | ||
event InstallationApplied( | ||
address indexed dao, | ||
address indexed plugin, | ||
bytes32 preparedSetupId, | ||
bytes32 appliedSetupId | ||
); | ||
``` | ||
|
||
There are a set of events emitted by the `DAO` contract itself, you can find more information about them in the [`DAO` reference guide entry](docs/osx/reference-guide/framework/dao/DAO). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: Permissions | ||
sidebar_label: Permissions | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Dao Permissions | ||
|
||
The following functions in the DAO are permissioned: | ||
|
||
| Functions | Permission Identifier | Description | | ||
| --- | --- | --- | | ||
| grant, grantWithCondition, revoke | ROOT_PERMISSION_ID | Required to manage permissions of the DAO and associated plugins. | | ||
| execute | EXECUTE_PERMISSION_ID | Required to execute arbitrary actions. | | ||
| _authorizeUpgrade | UPGRADE_DAO_PERMISSION_ID | Required to upgrade the DAO (via the https://eips.ethereum.org/EIPS/eip-1822). | | ||
| setMetadata | SET_METADATA_PERMISSION_ID | Required to set the DAO’s metadata and https://eips.ethereum.org/EIPS/eip-4824. | | ||
| setTrustedForwarder | SET_TRUSTED_FORWARDER_PERMISSION_ID | Required to set the DAO’s trusted forwarder for meta transactions. | | ||
| registerStandardCallback | REGISTER_STANDARD_CALLBACK_PERMISSION_ID | Required to register a standard callback for an https://eips.ethereum.org/EIPS/eip-165 interface ID. | | ||
|
||
Plugins installed on the DAO might introduce other permissions and associated permission identifiers. This additional permissions are specified by the plugin itself. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.