Decentralized Autonomous Organization — DAO

It’s IMPORTANT to note that this is for LEARNING purposes only. This code is not intended to be used in production. Use at your own discretion.

Original DAO Code

A DAO is an organization which main objective is to provide a new decentralized business model for organizing both commercial and non-profit enterprises, through rules encoded as computer programs called smart contracts. The code of the first DAO is open-source and it can be used by anyone but it doesn’t provide any warranty so it needs to be set up carefully. The DAO was first instantiated on the Ethereum block chain, and had no conventional management structure.


Owner, this role is responsible for managing the contract, it can execute functions like add and delete members of the organization and transfer the contract ownership which means it can delegate its position to another member and set up the voting rules.

Member, this role is for a person that is part of an organization, its main function is voting for a proposal in support or against, also it can create its own proposals and buy tokens.

Contract Funtions

DAO function: smart contract constructor function that contains the following parameters to set the curator and the address for the contract and can create another contract from it.

_curator The Curator

_daoCreator the contract able to (re)create this DAO

_proposalDeposit the deposit to be paid for a regular proposal

_minTokensToCreate Minimum required wei-equivalent tokens to be created for a successful DAO Token Creation

_closingTime Date (in Unix time) of the end of the DAO Token Creation

_parentDAO If zero the DAO Token Creation is open to public, a non-zero address represents the parentDAO that can buy tokens in the phase.

_tokenName the name that the DAO’s token will have

_tokenSymbol the ticker symbol that this DAO token should have

_decimalPlaces the number of decimal places that the token is counted from.

newProposal function: This function is a way to send ether to a specific address and uses the following parameters:

_recipient the recipient of the proposed transaction.

_amount the amount of wei to be sent in the proposed transaction.

_description the proposal description.

_transactionData the data of the proposed transaction.

_debatingPeriod how much time we will set to evaluate the proposal defined as seconds.

checkProposalCode function: evaluate the proposal code

_proposalID the proposal ID

_recipient the recipient of the proposal

_amount of ether involved in the transaction

_transactionData Transaction data

_supportsProposal Save the voting answer Yes if the member support the proposal or No if it doesn’t support it.

Vote function: this function could be considered as the main reason of a smart contract creation, it would allow us to decide which proposal we want to support or not.

_transactionData has been voted for or rejected, and executes the transaction in the case it has been voted for.

_proposalID the proposal ID

_transactionData the data of the proposed transaction

executeProposal: If the proposal is supported this function will be call executed, it handles the following parameters:

_proposalID the proposal ID

_transactionData the transaction data

The DAO Flow

The following diagram shows the sequence of actions that can be taken once the DAO contract has been deployed.

DAO Diagram.png
Carlos Cerrato