|
@@ -4,11 +4,6 @@ On the testnet, we are also able to create an anonymous DAO. Using
|
|
|
the `drk` CLI tool, we have a `dao` subcommand that can perform the
|
|
the `drk` CLI tool, we have a `dao` subcommand that can perform the
|
|
|
necessary operations.
|
|
necessary operations.
|
|
|
|
|
|
|
|
-You can find a script in
|
|
|
|
|
-`contrib/localnet/darkfid-single-node/run-dao-test.sh` which
|
|
|
|
|
-automatically does all the commands in this tutorial. Just be sure
|
|
|
|
|
-to read the comment at the top of the file first.
|
|
|
|
|
-
|
|
|
|
|
Let's create a DAO with the following parameters:
|
|
Let's create a DAO with the following parameters:
|
|
|
|
|
|
|
|
* Proposer limit: `20`
|
|
* Proposer limit: `20`
|
|
@@ -25,47 +20,50 @@ $ ./drk help dao create
|
|
|
Let's create our DAO.
|
|
Let's create our DAO.
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-$ ./drk dao create 20 10 0.67 MLDY > dao.dat
|
|
|
|
|
-$ ./drk dao view < dao.dat
|
|
|
|
|
|
|
+$ ./drk dao create 20 10 0.67 MLDY > dao_mldy.dat
|
|
|
|
|
+$ ./drk dao view < dao_mldy.dat
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-The view command will show us the parameters. If everything looks fine,
|
|
|
|
|
-we can now import it into our wallet:
|
|
|
|
|
|
|
+Now this file can be shared amongst all dao members, so they
|
|
|
|
|
+hold the generated DAO information and keys. The view command
|
|
|
|
|
+will show us the parameters. If everything looks fine, we can
|
|
|
|
|
+now import it into our wallet:
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-./drk dao import MiladyMakerDAO < dao.dat
|
|
|
|
|
-./drk dao list
|
|
|
|
|
-./drk dao list MiladyMakerDAO
|
|
|
|
|
|
|
+$ ./drk dao import MiladyMakerDAO < dao_mldy.dat
|
|
|
|
|
+$ ./drk dao list
|
|
|
|
|
+$ ./drk dao list MiladyMakerDAO
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
## Minting
|
|
## Minting
|
|
|
|
|
|
|
|
If parameters are shown, this means the DAO was successfully imported
|
|
If parameters are shown, this means the DAO was successfully imported
|
|
|
-into our wallet. The DAO's index in our wallet is `1`, so we'll use
|
|
|
|
|
-that to reference it. Now we can create a transaction that will mint
|
|
|
|
|
-the DAO on-chain, and broadcast it:
|
|
|
|
|
|
|
+into our wallet. We use the DAO name to reference it. Now we can create
|
|
|
|
|
+a transaction that will mint the DAO on-chain, and broadcast it:
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-./drk dao mint MiladyMakerDAO > dao_mint_tx
|
|
|
|
|
-./drk broadcast < dao_mint_tx
|
|
|
|
|
|
|
+$ ./drk dao mint MiladyMakerDAO > dao_mldy_mint_tx
|
|
|
|
|
+$ ./drk broadcast < dao_mldy_mint_tx
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Now the transaction is broadcasted to the network. Wait for it to
|
|
Now the transaction is broadcasted to the network. Wait for it to
|
|
|
finalize, and if your `drk` is subscribed, after finalization you
|
|
finalize, and if your `drk` is subscribed, after finalization you
|
|
|
-should see a `leaf_position` and a transaction ID when running
|
|
|
|
|
|
|
+should see a leaf position and a transaction hash when running
|
|
|
`dao list MiladyMakerDAO`.
|
|
`dao list MiladyMakerDAO`.
|
|
|
|
|
|
|
|
## Sending money to the treasury
|
|
## Sending money to the treasury
|
|
|
|
|
|
|
|
Let's send some tokens to the DAO's treasury so we're able to make
|
|
Let's send some tokens to the DAO's treasury so we're able to make
|
|
|
-a proposal to send those somewhere. First find the DAO bulla and the
|
|
|
|
|
-DAO public key with `dao list` and then create a transfer transaction:
|
|
|
|
|
|
|
+a proposal to send those somewhere. First, find the DAO bulla, the
|
|
|
|
|
+dao contract spend hook and the DAO public key a d then create a
|
|
|
|
|
+transfer transaction:
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
|
|
+$ ./drk dao spend-hook
|
|
|
$ ./drk dao list MiladyMakerDAO
|
|
$ ./drk dao list MiladyMakerDAO
|
|
|
$ ./drk transfer 10 WCKD {DAO_PUBLIC_KEY} \
|
|
$ ./drk transfer 10 WCKD {DAO_PUBLIC_KEY} \
|
|
|
- --dao {DAO_BULLA} > dao_transfer
|
|
|
|
|
-$ ./drk broadcast < dao_transfer
|
|
|
|
|
|
|
+ {DAO_CONTRACT_SPEND_HOOK} {DAO_BULLA} > dao_mldy_transfer_tx
|
|
|
|
|
+$ ./drk broadcast < dao_mldy_transfer_tx
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Wait for it to finalize, and if subscribed, you should see the DAO
|
|
Wait for it to finalize, and if subscribed, you should see the DAO
|
|
@@ -77,48 +75,75 @@ $ ./drk dao balance MiladyMakerDAO
|
|
|
|
|
|
|
|
## Creating a proposal
|
|
## Creating a proposal
|
|
|
|
|
|
|
|
-Now that the DAO has something in its treasury, we can create a
|
|
|
|
|
-proposal to send it somewhere. Let's send 5 of the 10 tokens to our
|
|
|
|
|
-address (we can find that with `drk wallet --address`):
|
|
|
|
|
|
|
+Now that the DAO has something in its treasury, we can generate a
|
|
|
|
|
+transfer proposal to send it somewhere, that will be up to vote
|
|
|
|
|
+for 30 block periods. Let's propose to send 5 of the 10 tokens to
|
|
|
|
|
+our address (we can find that with `drk wallet --address`):
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-$ ./drk dao propose MiladyMakerDAO {YOUR_ADDRESS} 5 WCKD > proposal_tx
|
|
|
|
|
-$ ./drk broadcast < proposal_tx
|
|
|
|
|
|
|
+$ ./drk dao propose-transfer MiladyMakerDAO 30 5 WCKD {YOUR_ADDRESS}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Once finalized and scanned, the proposal should be viewable in the
|
|
|
|
|
-wallet. We can see this with the `proposal` subcommands:
|
|
|
|
|
|
|
+After command was executed, it will output the generated proposal
|
|
|
|
|
+bulla, which we will use to full the proposal information:
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-$ ./drk dao proposals MiladyMakerDAO
|
|
|
|
|
-$ ./drk dao proposal MiladyMakerDAO 1
|
|
|
|
|
|
|
+$ ./drk dao proposal {PROPOSAL_BULLA}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+We can export this proposal, to share with rest DAO members.
|
|
|
|
|
+The exported file will be encrypted using the DAO keys, so only
|
|
|
|
|
+its members can decrypt and import it.
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao proposal {PROPOSAL_BULLA} --export > dao_mldy_transfer_proposal.dat
|
|
|
|
|
+$ ./drk dao proposal-import < dao_mldy_transfer_proposal.dat
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+Now we can create the proposal mint transaction and broadcast it:
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao proposal {PROPOSAL_BULLA} --mint-proposal > dao_mldy_transfer_proposal_mint_tx
|
|
|
|
|
+$ ./drk broadcast < dao_mldy_transfer_proposal_mint_tx
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+Members that didn't receive the encrypted file will receive the
|
|
|
|
|
+proposal when they scan the corresponding block, but its plaintext
|
|
|
|
|
+data will be missing, so they should ask the DAO for it.
|
|
|
|
|
+Once finalized and scanned, you should see a leaf position and a
|
|
|
|
|
+transaction hash when running `dao proposal {PROPOSAL_BULLA}`.
|
|
|
|
|
+
|
|
|
## Voting on a proposal
|
|
## Voting on a proposal
|
|
|
|
|
|
|
|
Now the DAO members are ready to cast their votes.
|
|
Now the DAO members are ready to cast their votes.
|
|
|
First lets check the `dao vote` subcommand usage.
|
|
First lets check the `dao vote` subcommand usage.
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-$ drk help dao vote
|
|
|
|
|
|
|
+$ ./drk help dao vote
|
|
|
Vote on a given proposal
|
|
Vote on a given proposal
|
|
|
|
|
|
|
|
-Usage: drk dao vote <DAO_ALIAS> <PROPOSAL_ID> <VOTE> <VOTE_WEIGHT>
|
|
|
|
|
|
|
+USAGE:
|
|
|
|
|
+ drk dao vote <bulla> <vote> [vote-weight]
|
|
|
|
|
|
|
|
-Arguments:
|
|
|
|
|
- <DAO_ALIAS> Name or numeric identifier for the DAO
|
|
|
|
|
- <PROPOSAL_ID> Numeric identifier for the proposal
|
|
|
|
|
- <VOTE> Vote (0 for NO, 1 for YES)
|
|
|
|
|
- <VOTE_WEIGHT> Vote weight (amount of governance tokens)
|
|
|
|
|
|
|
+FLAGS:
|
|
|
|
|
+ -h, --help Prints help information
|
|
|
|
|
+ -V, --version Prints version information
|
|
|
|
|
+
|
|
|
|
|
+ARGS:
|
|
|
|
|
+ <bulla> Bulla identifier for the proposal
|
|
|
|
|
+ <vote> Vote (0 for NO, 1 for YES)
|
|
|
|
|
+ <vote-weight> Optional vote weight (amount of governance tokens)
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-Lets use our 20 MLDY to vote yes to proposal 1.
|
|
|
|
|
|
|
+Lets use our `MLDY` governance tokens to vote yes to the proposal.
|
|
|
|
|
|
|
|
```
|
|
```
|
|
|
-$ drk dao vote MiladyMakerDAO 1 1 20 > /tmp/dao-vote.tx
|
|
|
|
|
-$ drk broadcast < /tmp/dao-vote.tx
|
|
|
|
|
|
|
+$ ./drk dao vote {PROPOSAL_BULLA} 1 > dao_mldy_transfer_proposal_vote_tx
|
|
|
|
|
+$ ./drk broadcast < dao_mldy_transfer_proposal_vote_tx
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+Once finalized and scanned, you should see votes information and
|
|
|
|
|
+current status when running `dao proposal {PROPOSAL_BULLA}`.
|
|
|
|
|
+
|
|
|
## Executing the proposal
|
|
## Executing the proposal
|
|
|
|
|
|
|
|
Once enough votes have been cast that meet the required minimum (quorum)
|
|
Once enough votes have been cast that meet the required minimum (quorum)
|
|
@@ -126,8 +151,83 @@ and assuming the yes:no votes ratio is bigger than the approval ratio,
|
|
|
then we are ready to finalize the vote. Any DAO member can perform this
|
|
then we are ready to finalize the vote. Any DAO member can perform this
|
|
|
action.
|
|
action.
|
|
|
|
|
|
|
|
|
|
+Since in our tutorial the `MLDY` governance tokens we used surpass the
|
|
|
|
|
+quorum, we can execute the proposal right away:
|
|
|
|
|
+
|
|
|
```
|
|
```
|
|
|
-$ drk dao exec MiladyMakerDAO 1 > /tmp/dao-exec.tx
|
|
|
|
|
-$ drk broadcast < /tmp/dao-exec.tx
|
|
|
|
|
|
|
+$ ./drk dao exec {PROPOSAL_BULLA} > dao_mldy_transfer_proposal_exec_tx
|
|
|
|
|
+$ ./drk broadcast < dao_mldy_transfer_proposal_exec_tx
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+After the proposal has been executed on chain, we will see that
|
|
|
|
|
+the DAO balance has been reduced by 5 `WCKD`, while our own balance
|
|
|
|
|
+has been increased by the same amount:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao balance MiladyMakerDAO
|
|
|
|
|
+$ ./drk wallet --balance
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+## DAO->DAO
|
|
|
|
|
+
|
|
|
|
|
+Let's now try some more exotic operations!
|
|
|
|
|
+
|
|
|
|
|
+Since we hold the mint authority of the `MLDY` token,
|
|
|
|
|
+instead of transfering some to the DAO, we will mint them
|
|
|
|
|
+directly into it:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk token mint MLDY 20 {DAO_PUBLIC_KEY} \
|
|
|
|
|
+ {DAO_CONTRACT_SPEND_HOOK} {DAO_BULLA} > mint_dao_mldy_tx
|
|
|
|
|
+$ ./drk broadcast < mint_dao_mldy_tx
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+After finalization we will see the dao holding its own
|
|
|
|
|
+governance tokens in its treasury:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao balance MiladyMakerDAO
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+Now we will create a second dao:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao create 20 10 0.67 WCKD > dao_wckd.dat
|
|
|
|
|
+$ ./drk dao import WickedDAO < dao_wckd.dat
|
|
|
|
|
+$ ./drk dao mint WickedDAO > dao_wckd_mint_tx
|
|
|
|
|
+$ ./drk broadcast < dao_wckd_mint_tx
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+We propose a transfer of some of the `MLDY` governance token
|
|
|
|
|
+from the DAO treasury to the new DAO we created:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao list WickedDAO
|
|
|
|
|
+$ ./drk dao propose-transfer MiladyMakerDAO 30 6.9 MLDY {WICKED_DAO_PUBLIC_KEY} \
|
|
|
|
|
+ {DAO_CONTRACT_SPEND_HOOK} {WICKED_DAO_BULLA}
|
|
|
|
|
+$ ./drk dao proposal {PROPOSAL_BULLA} --mint-proposal > dao_mldy_transfer_proposal_wckd_mint_tx
|
|
|
|
|
+$ ./drk broadcast < dao_mldy_transfer_proposal_wckd_mint_tx
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+Vote on the proposal:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao vote {PROPOSAL_BULLA} 1 > dao_mldy_transfer_proposal_wckd_vote_tx
|
|
|
|
|
+$ ./drk broadcast < dao_mldy_transfer_proposal_wckd_vote_tx
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+And execute it:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao exec {PROPOSAL_BULLA} > dao_mldy_transfer_proposal_wckd_exec_tx
|
|
|
|
|
+$ ./drk broadcast < dao_mldy_transfer_proposal_wckd_exec_tx
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+After the proposal has been executed on chain, we will see that
|
|
|
|
|
+the DAO governance token balance has been reduced by 6.9 `MLDY`,
|
|
|
|
|
+while the new DAO balance has been increased by the same amount:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+$ ./drk dao balance MiladyMakerDAO
|
|
|
|
|
+$ ./drk dao balance WickedDAO
|
|
|
|
|
+```
|