Understanding the DAO accounting

Victor Pfautz edited this page Jun 23, 2018 · 20 revisions

Understanding the DAO accounting

Main Author: Jordi Baylina

Introduction

I wrote this guide after spending lots of hours trying to understand the DAO accounting system. Hope that this guide helps anyone that’s studying the DAO contract at https://github.com/slockit/DAO or simply wants a deeper understanding of how the accounting is carried inside the DAO contract.

Token types in the DAO

DAO Tokens ( Ð )

DAO tokens ( Ð ) represents the ownership of the DAO. If you have Ð then you are member (aka. DTH) of the “The DAO”,

The ownership percentage is calculated as:

Where totalSupply is the total number of DAO tokens that exist. The totalSupply is fixed after the Creation phase, and only decreases as a result of splits. The act of splitting burns DAO tokens.

Reward Tokens (RT)

Every time that a proposal is executed and some money gets out of the DAO reward tokens are generated in that DAO. These reward tokens represent the amount of the investment made by the DAO.

For each Wei that gets out of the DAO, 1RT is generated. The RT are owned by the entire DAO.

For example if a DAO invest 140Ξ in a proposal, the DAO will generate and hold 140*10^18RT. If Alice owns 10% of the DAO tokens, we can say that Alice owns 14 * 10^18 RT implicitly. As the DAO Tokens are backed by RT and Ξ that are held by the DAO.

What’s important to understand here is that the DAO never just spends money, it only supports projects. The ownership of all the returns the projects provide is determined by the reward tokens it holds.

What’s interesting here is that when somebody splits, they still keep the rewardTokens accumulated until the split. They do not lose the ownership of the investment! Of course, after the split, They will not receive any more reward tokens in the following DAO investments but they have the rights to receive the return of the investment proportionally to their accumulated rewardsTokens until the split.

Here totalRewardToken is the total investment made by the DAO in its history. This number increases on each investment but never decreases.

Accounts in the DAO

The ether inside the DAO can reside in the main contract or in some child contracts called Managed Accounts.

Managed accounts

A managed account is a different contract than the main DAO contract but is controlled absolutely from the main DAO contract. That means that only the DAO contract can pay money out from a Managed Account.

The DAO Main Account (0xbb9bc244d798123fde783fcc1c72d3bb8c189413)

Like any other contract, the DAO contract can hold ether by itself. This is the default place where ether resides.

The ownership of the money in this account is determined by DAO tokens. The ratio of a DTH tokens to the token total supply essentially shows the percentage of the total Ether that a given DTH owns.

The Extra Balance account (0x807640a13483f8ac783c557fcdf27be11ea4ac7a)

During the Creation phase, the price of the DAO Token is not static. At the beginning of the process, 100Ð cost 1Ξ. But at the end of the process 100Ð costs 1.5Ξ.

There is a simple attack that consists of buying tokens at price 1 and then splitting immediately after the creation process ends. In this case, the attacker would get more than 1Ξ for each Ξ invested if there are people buying Ð at more than 1Ξ/100Ð.

To solve that, developers created the extraBalance account. This account stores the extra money that the DAO gets in the final phases above 1Ξ/100Ð.

For example, if you buy 100Ð for 1.5Ξ just before the Creation phase ends, then there will be 1Ξ that will go to the main DAO account and 0.5Ξ that will go to the Extra Balance account.

In this case, all the DTH who split immediately after the Creation phase closes will get exactly 1Ξ/100Ð regardless what they may have paid for each Ð.

The ether in the Extra Balance account can go to the main DAO when the DAO has spent as much ether as the Extra Balance account has. That happens by making a proposal to call the payOut() function of the Extra Balance account with the DAO itself as the beneficiary.

The rewardAccount (0xd2e16a20dd7b1ae54fb0312209784478d069c7b0)

The DAO, like any other “for profit” organisation is created because there are people (DAO Token Holders) that expect that sooner or later will receive rewards from their investment into projects

When the DAO approves to pay rewards to their tokenHolders via a proposal, what it does is transfer the total amount of Ethers that wants to pay to the rewardAccount.

Once the Ether is in this account, the tokenHolders can take the Ether that corresponds according to the Ð that holds.

The DAOrewardAccount (0x17cd41543a3c3c77d5e372704c9577df09eea003)

The DAO will invest in some proposals. The fruit of those proposals should directly or indirectly return an investment to the DAO. The way to do this is by sending ether to this account.

The Ether in this account belongs to anybody that has paid for the proposals in the first place. That is not only the current DAO token holders, but it is also the child DAOs that split out of the original DAO.

So, the ether on this account is distributed according to the RewardTokens that correspond to the DAO and each direct child DAO.

When there is some Ether in this account, the DAO will need to approve a proposal to take all the Ether that belongs to it and transfer it to the main DAO account. It can also opt to transfer the Ether directly to the rewards account so that it can be claimed by the DAO Token holders.

The split DAOs will do exactly the same when there is some money in their direct parent DAO DAOrewardsAccount. They can claim their portion of it since the direct parent DAO remembers the percentage of reward tokens that correspond to each direct child DAO.

Flux of the Money

Token Creation

During the Creation phase, all the Ether will go to the main DAO account and to the Extra Balance.

More precisely, in the phase of rate 1 (before two weeks prior to the Creation phase ends), the Ether will go entirely to the main DAO account.

When the rate increases to more than 1, the extra money, due to the increase of the DAO token price, is stored in the Extra Balance account.

The money in the Extra Balance will stay there until at least the same amount of money has been invested in regular proposals.

Proposal execution (invest)

When a proposal is approved, the amount of money approved is sent from the DAO to the recipient of the proposal.

As a side note, I would like to remind the reader here that it is possible to send the approved amount to a regular account or to a contract. In the last case, the proposal can specify which function and with which parameters the DAO contract will end up calling if the proposal is approved.

When a proposal is executed, the DAO will generate reward tokens. 1RT is equivalent to 1 Wei invested.

For example if Alice owns 10% of the DAO Tokens and 150Ξ are Invested in a proposal, the DAO will generate 150 * 10^18 RT of which 15 * 10 ^ 18 belongs to Alice.

Receive rewards (Return of investment)

When the result of a proposal pays back to the DAO, it should do it by sending Ether to the DAOrewardAccount. The most typical example is the DAO% of the each transaction occuring in the Universal Sharing Network as proposed by slock.it.

When an ethereum computer is installed as a node of the Universal Sharing Network, an amount of ether (DAO%) will be returned to the DAO via the DAOrewardAccount as can be seen here

Ether in this account belongs to the reward Token Holders. That is the Main DAO and all DAOs that split directly from it.

Distributing return of investment

Ether in DAOrewardAccount can be sent to the main DAO and to all the directly split childDAO’s. Each one in proportion to the rewardTokens that corresponds to it.

This is done by a proposal in each DAO (including the main DAO) The proposal says to execute the main DAO method retrieveDAOReward().

The ether can be sent directly to the DAO account of the calling DAO or to the rewardAccount if they prefer to distribute the rewards to their DAO token holders.

Pay dividends process

Finally, when some day the DAO wants to distribute dividends to their DAO token holders, the DAO will approve a proposal to send the total amount that it wants to be distributed into the Reward Account.

Once the Ether is in this account, the DAO token Holders can call the getMyReward() method to get the portion of ether that belongs to each Token Holder according to the DAO tokens that they hold.

Example of the DAO's evolution

STEP 0: Fueling

  • Alice buys 10 Tokens at 1Ξ/100Ð (10Ξ)
  • Bob buys 20 Tokens at 1Ξ/100Ð (20Ξ)
  • Charlie buys 30 Tokens at 1.2Ξ/100Ð (36Ξ)
  • Dave buys 40 Tokens at 1.5Ξ/100Ð (60Ξ)

If the DAO is not fueled, Each tokenHolder recovers the exact money they invest.

STEP 1: A Proposal is approved.

The proposal approved is to send 30Ξ to company S to manufacture an ethereum lamp. This lamp will send 1Ξ to the DAOrewardAccount when the end user turns the lamp on for the first time.

Ether Distribution:

Method: executeProposal()

STEP 2: 10 Lamps are sold, used and the Reward is sent to the DAOrewardAccount

(*) a/b in the account means: a -> ethers in the account actually b -> total ether sent to this account in its history.

STEP 3: A proposal is approved to move the balance of DAOreward account to the DAO.

Method: retrieveDAOreward(false)

STEP 4: A proposal is approved to distribute 10Ξ to the TokenHolders

Method: executeProposal()

STEP 5: Dave gets his rewards

Method: getMyReward()

STEP 6: Dave transfers 10Ð to Charlie

Method: transfer()

STEP 7: 10 more lamps are sold.

STEP 8: Alice split Method: splitDAO()

Method: splitDAO()

During the split the following things happen:

  1. Alice gets all pending rewards (1Ξ)
  2. A new DAO is created: DAOAl
  3. The 30 RewardTokens generated until now are divided 3 to DAOAl and 27 to the old DAO.
  4. DAOreward paid is also split. 10 -> 9 and 1.
  5. Alice's DAO tokens are burned.

STEP 9: 10 more lamps are sold

STEP 10: 10 DAOAl gets its rewards (DAO all still owns reward tokens)

Method: retrieveDAOreward()

The DAOAl main account will increase by 2Ξ more.

STEP 11: DAO approves to send its DAO rewards to the reward account.

Method: retrieveDAOreward(true)

STEP 12: Bob gets his rewards

Method: getMyReward()

STEP 13: A new investment is approved for an Ethereum router of 40Ξ to company T. 2Ξ will be sent to the DAOrewardAccount when each router is sold.

Method: executeProposal()

STEP 14: 20 Routers are sold

STEP 15: DAOAl gets its rewards (DAOAl still owns reward tokens)

In this case, DAOAl will not receive nothing because It already received 3Ξ that is exactly 70*(3/(67+3))

STEP 16: DAO approbe to send his DAOrewards to the main DAO account.

Method: retrieveDAOreward(false)

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.