GithubHelp home page GithubHelp logo

aragon / osx Goto Github PK

View Code? Open in Web Editor NEW
74.0 11.0 41.0 18.68 MB

Aragon OSx Protocol

License: GNU Affero General Public License v3.0

JavaScript 0.88% Shell 0.42% Solidity 20.32% TypeScript 78.36% Dockerfile 0.02%

osx's Introduction

Aragon

Aragon websiteDeveloper PortalJoin our Developer CommunityContribute


Aragon OSx Protocol

The Aragon OSx protocol is the foundation layer of the new Aragon stack. It allows users to create, manage, and customize DAOs in a way that is lean, adaptable, and secure.

Within this monorepo, you will be able to find 3 individual packages:

  • Contracts: the Aragon OSx protocol contracts.
  • Subgraph: contains all code generating our subgraph and event indexing.
  • Contract-ethers: contains the connection between the ethers package and our contracts.

The contents of this repository are distributed via 3 different NPM packages:

  • @aragon/osx: The source files, including the protocol contracts and interfaces
  • @aragon/osx-artifacts: The contracts bytecode and ABI to use the protocol or deploy it
  • @aragon/osx-ethers: The TypeScript wrappers to use the protocol or deploy it using ethers.js

For more information on the individual packages, please read the respective README.md.

Audits

Our smart contracts undergo regular audits.

v1.0.0

Halborn: link 1, link 2

v1.3.0

Code4rena: link 1, link 2

Halborn: link 1, link 2

Contributing

We'd love to hear what you think! If you want to build this with us, please find a detailed contribution guide in the CONTRIBUTION_GUIDE.md file here.

Security

If you believe you've found a security issue, we encourage you to notify us. We welcome working with you to resolve the issue promptly.

Security Contact Email: [email protected]

Please do not use the issue tracker for security issues.

Setup

Ensure you have Node and Yarn installed.

The latest Node version officially supported by OSx and Hardhat is 16. Node >=19 also works, but is technically unsupported by Hardhat. It's recommended to use a tool such as nvm to manage different node environments. Please see the relevant documentation for details.

Start by running yarn install in the project root in your terminal.

Dependencies

Since the repo is set up as yarn workspace, all the linking is done automatically. When contributing, we recommend to cd into each package, as this mirrors the workflow of the development team.

How the Aragon OSx protocol works

To review the contracts powering the Aragon OSx protocol, feel free to head to packages/contracts.

The Aragon OSx protocol architecture is composed of two key sections:

  • Core contracts: the primitives the end user will interact with. It is composed of mostly 3 parts:
    • DAO contract: the main contract of our core. It holds a DAO's assets and possible actions.
    • Permissions: govern interactions between the plugins, DAOs, and any other address - allowing them (or not) to execute actions on behalf of and within the DAO.
    • Plugins: base templates of plugins to build upon.
  • Framework contracts: in charge of creating and registering each deployed DAO or plugin. It contains:
    • DAO and Plugin Repository Factories: creates DAOs or plugins.
    • DAO and Plugin Registries: registers into our protocol those DAOs or plugins.
    • Plugin Setup Processor: installs and uninstalls plugins into DAOs.

Additionally to those two sections, we have developed several plugins DAOs can easily install upon creation. These are:

  • Token Voting plugin: enables token holders to vote yes, no or abstain on incoming DAO proposals
  • Multisig plugin: enables DAO governance based on approval from a pre-defined members list.
  • Addresslist Voting plugin: enables a pre-defined set of addresses to vote yes, no or abstain in a "one address, one vote" mode
  • Admin plugin: enables full access to an account needing to perform initial maintenance tasks without unnecessary overhead

Let's dive into more detail on each of these sections.

Core Contracts

The Core Contracts describe how every DAO generated by the Aragon OSx protocol will be set up. It is very lean by design and constitutes the most critical aspects of our architecture.

In a nutshell, each DAO is composed of 3 interconnecting components:

  1. The DAO contract: The DAO contract is where the core functionality of the DAO lies. It is the contract in charge of:
    • Representing the identity and metadata of the DAO (ENS name, logo, description, other metadata)
    • Holding and managing the treasury assets
    • Executing arbitrary actions to:
      • transfer assets
      • call its own functions
      • call functions in external contracts
    • Providing general technical utilities like callback handling and others
  2. Permissions: Permissions are an integral part of any DAO and the center of our protocol architecture. The Permissions manager manages permissions for the DAO by specifying which addresses have permission to call distinct functions on contracts associated with your DAO. This Permissions manager lives inside the DAO contract.
  3. Plugins: Any custom functionality can be added or removed through plugins, allowing you to fully customize your DAO. You'll find some base templates of plugins within the plugins folder of the Core Contracts. Some examples of plugins that DAOs could install are:
    • Governance (e.g., token voting, one-address one-vote)
    • Asset management (e.g., ERC-20 or NFT minting, token streaming, DeFi)
    • Membership (governing budget allowances, access gating, curating a member list)

The following graphic shows an exemplary DAO setup:

An examplary DAO setup

An examplary DAO setup showing interactions between the three core contract pieces triggered by different user groups: The DAO and PermissionManager contract in blue and red, respectively, as well as two Plugin contracts in green. Bear in mind, the DAO and Permission Manager components both coexist within the same DAO contract. Function calls are visualized as black arrows and require permission checks (red, dashed arrow). In this example, the permission manager determines whether the token voting plugin can execute actions on the DAO, a member can change its settings, or if an DeFi-related plugin is allowed to invest in a certain, external contract.

Framework Contracts

In contrast, the Framework Contracts are in charge of creating and registering DAOs and plugins. Additionally, these contracts contain the PluginSetupProcessor which installs, uninstalls, and updates plugins into DAOs upon request.

  • Factories and Registries
    • The DAO Factory: In charge of deploying instances of a new DAO based on the parameters given, including which plugins to install and additional metadata the DAO has (like a name, description, etc).
    • The DAO Registry: In charge of registering DAOs into our protocol so plugins can easily access all DAO instances within our protocol. It is also in charge of giving DAOs subdomains for easier access.
    • The Plugin Factory: A PluginRepo is the repository of versions for a given plugin. The PluginRepoFactory contract creates a PluginRepo instance for each plugin, so that plugins can update their versioning without complexity in a semantic way similar to the App Store.
    • The Plugin Registry: In charge of registering the PluginRepo addresses into our protocol so that DAOs can access all plugins published in the protocol.
  • Plugin Setup Processor: The processor is the manager for plugins. It installs, uninstalls, and upgrades plugins for DAOs based on the instructions provided by the plugin setup.

For a more detailed description of each of these components, please visit our Developer Portal.

Plugins

Each plugin consists of two key components:

  • The Plugin Logic: contains the logic for each plugin; the main functionality the plugin extends for the DAO. Can be linked to other helper contracts if needed.
  • The Plugin Setup: contains the installation, uninstallation, and upgrade instructions for a plugin into a DAO.

You can find all plugins built by the Aragon team here.

Connection between OSx, subgraph, and ethers.js packages

The Aragon OSx contracts emits events that get indexed within our subgraph. This subgraph, whose source code can be found here, is what then fuels the Aragon SDK.

The contract-ethers package is the NPM package that provides ethers.js wrappers to use the Aragon OSx contracts.

Tests

To run tests, run these commands in the root folder in your terminal:

npx hardhat accounts
npx hardhat compile
npx hardhat clean
npx hardhat test
npx hardhat node
npx hardhat help
REPORT_GAS=true npx hardhat test
npx hardhat coverage

For faster runs of your tests and scripts, consider skipping ts-node's type checking by setting the environment variable TS_NODE_TRANSPILE_ONLY to 1 in hardhat's environment.

For more details see the documentation.

Deployment

To deploy contracts, run these commands in your terminal:

npx hardhat run scripts/deploy.ts
TS_NODE_FILES=true npx ts-node scripts/deploy.ts
npx eslint '**/*.{js,ts}'
npx eslint '**/*.{js,ts}' --fix
npx prettier '**/*.{json,sol,md}' --check
npx prettier '**/*.{json,sol,md}' --write
npx solhint 'contracts/**/*.sol'
npx solhint 'contracts/**/*.sol' --fix

You can find more details about our deployment checklist here.

Publishing protocol upgrades

Follow our update checklist here.

Pull request commands

Certain actions can be triggered via a command to a pull request. To issue a command just comment on a pull request with one of these commands.

Command Description
/mythx partial (quick | standard | deep) Scans the changed files for this pull request
/mythx full (quick | standard | deep) Scans the all files for this pull request
/release (patch | minor | major) Adds the proper release label to this pull request
/subgraph (patch | minor | major) Adds the proper subgraph release label to this pull request

osx's People

Contributors

arabot-1 avatar banasa44 avatar brickpop avatar cgero-eth avatar chilcano avatar claubv23 avatar fabricevladimir avatar githubdoramon avatar jordaniza avatar josemarinas avatar jpaulet avatar juliettech13 avatar mathewmeconry avatar michael-a-heuer avatar nivida avatar novaknole avatar omahs avatar pythonpete32 avatar rakeshup avatar rekard0 avatar sepehr2github avatar wissenistnacht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osx's Issues

Quick Question for a Hackthon: Feel Free to close

I know this does not align with how issues should be opened.Am participating on ETHSafari hackathon, in Kenya and my blockchain of choice is Aragon. I know it will make it seamless to build. But how do I get a test net? Do I use external tools like Rinkeby or Aragon has one?

Bug: TokenVotingSetup data size bigger than allowed

Describe the bug
I am getting an error on tokenvotingsetup contract that data size is bigger than allowed
(screenshot below)

To Reproduce (please complete the following information)

  • Config and flags: completed the deploy checklist and am deploying to goerli (but have run into this on another custom chain as well)
  • Steps to reproduce the behavior:
    yard deploy --network goerli

Current behavior
In depth explanation, if required, or a clear and concise description of what actually happens.

image

Expected behavior
Contract should deploy

System (please complete the following information):

  • OS: Windows 10
  • Commit hash a362749

ACL improvements

Situation

Currently, the ACL is intended to control access on the contract level. It is not intended to control user-level permissions.

https://github.com/aragon/zaragoza/blob/58710cc3677db5b04d2d65c53ca6bb6e147e10a7/packages/contracts/contracts/core/acl/ACL.sol#L34-L37

In this design concept, Components such as WhitelistVoting have to manage the user-level permissions themselves inside the Component contract.
https://github.com/aragon/zaragoza/blob/58710cc3677db5b04d2d65c53ca6bb6e147e10a7/packages/contracts/contracts/votings/whitelist/WhitelistVoting.sol#L49

Remark: In WhitelistVoting, users can vote in either every voting or none at all. To allow for controlling access to single votings or have specific user groups, a more complicated permission management would be needed inside WhitelistVoting.

Problem Description

This design is problematic for several reasons: Permission-management for each component

  • is dangerous because the responsibility of coding a secure permission management (the most critical component in a DAO) is shifted to less-experienced component developers
  • leads to code duplication
  • is wasteful in terms of gas (more state to manage, more function calls to control access)
  • confusing and hard to manage (a DAO needs to keep track of the permissions in each component)
  • is unintuitive from a developer perspective because one would intuitively think that permission management in a DAO is the job of the DAOs ACL

Requirements

We need to be able to manage access for different actors: contracts, users, or groups (of both)

  • contract-specific
    • EXAMPLE: Contract A can call specific functions in contract B
  • user-specific
    • EXAMPLE: Alice can call specific functions in contract B
  • group-specific (both, contracts and users can belong to a group)
    • EXAMPLE: A member of Group ALPHA can execute specific functions in contract B

The access should be granular down to the level of specific objects managed by the smart contract via object identifiers.

  • EXAMPLE: Assume a contract managing a range of objects mapping (uint256 => Object) objects. Alice in group ALPHA can execute function bar(uint256 _id, ...) auth(_id, ALPHA) on object with _id=1 but not _id=2.

Moreover, permissions dynamically depending on contract state would be nice to have.

  • dynamic/limited permissions
    • EXAMPLE: Members in the executive committee group can withdraw from the DAO until a certain budget limit is reached.

A general requirement is that the developer-facing functions should be clear and self-explanatory in their usage and naming.

Possible Actions

  1. Add the functionality to the core ACL by modifying mapping (bytes32 => address) internal authPermissions; and associated functions to be more generic.
  2. Leave the ACL as is, but provide the user-level permission-management functionalities (user groups / roles, dynamic permissions) as a specialized DAO component using the ACLOracle
  3. Leave everything as is.

Bug: Unable to create a DAO on Polygon

Describe the bug
The final step of DAO creation throws the following error:

Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="latestRelease()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)
    at E.makeError (index.js:224:23)
    at E.throwError (index.js:233:20)
    at z.decodeFunctionResult (interface.js:345:23)
    at $.<anonymous> (index.js:293:48)
    at Generator.next (<anonymous>)
    at o (index.js:5:58)

*NETWORK UNSUPPORTED

To Reproduce (please complete the following information)

  1. Go to https://app.aragon.org/#/create
  2. Switch your network to Polygon
  3. Attempt to deploy a DAO on Polygon with the following parameters

Network: Mainnet
Blockchain: Polygon
Logo:
Name: Oscar's Aragon DAO
Summary: I'm just doing this as a test

Current behavior

The console throws the following error and a dao is not created

*NETWORK UNSUPPORTED
api-stg.vocdoni.net/v2/accounts/0xEe0861faBEdc0BD4E41fe9fE97E6Cd1c7e4B717a:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
network.tsx:62 *NETWORK UNSUPPORTED
api-stg.vocdoni.net/v2/accounts/0xEe0861faBEdc0BD4E41fe9fE97E6Cd1c7e4B717a:1 
        
        
       Failed to load resource: the server responded with a status of 404 ()
4createDao.tsx:516 Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="latestRelease()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)
    at E.makeError (index.js:224:23)
    at E.throwError (index.js:233:20)
    at z.decodeFunctionResult (interface.js:345:23)
    at $.<anonymous> (index.js:293:48)
    at Generator.next (<anonymous>)
    at o (index.js:5:58)

Expected behavior

A DAO creation transaction should be created via my Metamask wallet.

System (please complete the following information):

  • OS: [e.g. Windows 11 Pro]
  • Software version [Google Chrome Version 120.0.6099.71 (Official Build) (64-bit)]
  • Metamask [11.7.0]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.