Repository: DA0-DA0/dao-contracts (rust)

Issue:
Enum variants should all use `Name {}` form.
In the interest of being consistent and making enums easy to write out in the frontend we should use the `Name {}` form for all our enum variants. I messed some of these up while writing the `cw-govmod-single` and `cw-governance` contract.

Specifically, the `Admin` and `TokenInfo` enums both have fields that don't follow this format.

Pull request description:
Consistent use of `Name {}` style enums.
Resolves #209.

Patch:
diff --git a/contracts/cw-governance/src/helpers.rs b/contracts/cw-governance/src/helpers.rs
index 05d4002e..72102892 100644
--- a/contracts/cw-governance/src/helpers.rs
+++ b/contracts/cw-governance/src/helpers.rs
@@ -8,7 +8,7 @@ impl ModuleInstantiateInfo {
             admin: match self.admin {
                 Admin::Address { addr } => Some(addr),
                 Admin::GovernanceContract {} => Some(contract_address.to_string()),
-                Admin::None => None,
+                Admin::None {} => None,
             },
             code_id: self.code_id,
             msg: self.msg,
diff --git a/contracts/cw-governance/src/msg.rs b/contracts/cw-governance/src/msg.rs
index f33715a7..1b89d96b 100644
--- a/contracts/cw-governance/src/msg.rs
+++ b/contracts/cw-governance/src/msg.rs
@@ -16,7 +16,7 @@ pub enum Admin {
     /// while instantiation takes place.
     GovernanceContract {},
     /// No admin.
-    None,
+    None {},
 }
 
 /// Information needed to instantiate a governance or voting module.
diff --git a/contracts/cw-govmod-single/src/msg.rs b/contracts/cw-govmod-single/src/msg.rs
index 03284f65..2cbf45a5 100644
--- a/contracts/cw-govmod-single/src/msg.rs
+++ b/contracts/cw-govmod-single/src/msg.rs
@@ -28,14 +28,14 @@ pub struct InstantiateMsg {
 #[serde(rename_all = "snake_case")]
 pub enum DepositToken {
     /// Use a specific token address as the deposit token.
-    Token(String),
+    Token { address: String },
     /// Use the token address of the associated DAO's voting
     /// module. NOTE: in order to use the token address of the voting
     /// module the voting module must (1) use a cw20 token and (2)
     /// implement the `TokenContract {}` query type defined by
     /// `cw_governance_macros::token_query`. Failing to implement that
     /// and using this option will cause instantiation to fail.
-    VotingModuleToken,
+    VotingModuleToken {},
 }
 
 /// Information about the deposit required to create a proposal.
diff --git a/contracts/cw-govmod-single/src/state.rs b/contracts/cw-govmod-single/src/state.rs
index 19d5ce7a..83e0cfc6 100644
--- a/contracts/cw-govmod-single/src/state.rs
+++ b/contracts/cw-govmod-single/src/state.rs
@@ -67,8 +67,8 @@ impl DepositInfo {
             refund_failed_proposals,
         } = self;
         let token = match token {
-            DepositToken::Token(token) => deps.api.addr_validate(&token)?,
-            DepositToken::VotingModuleToken => {
+            DepositToken::Token { address } => deps.api.addr_validate(&address)?,
+            DepositToken::VotingModuleToken {} => {
                 let voting_module: Addr = deps
                     .querier
                     .query_wasm_smart(dao, &cw_governance::msg::QueryMsg::VotingModule {})?;


Test patch:
diff --git a/contracts/cw-govmod-single/src/tests.rs b/contracts/cw-govmod-single/src/tests.rs
index 3afd4f25..baa8d971 100644
--- a/contracts/cw-govmod-single/src/tests.rs
+++ b/contracts/cw-govmod-single/src/tests.rs
@@ -753,7 +753,7 @@ fn test_voting_module_token_proposal_deposit_instantiate() {
         max_voting_period,
         only_members_execute: false,
         deposit_info: Some(DepositInfo {
-            token: DepositToken::VotingModuleToken,
+            token: DepositToken::VotingModuleToken {},
             deposit: Uint128::new(1),
             refund_failed_proposals: true,
         }),
@@ -828,7 +828,9 @@ fn test_different_token_proposal_deposit() {
         max_voting_period,
         only_members_execute: false,
         deposit_info: Some(DepositInfo {
-            token: DepositToken::Token(cw20_addr.to_string()),
+            token: DepositToken::Token {
+                address: cw20_addr.to_string(),
+            },
             deposit: Uint128::new(1),
             refund_failed_proposals: true,
         }),
@@ -881,7 +883,9 @@ fn test_bad_token_proposal_deposit() {
         max_voting_period,
         only_members_execute: false,
         deposit_info: Some(DepositInfo {
-            token: DepositToken::Token(votemod_addr.to_string()),
+            token: DepositToken::Token {
+                address: votemod_addr.to_string(),
+            },
             deposit: Uint128::new(1),
             refund_failed_proposals: true,
         }),
@@ -904,7 +908,7 @@ fn test_take_proposal_deposit() {
         max_voting_period,
         only_members_execute: false,
         deposit_info: Some(DepositInfo {
-            token: DepositToken::VotingModuleToken,
+            token: DepositToken::VotingModuleToken {},
             deposit: Uint128::new(1),
             refund_failed_proposals: true,
         }),
@@ -1014,7 +1018,7 @@ fn test_deposit_return_on_execute() {
         Status::Passed,
         None,
         Some(DepositInfo {
-            token: DepositToken::VotingModuleToken,
+            token: DepositToken::VotingModuleToken {},
             deposit: Uint128::new(1),
             refund_failed_proposals: false,
         }),
@@ -1086,7 +1090,7 @@ fn test_close_open_proposal() {
         Status::Open,
         Some(Uint128::new(100)),
         Some(DepositInfo {
-            token: DepositToken::VotingModuleToken,
+            token: DepositToken::VotingModuleToken {},
             deposit: Uint128::new(1),
             refund_failed_proposals: true,
         }),
@@ -1160,7 +1164,7 @@ fn test_deposit_return_on_close() {
         Status::Rejected,
         None,
         Some(DepositInfo {
-            token: DepositToken::VotingModuleToken,
+            token: DepositToken::VotingModuleToken {},
             deposit: Uint128::new(1),
             refund_failed_proposals: true,
         }),
@@ -1232,7 +1236,7 @@ fn test_no_return_if_no_refunds() {
         Status::Rejected,
         None,
         Some(DepositInfo {
-            token: DepositToken::VotingModuleToken,
+            token: DepositToken::VotingModuleToken {},
             deposit: Uint128::new(1),
             refund_failed_proposals: false,
         }),