1
1
// This contains all code we needed to manually add to make it work well with cw-orch
2
2
// In the future, hopefully some of this can me auto-generated. But let's get it to work now.
3
- use crate :: contract:: entry_points:: { execute, instantiate, query} ;
3
+
4
+ // use crate::contract::entry_points::{execute, instantiate, query};
5
+ // use crate::contract::sv::mt;
6
+
4
7
use crate :: contract:: sv:: { ContractExecMsg , ContractQueryMsg , ContractSudoMsg , InstantiateMsg } ;
5
8
use cw_orch:: prelude:: * ;
6
9
7
10
// Maybe uploadable can be autogenerated?
8
11
// But this is fine to include in the client code
9
12
13
+ #[ cfg( any( feature = "mt" , test) ) ]
14
+ impl < ' a > MockContract < Empty > for crate :: contract:: VaultContract < ' a > {
15
+ fn execute (
16
+ & self ,
17
+ deps : cosmwasm_std:: DepsMut < Empty > ,
18
+ env : cosmwasm_std:: Env ,
19
+ info : cosmwasm_std:: MessageInfo ,
20
+ msg : Vec < u8 > ,
21
+ ) -> anyhow:: Result < cosmwasm_std:: Response < Empty > > {
22
+ sylvia:: cw_multi_test:: Contract :: execute ( self , deps, env, info, msg)
23
+ }
24
+
25
+ fn instantiate (
26
+ & self ,
27
+ deps : cosmwasm_std:: DepsMut < Empty > ,
28
+ env : cosmwasm_std:: Env ,
29
+ info : cosmwasm_std:: MessageInfo ,
30
+ msg : Vec < u8 > ,
31
+ ) -> anyhow:: Result < cosmwasm_std:: Response < Empty > > {
32
+ sylvia:: cw_multi_test:: Contract :: instantiate ( self , deps, env, info, msg)
33
+ }
34
+
35
+ fn query (
36
+ & self ,
37
+ deps : cosmwasm_std:: Deps < Empty > ,
38
+ env : cosmwasm_std:: Env ,
39
+ msg : Vec < u8 > ,
40
+ ) -> anyhow:: Result < cosmwasm_std:: Binary > {
41
+ sylvia:: cw_multi_test:: Contract :: query ( self , deps, env, msg)
42
+ }
43
+
44
+ fn sudo (
45
+ & self ,
46
+ deps : cosmwasm_std:: DepsMut < Empty > ,
47
+ env : cosmwasm_std:: Env ,
48
+ msg : Vec < u8 > ,
49
+ ) -> anyhow:: Result < cosmwasm_std:: Response < Empty > > {
50
+ sylvia:: cw_multi_test:: Contract :: sudo ( self , deps, env, msg)
51
+ }
52
+
53
+ fn reply (
54
+ & self ,
55
+ deps : cosmwasm_std:: DepsMut < Empty > ,
56
+ env : cosmwasm_std:: Env ,
57
+ msg : cosmwasm_std:: Reply ,
58
+ ) -> anyhow:: Result < cosmwasm_std:: Response < Empty > > {
59
+ sylvia:: cw_multi_test:: Contract :: reply ( self , deps, env, msg)
60
+ }
61
+
62
+ fn migrate (
63
+ & self ,
64
+ deps : cosmwasm_std:: DepsMut < Empty > ,
65
+ env : cosmwasm_std:: Env ,
66
+ msg : Vec < u8 > ,
67
+ ) -> anyhow:: Result < cosmwasm_std:: Response < Empty > > {
68
+ sylvia:: cw_multi_test:: Contract :: migrate ( self , deps, env, msg)
69
+ }
70
+ }
71
+
10
72
#[ cw_orch:: interface( InstantiateMsg , ContractExecMsg , ContractQueryMsg , Empty ) ]
11
73
pub struct MeshVault ;
12
74
@@ -17,9 +79,17 @@ impl<Chain> Uploadable for MeshVault<Chain> {
17
79
. find_wasm_path ( "mesh_vault" )
18
80
. unwrap ( )
19
81
}
82
+
20
83
/// Returns a CosmWasm contract wrapper
84
+ #[ cfg( any( feature = "mt" , test) ) ]
85
+ fn wrapper ( ) -> Box < dyn MockContract < Empty > > {
86
+ let c = crate :: contract:: VaultContract :: new ( ) ;
87
+ Box :: new ( c)
88
+ }
89
+
90
+ #[ cfg( not( any( feature = "mt" , test) ) ) ]
21
91
fn wrapper ( ) -> Box < dyn MockContract < Empty > > {
22
- Box :: new ( ContractWrapper :: new_with_empty ( execute , instantiate , query ) )
92
+ panic ! ( "Multitest only implemented in tests or with 'mt' feature" ) ;
23
93
}
24
94
}
25
95
0 commit comments