1
1
use bounded_collections:: Get ;
2
2
use cosmrs:: tendermint:: block:: Height ;
3
3
use cosmwasm_std:: { Addr , Coin , Coins , Empty } ;
4
- use cvm_route:: { asset:: { AssetItem , AssetReference , NetworkAssetItem } , exchange:: ExchangeItem , transport:: { NetworkToNetworkItem , OtherNetworkItem } , venue:: AssetsVenueItem } ;
4
+ use cvm_route:: {
5
+ asset:: { AssetItem , AssetReference , NetworkAssetItem } ,
6
+ exchange:: ExchangeItem ,
7
+ transport:: { NetworkToNetworkItem , OtherNetworkItem } ,
8
+ venue:: AssetsVenueItem ,
9
+ } ;
5
10
use cw_cvm_outpost:: msg:: { CvmGlt , HereItem , NetworkItem , OutpostId } ;
6
11
use cw_mantis_order:: { OrderItem , OrderSubMsg } ;
7
12
use cw_multi_test:: { App , Contract , ContractWrapper , Executor } ;
@@ -57,26 +62,25 @@ async fn cvm_devnet_case() {
57
62
cvm_address : cw_cvm_outpost_contract. clone ( ) ,
58
63
} ;
59
64
60
-
61
65
let cw_mantis_contract = centauri
62
- . instantiate_contract (
63
- cw_mantis_order_code_id,
64
- admin,
65
- & cw_mantis_order_instantiate,
66
- & [ ] ,
67
- "composable_mantis_order" ,
68
- None ,
69
- )
70
- . unwrap ( ) ;
66
+ . instantiate_contract (
67
+ cw_mantis_order_code_id,
68
+ admin,
69
+ & cw_mantis_order_instantiate,
70
+ & [ ] ,
71
+ "composable_mantis_order" ,
72
+ None ,
73
+ )
74
+ . unwrap ( ) ;
71
75
72
76
let sender = Addr :: unchecked ( "juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y" ) ;
73
-
77
+
74
78
let ACoin = |x : u128 | Coin {
75
79
denom : "a" . to_string ( ) ,
76
80
amount : x. into ( ) ,
77
81
} ;
78
82
79
- let BCoin = |x : u128 | Coin {
83
+ let BCoin = |x : u128 | Coin {
80
84
denom : "b" . to_string ( ) ,
81
85
amount : x. into ( ) ,
82
86
} ;
@@ -85,11 +89,10 @@ async fn cvm_devnet_case() {
85
89
owner : sender. clone ( ) ,
86
90
msg : OrderSubMsg {
87
91
wants : ACoin ( 100 ) ,
88
- timeout : centauri. block_info ( ) . height + 100 ,
92
+ timeout : centauri. block_info ( ) . height + 100 ,
89
93
convert : None ,
90
94
min_fill : None ,
91
95
virtual_given : None ,
92
-
93
96
} ,
94
97
given : BCoin ( 100 ) ,
95
98
order_id : 1u128 . into ( ) ,
@@ -99,23 +102,21 @@ async fn cvm_devnet_case() {
99
102
owner : sender. clone ( ) ,
100
103
msg : OrderSubMsg {
101
104
wants : BCoin ( 1000 ) ,
102
- timeout : centauri. block_info ( ) . height + 100 ,
105
+ timeout : centauri. block_info ( ) . height + 100 ,
103
106
convert : None ,
104
107
min_fill : None ,
105
108
virtual_given : None ,
106
-
107
109
} ,
108
110
given : ACoin ( 1000 ) ,
109
111
order_id : 2u128 . into ( ) ,
110
112
} ;
111
113
let active_orders = vec ! [ a_to_b, b_to_a] ;
112
114
let alice = from_mnemonic (
113
- "document prefer nurse marriage flavor cheese west when knee drink sorry minimum thunder tilt cherry behave cute stove elder couch badge gown coral expire"
114
- ,
115
+ "document prefer nurse marriage flavor cheese west when knee drink sorry minimum thunder tilt cherry behave cute stove elder couch badge gown coral expire" ,
115
116
"m/44'/118'/0'/0/0" , ) . unwrap ( ) ;
116
117
let tip = Tip {
117
118
block : Height :: default ( ) ,
118
- account : cosmos_sdk_proto:: cosmos:: auth:: v1beta1:: BaseAccount {
119
+ account : cosmos_sdk_proto:: cosmos:: auth:: v1beta1:: BaseAccount {
119
120
address : alice. public_key ( ) . to_string ( ) ,
120
121
pub_key : Some ( alice. public_key ( ) . to_any ( ) . unwrap ( ) ) ,
121
122
account_number : 1 ,
@@ -129,28 +130,62 @@ async fn cvm_devnet_case() {
129
130
NetworkToNetworkItem :: new( 2 . into( ) , 1 . into( ) , OtherNetworkItem :: new( ) ) ,
130
131
] ,
131
132
assets : vec ! [
132
- AssetItem :: new( 11 . into( ) , 1 . into( ) , AssetReference :: Native { denom: "a" . to_string( ) } ) ,
133
- AssetItem :: new( 12 . into( ) , 1 . into( ) , AssetReference :: Native { denom: "ibc/b" . to_string( ) } ) ,
134
- AssetItem :: new( 21 . into( ) , 2 . into( ) , AssetReference :: Native { denom: "b" . to_string( ) } ) ,
135
- AssetItem :: new( 22 . into( ) , 2 . into( ) , AssetReference :: Native { denom: "ibc/a" . to_string( ) } ) ,
133
+ AssetItem :: new(
134
+ 11 . into( ) ,
135
+ 1 . into( ) ,
136
+ AssetReference :: Native {
137
+ denom: "a" . to_string( ) ,
138
+ } ,
139
+ ) ,
140
+ AssetItem :: new(
141
+ 12 . into( ) ,
142
+ 1 . into( ) ,
143
+ AssetReference :: Native {
144
+ denom: "ibc/b" . to_string( ) ,
145
+ } ,
146
+ ) ,
147
+ AssetItem :: new(
148
+ 21 . into( ) ,
149
+ 2 . into( ) ,
150
+ AssetReference :: Native {
151
+ denom: "b" . to_string( ) ,
152
+ } ,
153
+ ) ,
154
+ AssetItem :: new(
155
+ 22 . into( ) ,
156
+ 2 . into( ) ,
157
+ AssetReference :: Native {
158
+ denom: "ibc/a" . to_string( ) ,
159
+ } ,
160
+ ) ,
136
161
] ,
137
- exchanges :
138
- vec ! [
139
- ExchangeItem :: new( 1 . into( ) , 2 . into( ) , cvm_route:: exchange:: ExchangeType :: OsmosisPoolManagerModuleV1Beta1 { pool_id: 1 , token_a: "b" . to_string( ) , token_b: "ibc/a" . to_string( ) } ) ,
140
- ] ,
141
- networks :
142
- vec ! [
162
+ exchanges : vec ! [ ExchangeItem :: new(
163
+ 1 . into( ) ,
164
+ 2 . into( ) ,
165
+ cvm_route:: exchange:: ExchangeType :: OsmosisPoolManagerModuleV1Beta1 {
166
+ pool_id: 1 ,
167
+ token_a: "b" . to_string( ) ,
168
+ token_b: "ibc/a" . to_string( ) ,
169
+ } ,
170
+ ) ] ,
171
+ networks : vec ! [
143
172
NetworkItem {
144
173
network_id: 1 . into( ) ,
145
- outpost: Some (
146
- OutpostId :: CosmWasm { contract: cw_cvm_outpost_contract. clone( ) , executor_code_id: cw_cvm_executor_code_id, admin: sender. clone( ) } ) ,
174
+ outpost: Some ( OutpostId :: CosmWasm {
175
+ contract: cw_cvm_outpost_contract. clone( ) ,
176
+ executor_code_id: cw_cvm_executor_code_id,
177
+ admin: sender. clone( ) ,
178
+ } ) ,
147
179
accounts: None ,
148
180
ibc: None ,
149
181
} ,
150
182
NetworkItem {
151
183
network_id: 2 . into( ) ,
152
- outpost: Some (
153
- OutpostId :: CosmWasm { contract: cw_cvm_outpost_contract. clone( ) , executor_code_id: cw_cvm_executor_code_id, admin: sender. clone( ) } ) ,
184
+ outpost: Some ( OutpostId :: CosmWasm {
185
+ contract: cw_cvm_outpost_contract. clone( ) ,
186
+ executor_code_id: cw_cvm_executor_code_id,
187
+ admin: sender. clone( ) ,
188
+ } ) ,
154
189
accounts: None ,
155
190
ibc: None ,
156
191
} ,
@@ -162,15 +197,25 @@ async fn cvm_devnet_case() {
162
197
NetworkAssetItem :: new( 1 . into( ) , 22 . into( ) , 11 . into( ) ) ,
163
198
] ,
164
199
asset_venue_items : vec ! [
165
- AssetsVenueItem :: new( cvm_route:: venue:: VenueId :: Exchange ( 1 . into( ) ) , 21 . into( ) , 22 . into( ) ) ,
166
- AssetsVenueItem :: new( cvm_route:: venue:: VenueId :: Exchange ( 1 . into( ) ) , 22 . into( ) , 21 . into( ) ) ,
200
+ AssetsVenueItem :: new(
201
+ cvm_route:: venue:: VenueId :: Exchange ( 1 . into( ) ) ,
202
+ 21 . into( ) ,
203
+ 22 . into( ) ,
204
+ ) ,
205
+ AssetsVenueItem :: new(
206
+ cvm_route:: venue:: VenueId :: Exchange ( 1 . into( ) ) ,
207
+ 22 . into( ) ,
208
+ 21 . into( ) ,
209
+ ) ,
167
210
] ,
168
211
} ) ;
169
- let solution = mantis_node:: mantis:: blackbox:: solve :: < True > ( active_orders, & alice, & tip, cvm_glt, router) . await ;
212
+ let solution =
213
+ mantis_node:: mantis:: blackbox:: solve :: < True > ( active_orders, & alice, & tip, cvm_glt, router)
214
+ . await ;
170
215
panic ! ( "solution: {:?}" , solution) ;
171
216
}
172
217
173
- enum True { }
218
+ enum True { }
174
219
175
220
impl Get < bool > for True {
176
221
fn get ( ) -> bool {
0 commit comments