@@ -217,7 +217,7 @@ mod tests {
217
217
order_bytes : hex:: decode ( "6c449988e2f33302803c93f8287dc1d8cb33848a" ) . unwrap ( ) ,
218
218
solver_address : "0xcb0a6bbccfccde6be9f10ae781b9d9b00d6e63" . to_string ( ) ,
219
219
} ;
220
- assert ! ( fill. rlp_bytes( ) ==hex:: decode( "f84301946c449988e2f33302803c93f8287dc1d8cb33848aa8307863623061366262636366636364653662653966313061653738316239643962303064366536338201f401 " ) . unwrap( ) ) ;
220
+ assert ! ( fill. rlp_bytes( ) ==hex:: decode( "f83f01946c449988e2f33302803c93f8287dc1d8cb33848aa830786362306136626263636663636465366265396631306165373831623964396230306436653633 " ) . unwrap( ) ) ;
221
221
}
222
222
223
223
#[ test]
@@ -227,9 +227,49 @@ mod tests {
227
227
order_bytes : hex:: decode ( "cb0a6bbccfccde6be9f10ae781b9d9b00d6e63" ) . unwrap ( ) ,
228
228
solver_address : "0x6c449988e2f33302803c93f8287dc1d8cb33848a" . to_string ( ) ,
229
229
} ;
230
- assert ! ( fill. rlp_bytes( ) ==hex:: decode( "f84b0293cb0a6bbccfccde6be9f10ae781b9d9b00d6e63aa3078366334343939383865326633333330323830336339336638323837646331643863623333383438618928a857425466f8000000 " ) . unwrap( ) ) ;
230
+ assert ! ( fill. rlp_bytes( ) ==hex:: decode( "f8400293cb0a6bbccfccde6be9f10ae781b9d9b00d6e63aa307836633434393938386532663333333032383033633933663832383764633164386362333338343861 " ) . unwrap( ) ) ;
231
231
}
232
232
233
233
#[ test]
234
- fn test_order_cancel_encoding ( ) { }
234
+ fn test_order_cancel_encoding ( ) {
235
+ let cancel= OrderCancel {
236
+ order_bytes : hex:: decode ( "6c449988e2f33302803c93f8287dc1d8cb33848a" ) . unwrap ( ) ,
237
+ } ;
238
+ assert ! ( cancel. rlp_bytes( ) ==hex:: decode( "d5946c449988e2f33302803c93f8287dc1d8cb33848a" ) . unwrap( ) ) ;
239
+ }
240
+
241
+ #[ test]
242
+ fn test_swap_order_encoding ( ) {
243
+ let order =SwapOrder {
244
+ id : 1 ,
245
+ emitter : "0xbe6452d4d6c61cee97d3" . to_string ( ) ,
246
+ src_nid : "Ethereum" . to_string ( ) ,
247
+ dst_nid : "Polygon" . to_string ( ) ,
248
+ creator : "0x3e36eddd65e239222e7e67" . to_string ( ) ,
249
+ destination_address : "0xd2c6218b875457a41b6fb7964e" . to_string ( ) ,
250
+ token : "0x14355340e857912188b7f202d550222487" . to_string ( ) ,
251
+ amount : 1000 ,
252
+ to_token : "0x91a4728b517484f0f610de7b" . to_string ( ) ,
253
+ to_amount : 900 ,
254
+ data : vec ! [ ] ,
255
+ } ;
256
+ assert ! ( order. rlp_bytes( ) ==hex:: decode( "f8a601963078626536343532643464366336316365653937643388457468657265756d87506f6c79676f6e983078336533366564646436356532333932323265376536379c30786432633632313862383735343537613431623666623739363465a43078313433353533343065383537393132313838623766323032643535303232323438378203e89a307839316134373238623531373438346630663631306465376282038480" ) . unwrap( ) ) ;
257
+
258
+ let order =SwapOrder {
259
+ id : 1 ,
260
+ emitter : "0xbe6452d4d6c61cee97d3" . to_string ( ) ,
261
+ src_nid : "Ethereum" . to_string ( ) ,
262
+ dst_nid : "Polygon" . to_string ( ) ,
263
+ creator : "0x3e36eddd65e239222e7e67" . to_string ( ) ,
264
+ destination_address : "0xd2c6218b875457a41b6fb7964e" . to_string ( ) ,
265
+ token : "0x14355340e857912188b7f202d550222487" . to_string ( ) ,
266
+ amount : 100000 * 10000000000000000000000 ,
267
+ to_token : "0x91a4728b517484f0f610de7b" . to_string ( ) ,
268
+ to_amount : 900 * 10000000 ,
269
+ data : hex:: decode ( "6c449988e2f33302803c93f8287dc1d8cb33848a" ) . unwrap ( ) ,
270
+ } ;
271
+ assert ! ( order. rlp_bytes( ) ==hex:: decode( "f8c701963078626536343532643464366336316365653937643388457468657265756d87506f6c79676f6e983078336533366564646436356532333932323265376536379c30786432633632313862383735343537613431623666623739363465a43078313433353533343065383537393132313838623766323032643535303232323438378c033b2e3c9fd0803ce80000009a3078393161343732386235313734383466306636313064653762850218711a00946c449988e2f33302803c93f8287dc1d8cb33848a" ) . unwrap( ) ) ;
272
+
273
+
274
+ }
235
275
}
0 commit comments