From ccea2417e570bdee7ce3b8a87f51f00df9140e75 Mon Sep 17 00:00:00 2001 From: x Date: Sat, 17 Jun 2023 07:34:51 +0200 Subject: [PATCH] doc: update dao section --- doc/src/testnet/dao.md | 62 +++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/doc/src/testnet/dao.md b/doc/src/testnet/dao.md index d5ce149ca..c38ad31ea 100644 --- a/doc/src/testnet/dao.md +++ b/doc/src/testnet/dao.md @@ -2,7 +2,14 @@ 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 -necessary operations. Let's create a DAO with the following parameters: +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: * Proposer limit: `20` * Quorum: `10` @@ -28,7 +35,7 @@ we can now import it into our wallet: ``` ./drk dao import MiladyMakerDAO < dao.dat ./drk dao list -./drk dao list 1 +./drk dao list MiladyMakerDAO ``` ## Minting @@ -39,14 +46,14 @@ that to reference it. Now we can create a transaction that will mint the DAO on-chain, and broadcast it: ``` -./drk dao mint 1 > dao_mint_tx +./drk dao mint MiladyMakerDAO > dao_mint_tx ./drk broadcast < dao_mint_tx ``` Now the transaction is broadcasted to the network. Wait for it to finalize, and if your `drk` is subscribed, after finalization you should see a `leaf_position` and a transaction ID when running -`dao list 1`. +`dao list MiladyMakerDAO`. ## Sending money to the treasury @@ -55,7 +62,7 @@ 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: ``` -$ ./drk dao list 1 +$ ./drk dao list MiladyMakerDAO $ ./drk transfer 10 WCKD {DAO_PUBLIC_KEY} \ --dao {DAO_BULLA} > dao_transfer $ ./drk broadcast < dao_transfer @@ -65,7 +72,7 @@ Wait for it to finalize, and if subscribed, you should see the DAO receive the funds: ``` -$ ./drk dao balance 1 +$ ./drk dao balance MiladyMakerDAO ``` ## Creating a proposal @@ -75,7 +82,7 @@ proposal to send it somewhere. Let's send 5 of the 10 tokens to our address (we can find that with `drk wallet --address`): ``` -$ ./drk dao propose 1 {YOUR_ADDRESS} 5 WCKD > proposal_tx +$ ./drk dao propose MiladyMakerDAO {YOUR_ADDRESS} 5 WCKD > proposal_tx $ ./drk broadcast < proposal_tx ``` @@ -83,9 +90,44 @@ Once finalized and scanned, the proposal should be viewable in the wallet. We can see this with the `proposal` subcommands: ``` -$ ./drk dao proposals 1 -$ ./drk dao proposal 1 1 +$ ./drk dao proposals MiladyMakerDAO +$ ./drk dao proposal MiladyMakerDAO 1 ``` -NOTE: vote & exec is todo, check src/contract/dao/ for code. +## Voting on a proposal + +Now the DAO members are ready to cast their votes. +First lets check the `dao vote` subcommand usage. + +``` +$ drk help dao vote +Vote on a given proposal + +Usage: drk dao vote + +Arguments: + Name or numeric identifier for the DAO + Numeric identifier for the proposal + Vote (0 for NO, 1 for YES) + Vote weight (amount of governance tokens) +``` + +Lets use our 20 MLDY to vote yes to proposal 1. + +``` +$ drk dao vote MiladyMakerDAO 1 1 20 > /tmp/dao-vote.tx +$ drk broadcast < /tmp/dao-vote.tx +``` + +## Executing the proposal + +Once enough votes have been cast that meet the required minimum (quorum) +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 +action. + +``` +$ drk dao exec MiladyMakerDAO 1 > /tmp/dao-exec.tx +$ drk broadcast < /tmp/dao-exec.tx +```