Aaron Abu Usama
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- slideOptions: transition: slide --- # AragonOS Fundamentals <!-- Put the link to this slide here so people can follow --> slide: https://hackmd.io/@AbuUsama/AragonOSFundamentals --- ## HouseKeeping - [Notion Page](https://www.notion.so/daobox/Teamspace-Home-2a8cf08616414f9cb96daee4b22d73f7) - [Read the Docs!](https://devs.aragon.org/docs/core/) Note: - scribe - Although we have time for Q&A at the end --- ## What we will be covering - Main Contracts - Infrastructure Contracts - Development cycle - Q&A Note: - Although we have time for Q&A at the end, jump in anywhere something doesn't make sense or you feel I have skipped over something - This will be very high level, look at some code but no coding --- ## Core Contracts ![](https://i.imgur.com/i9nfVf8.png) - `DAO` - `PermissionManager` - `Plugin` Note: Thankfully there are only three core contracts that makeup your DAO & you won't have to interact with the permission manager directly which leaves just the DAO contract and your plugin --- ## DAO Contract - Identity - Managing Assets - interacting with other contracts ---- lets look at a minimal `IDAO` interface for the DAO contract --- ### `IDAO.sol` ```solidity= [9|2-6|11] interface IDAO { struct Action { address to; // Address to call uint256 value; // Value to be sent with the call (for example ETH if on mainnet) bytes data; // Function selector + arguments } function execute(bytes32 callId, Action[] memory _actions, uint256 _allowFailureMap); function setMetadata(bytes calldata _metadata); } ``` Note: callId: it's up to the calling contract how to use, eg nonce almost always you are going to call execute() --- ## PermissionManager - governs the interactions between the DAO, Plugins and other addresses - Functionally equivelent to ACL - `DAO.sol` inherits `PermissionManager` - The secret sauce that makes a DAO a DAO Note: DAOs are essentially permission management systems ---- ### `DAO.sol` ```solidity contract DAO is PermissionManager { bytes32 EXECUTE_PERMISSION_ID = keccak256("EXECUTE_PERMISSION"); bytes32 UPGRADE_DAO_PERMISSION_ID = keccak256("UPGRADE_DAO_PERMISSION"); bytes32 SET_METADATA_PERMISSION_ID = keccak256("SET_METADATA_PERMISSION"); // ... } ``` Note: permission identifiers ---- ### `DAO.sol` ```solidity contract DAO is PermissionManager { // ... function hasPermission( address _where, address _who, bytes32 _permissionId, bytes memory _data ) external view returns (bool) { // ... } } ``` Note: view function to see if an address has a permission on another address data is optional. it's used to encode permission conditions ---- ### `DAO.sol` ```solidity contract DAO is PermissionManager { function execute( bytes32 callId, Action[] calldata _actions, uint256 allowFailureMap ) external override auth(address(this), EXECUTE_PERMISSION_ID) returns (bytes[] memory execResults, uint256 failureMap) { // ... } } ``` Note: auth1: address where the permission is required auth2: the permission identifier its self --- ## Plugin Contract - used to add functionality to the dao - Governance - Finance Note: fine-grained control if you give an address execute, they can execute anything --- Lets walk through a pseudocode example of a Swapper Plugin Note: code should let anyone with the swap permission perform a swap ---- ```solidity= [2-3|6-11|13-22] contract SwapPlugin is Plugin { bytes32 SWAP_PERMISSION_ID = keccak256("SWAP_PERMISSION"); bytes32 ADMIN_PERMISSION_ID = keccak256("ADMIN_PERMISSION"); function addAdmin(address newAdmin) external auth(address(this), ADMIN_PERMISSION_ID) { dao.grant(address(this), newAdmin, ADMIN_PERMISSION_ID); } function swap(address tokenIn, address tokenOut, uint amount) external auth(address(this), SWAP_PERMISSION_ID) { dao.execute( nonce++, // use the current nonce then add 1 [encodedTokenApproval, encodedSwapAction], // actions for the dao 0, // 0 means none if any action fails, revert ) } } ``` --- ## Plugin Upgradeability - Minimal Proxy - Transparent Proxy - UUPS proxy Note: minimal Proxy is non upgradable --- ## Infrastructure Contracts - Plugin setup contract - plugin repo contract --- ## Plugin Setup Contract - its a script to install the plugin in a DAO - it sets up initial permissions --- ## Plugin Repo Contract - functionally equivilent to APM - contains the current (and all previous) versions of your plugin - contains the setup contract - contains a URI to the apps UI --- ## UP Next - Setting up the development environment --- :end:

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully