Repository: CosmWasm/sylvia
Pull request #15 (2022-08-22 10:20:40)

Remove modules msg and contract


Patch:
diff --git a/contracts/cw1-whitelist/src/contract.rs b/contracts/cw1-whitelist/src/contract.rs
index 871268c..74f62cf 100644
--- a/contracts/cw1-whitelist/src/contract.rs
+++ b/contracts/cw1-whitelist/src/contract.rs
@@ -40,8 +40,8 @@ impl Cw1 for Cw1WhitelistContract {
     }
 }
 
-#[contract(module=contract, error=ContractError)]
-#[messages(msg as Cw1)]
+#[contract(error=ContractError)]
+#[messages(cw1 as Cw1)]
 impl Cw1WhitelistContract {
     pub const fn new() -> Self {
         Self {
@@ -72,7 +72,7 @@ mod tests {
         to_binary,
     };
 
-    use crate::contract::contract::InstantiateMsg;
+    use crate::contract::InstantiateMsg;
 
     use super::*;
 
diff --git a/contracts/cw1-whitelist/src/lib.rs b/contracts/cw1-whitelist/src/lib.rs
index dbad154..d5bc132 100644
--- a/contracts/cw1-whitelist/src/lib.rs
+++ b/contracts/cw1-whitelist/src/lib.rs
@@ -9,10 +9,7 @@ pub mod entry_points {
     };
 
     use crate::{
-        contract::{
-            contract::{ExecMsg, InstantiateMsg, QueryMsg},
-            Cw1WhitelistContract,
-        },
+        contract::{Cw1WhitelistContract, ExecMsg, InstantiateMsg, QueryMsg},
         error::ContractError,
     };
 
diff --git a/contracts/cw1/src/lib.rs b/contracts/cw1/src/lib.rs
index 1ba94d8..8d93e92 100644
--- a/contracts/cw1/src/lib.rs
+++ b/contracts/cw1/src/lib.rs
@@ -10,7 +10,7 @@ pub struct FindMemberResponse {
     pub is_present: bool,
 }
 
-#[interface(module=msg)]
+#[interface]
 pub trait Cw1 {
     type Error: From<StdError>;
 
@@ -37,35 +37,35 @@ mod tests {
 
     #[test]
     fn execute() {
-        let original_msg = msg::ExecMsg::AddMember {
+        let original_msg = ExecMsg::AddMember {
             member: "member_name".to_owned(),
         };
 
         let serialized_msg = to_binary(&original_msg).unwrap();
-        let serialized_msg: msg::ExecMsg = from_binary(&serialized_msg).unwrap();
+        let serialized_msg: ExecMsg = from_binary(&serialized_msg).unwrap();
 
         assert_eq!(serialized_msg, original_msg);
     }
 
     #[test]
     fn query() {
-        let original_msg = msg::QueryMsg::FindMember {
+        let original_msg = QueryMsg::FindMember {
             member: "member_name".to_owned(),
         };
 
         let serialized_msg = to_binary(&original_msg).unwrap();
-        let serialized_msg: msg::QueryMsg = from_binary(&serialized_msg).unwrap();
+        let serialized_msg: QueryMsg = from_binary(&serialized_msg).unwrap();
 
         assert_eq!(serialized_msg, original_msg);
     }
 
     #[test]
     fn execute_from_slice() {
-        let deserialized: msg::ExecMsg =
+        let deserialized: ExecMsg =
             from_slice(br#"{"add_member": {"member": "some_member"}}"#).unwrap();
         assert_eq!(
             deserialized,
-            msg::ExecMsg::AddMember {
+            ExecMsg::AddMember {
                 member: "some_member".to_owned()
             }
         );
@@ -73,11 +73,11 @@ mod tests {
 
     #[test]
     fn query_from_slice() {
-        let deserialized: msg::QueryMsg =
+        let deserialized: QueryMsg =
             from_slice(br#"{"find_member": {"member": "some_member"}}"#).unwrap();
         assert_eq!(
             deserialized,
-            msg::QueryMsg::FindMember {
+            QueryMsg::FindMember {
                 member: "some_member".to_owned()
             }
         );


Test patch:
diff --git a/contracts/cw1-whitelist/src/multitest.rs b/contracts/cw1-whitelist/src/multitest.rs
index ed23b26..71e4be9 100644
--- a/contracts/cw1-whitelist/src/multitest.rs
+++ b/contracts/cw1-whitelist/src/multitest.rs
@@ -1,14 +1,11 @@
 #[cfg(test)]
 mod test {
-    use crate::contract::{contract::InstantiateMsg, Cw1WhitelistContract};
+    use crate::contract::{InstantiateMsg, Cw1WhitelistContract};
     use anyhow::{bail, Result as AnyResult};
     use cosmwasm_std::{
         from_slice, Addr, Binary, DepsMut, Empty, Env, MessageInfo, Reply, Response,
     };
-    use cw1::{
-        msg::{ExecMsg, QueryMsg},
-        FindMemberResponse,
-    };
+    use cw1::{ExecMsg, FindMemberResponse, QueryMsg};
     use cw_multi_test::{AppBuilder, Contract, Executor};
 
     impl Contract<Empty> for Cw1WhitelistContract {