Browse Source

dao: added TODO file and left comments on main.rs

lunar-mining 3 years ago
parent
commit
7eec27e359
2 changed files with 66 additions and 0 deletions
  1. 38 0
      bin/dao/daod/TODO
  2. 28 0
      bin/dao/daod/src/main.rs

+ 38 - 0
bin/dao/daod/TODO

@@ -0,0 +1,38 @@
+priority: immediate
+
+* delete init() rpc
+        * we don't need this as we will just call initialize automatically on first run.
+
+* split demo() into smaller functions that correspond with rpc requests
+        * see comments on main.rs
+        * these are super basic/ dumb right now, we will start small and gradually improve
+
+* make main() into an async daemon
+        * rpc interface must detach in the background so we can run other
+        methods
+        * can use darkfi::util::cli::async_daemonize to be standard with
+        other binaries, but it's not essential for this demo as we do
+        not need a config or options rn.
+
+priority: mid
+
+* move schema.rs to darkfi/example
+        * rename it to dao.rs
+        * we want to be able to run it like how we run example/tx.rs
+        * cargo run --example dao
+        * and it should compile and work
+
+* figure out where to put example()
+        * we have contract/example_contract 
+        * the contract code can stay put, but where should we run it? the code
+        * example() which shows the usage is also useful to have.
+
+priority: low
+
+* the things in util.rs are not all utils
+        * some of them should be moved to other modules eventually
+
+* rename [foo]_contract to just foo
+        * contract/dao_contract/ is redundant
+        * we can just have contract/dao
+

+ 28 - 0
bin/dao/daod/src/main.rs

@@ -63,6 +63,10 @@ async fn demo() -> Result<()> {
     //// TODO: this will be moved to a different file
     //example().await?;
 
+    /////////////////////////////////////////////////
+    //// TODO: move to init()
+    /////////////////////////////////////////////////
+
     // Money parameters
     let xdrk_supply = 1_000_000;
     let xdrk_token_id = pallas::Base::random(&mut OsRng);
@@ -142,6 +146,10 @@ async fn demo() -> Result<()> {
     let dao_state = dao_contract::State::new();
     states.register(*dao_contract::CONTRACT_ID, dao_state);
 
+    /////////////////////////////////////////////////
+    //// TODO: move to create()
+    /////////////////////////////////////////////////
+
     /////////////////////////////////////////////////////
     ////// Create the DAO bulla
     /////////////////////////////////////////////////////
@@ -218,6 +226,10 @@ async fn demo() -> Result<()> {
     };
     debug!(target: "demo", "Create DAO bulla: {:?}", dao_bulla.0);
 
+    /////////////////////////////////////////////////
+    //// TODO: move to mint()
+    /////////////////////////////////////////////////
+
     ///////////////////////////////////////////////////
     //// Mint the initial supply of treasury token
     //// and send it all to the DAO directly
@@ -320,6 +332,10 @@ async fn demo() -> Result<()> {
 
     debug!("DAO received a coin worth {} xDRK", treasury_note.value);
 
+    /////////////////////////////////////////////////
+    //// TODO: move to airdrop()
+    /////////////////////////////////////////////////
+
     ///////////////////////////////////////////////////
     //// Mint the governance token
     //// Send it to three hodlers
@@ -469,6 +485,10 @@ async fn demo() -> Result<()> {
     //   output 1: change address
     ///////////////////////////////////////////////////
 
+    /////////////////////////////////////////////////
+    //// TODO: move to propose()
+    /////////////////////////////////////////////////
+
     ///////////////////////////////////////////////////
     // Propose the vote
     // In order to make a valid vote, first the proposer must
@@ -618,6 +638,10 @@ async fn demo() -> Result<()> {
     // beginning of gov period
     // Cannot use nullifiers from before voting period
 
+    /////////////////////////////////////////////////
+    //// TODO: move to vote()
+    /////////////////////////////////////////////////
+
     debug!(target: "demo", "Stage 5. Start voting");
 
     // We were previously saving updates here for testing
@@ -941,6 +965,10 @@ async fn demo() -> Result<()> {
     assert!(all_votes_commit == pedersen_commitment_u64(all_votes_value, all_votes_blind));
     assert!(yes_votes_commit == pedersen_commitment_u64(yes_votes_value, yes_votes_blind));
 
+    /////////////////////////////////////////////////
+    //// TODO: move to exec()
+    /////////////////////////////////////////////////
+
     ///////////////////////////////////////////////////
     // Execute the vote
     ///////////////////////////////////////////////////