@@ -550,11 +550,11 @@ async fn get_quote(
550550 . map_err ( |_| OnchainOrderPlacementError :: Other ) ?;
551551
552552 let parameters = QuoteSearchParameters {
553- sell_token : H160 :: from ( order_data. sell_token . 0 ) ,
554- buy_token : H160 :: from ( order_data. buy_token . 0 ) ,
555- sell_amount : order_data. sell_amount ,
556- buy_amount : order_data. buy_amount ,
557- fee_amount : order_data. fee_amount ,
553+ sell_token : order_data. sell_token . into_legacy ( ) ,
554+ buy_token : order_data. buy_token . into_legacy ( ) ,
555+ sell_amount : order_data. sell_amount . into_legacy ( ) ,
556+ buy_amount : order_data. buy_amount . into_legacy ( ) ,
557+ fee_amount : order_data. fee_amount . into_legacy ( ) ,
558558 kind : order_data. kind ,
559559 signing_scheme : quote_signing_scheme,
560560 additional_gas : 0 ,
@@ -572,7 +572,7 @@ async fn get_quote(
572572 quoter,
573573 & parameters. clone ( ) ,
574574 Some ( * quote_id) ,
575- Some ( order_data. fee_amount ) ,
575+ Some ( order_data. fee_amount . into_legacy ( ) ) ,
576576 )
577577 . await
578578 . map_err ( |err| match err {
@@ -611,14 +611,14 @@ fn convert_onchain_order_placement(
611611 uid : ByteArray ( order_uid. 0 ) ,
612612 owner : ByteArray ( owner. 0 ) ,
613613 creation_timestamp : Utc . timestamp_opt ( event_timestamp, 0 ) . unwrap ( ) ,
614- sell_token : ByteArray ( order_data. sell_token . 0 ) ,
615- buy_token : ByteArray ( order_data. buy_token . 0 ) ,
616- receiver : order_data. receiver . map ( |h160 | ByteArray ( h160 . 0 ) ) ,
617- sell_amount : u256_to_big_decimal ( & order_data. sell_amount ) ,
618- buy_amount : u256_to_big_decimal ( & order_data. buy_amount ) ,
614+ sell_token : ByteArray ( order_data. sell_token . 0 . 0 ) ,
615+ buy_token : ByteArray ( order_data. buy_token . 0 . 0 ) ,
616+ receiver : order_data. receiver . map ( |addr | ByteArray ( addr . 0 . 0 ) ) ,
617+ sell_amount : u256_to_big_decimal ( & order_data. sell_amount . into_legacy ( ) ) ,
618+ buy_amount : u256_to_big_decimal ( & order_data. buy_amount . into_legacy ( ) ) ,
619619 valid_to : order_data. valid_to as i64 ,
620620 app_data : ByteArray ( order_data. app_data . 0 ) ,
621- fee_amount : u256_to_big_decimal ( & order_data. fee_amount ) ,
621+ fee_amount : u256_to_big_decimal ( & order_data. fee_amount . into_legacy ( ) ) ,
622622 kind : order_kind_into ( order_data. kind ) ,
623623 partially_fillable : order_data. partially_fillable ,
624624 signature : order_placement. signature . data . to_vec ( ) ,
@@ -662,14 +662,14 @@ fn extract_order_data_from_onchain_order_placement_event(
662662 } ;
663663
664664 let order_data = OrderData {
665- sell_token : order_placement. order . sellToken . into_legacy ( ) ,
666- buy_token : order_placement. order . buyToken . into_legacy ( ) ,
667- receiver : receiver . map ( IntoLegacy :: into_legacy ) ,
668- sell_amount : order_placement. order . sellAmount . into_legacy ( ) ,
669- buy_amount : order_placement. order . buyAmount . into_legacy ( ) ,
665+ sell_token : order_placement. order . sellToken ,
666+ buy_token : order_placement. order . buyToken ,
667+ receiver,
668+ sell_amount : order_placement. order . sellAmount ,
669+ buy_amount : order_placement. order . buyAmount ,
670670 valid_to : order_placement. order . validTo ,
671671 app_data : AppDataHash ( order_placement. order . appData . 0 ) ,
672- fee_amount : order_placement. order . feeAmount . into_legacy ( ) ,
672+ fee_amount : order_placement. order . feeAmount ,
673673 kind : OrderKind :: from_contract_bytes ( order_placement. order . kind . 0 ) ?,
674674 partially_fillable : order_placement. order . partiallyFillable ,
675675 sell_token_balance : SellTokenSource :: from_contract_bytes (
@@ -793,7 +793,10 @@ mod test {
793793 order:: { BuyTokenDestination , OrderData , OrderKind , SellTokenSource } ,
794794 signature:: SigningScheme ,
795795 } ,
796- number:: conversions:: u256_to_big_decimal,
796+ number:: conversions:: {
797+ alloy:: u256_to_big_decimal as alloy_u256_to_big_decimal,
798+ u256_to_big_decimal,
799+ } ,
797800 shared:: {
798801 db_order_conversions:: {
799802 buy_token_destination_into,
@@ -856,14 +859,14 @@ mod test {
856859 )
857860 . unwrap ( ) ;
858861 let expected_order_data = OrderData {
859- sell_token : sellToken. into_legacy ( ) ,
860- buy_token : buyToken. into_legacy ( ) ,
861- receiver : Some ( receiver. into_legacy ( ) ) ,
862- sell_amount : sellAmount. into_legacy ( ) ,
863- buy_amount : buyAmount. into_legacy ( ) ,
862+ sell_token : sellToken,
863+ buy_token : buyToken,
864+ receiver : Some ( receiver) ,
865+ sell_amount : sellAmount,
866+ buy_amount : buyAmount,
864867 valid_to : validTo,
865868 app_data : AppDataHash ( appData. 0 ) ,
866- fee_amount : feeAmount. into_legacy ( ) ,
869+ fee_amount : feeAmount,
867870 kind : OrderKind :: Sell ,
868871 partially_fillable : order_placement. order . partiallyFillable ,
869872 sell_token_balance : SellTokenSource :: Erc20 ,
@@ -906,14 +909,14 @@ mod test {
906909 )
907910 . unwrap ( ) ;
908911 let expected_order_data = OrderData {
909- sell_token : sellToken. into_legacy ( ) ,
910- buy_token : buyToken. into_legacy ( ) ,
912+ sell_token : sellToken,
913+ buy_token : buyToken,
911914 receiver : None ,
912- sell_amount : sellAmount. into_legacy ( ) ,
913- buy_amount : buyAmount. into_legacy ( ) ,
915+ sell_amount : sellAmount,
916+ buy_amount : buyAmount,
914917 valid_to : validTo,
915918 app_data : AppDataHash ( appData. 0 ) ,
916- fee_amount : feeAmount. into_legacy ( ) ,
919+ fee_amount : feeAmount,
917920 kind : OrderKind :: Sell ,
918921 partially_fillable : order_placement. order . partiallyFillable ,
919922 sell_token_balance : SellTokenSource :: Erc20 ,
@@ -938,14 +941,14 @@ mod test {
938941 let owner = Address :: from ( [ 5 ; 20 ] ) ;
939942
940943 let order_data = OrderData {
941- sell_token : sell_token . into_legacy ( ) ,
942- buy_token : buy_token . into_legacy ( ) ,
943- receiver : Some ( receiver. into_legacy ( ) ) ,
944- sell_amount : sell_amount . into_legacy ( ) ,
945- buy_amount : buy_amount . into_legacy ( ) ,
944+ sell_token,
945+ buy_token,
946+ receiver : Some ( receiver) ,
947+ sell_amount,
948+ buy_amount,
946949 valid_to,
947950 app_data : AppDataHash ( app_data) ,
948- fee_amount : fee_amount . into_legacy ( ) ,
951+ fee_amount,
949952 kind : OrderKind :: Sell ,
950953 partially_fillable : false ,
951954 sell_token_balance : SellTokenSource :: Erc20 ,
@@ -992,14 +995,14 @@ mod test {
992995 Metrics :: get ( ) ,
993996 ) ;
994997 let expected_order_data = OrderData {
995- sell_token : sell_token . into_legacy ( ) ,
996- buy_token : buy_token . into_legacy ( ) ,
997- receiver : Some ( receiver. into_legacy ( ) ) ,
998- sell_amount : sell_amount . into_legacy ( ) ,
999- buy_amount : buy_amount . into_legacy ( ) ,
998+ sell_token,
999+ buy_token,
1000+ receiver : Some ( receiver) ,
1001+ sell_amount,
1002+ buy_amount,
10001003 valid_to,
10011004 app_data : AppDataHash ( app_data) ,
1002- fee_amount : fee_amount . into_legacy ( ) ,
1005+ fee_amount,
10031006 kind : OrderKind :: Sell ,
10041007 partially_fillable : order_placement. order . partiallyFillable ,
10051008 sell_token_balance : SellTokenSource :: Erc20 ,
@@ -1015,14 +1018,14 @@ mod test {
10151018 owner : ByteArray ( owner. into_legacy ( ) . 0 ) ,
10161019 creation_timestamp : order. creation_timestamp , /* Using the actual result to keep test
10171020 * simple */
1018- sell_token : ByteArray ( expected_order_data. sell_token . 0 ) ,
1019- buy_token : ByteArray ( expected_order_data. buy_token . 0 ) ,
1020- receiver : expected_order_data. receiver . map ( |h160 | ByteArray ( h160 . 0 ) ) ,
1021- sell_amount : u256_to_big_decimal ( & expected_order_data. sell_amount ) ,
1022- buy_amount : u256_to_big_decimal ( & expected_order_data. buy_amount ) ,
1021+ sell_token : ByteArray ( expected_order_data. sell_token . 0 . 0 ) ,
1022+ buy_token : ByteArray ( expected_order_data. buy_token . 0 . 0 ) ,
1023+ receiver : expected_order_data. receiver . map ( |addr | ByteArray ( addr . 0 . 0 ) ) ,
1024+ sell_amount : alloy_u256_to_big_decimal ( & expected_order_data. sell_amount ) ,
1025+ buy_amount : alloy_u256_to_big_decimal ( & expected_order_data. buy_amount ) ,
10231026 valid_to : expected_order_data. valid_to as i64 ,
10241027 app_data : ByteArray ( expected_order_data. app_data . 0 ) ,
1025- fee_amount : u256_to_big_decimal ( & expected_order_data. fee_amount ) ,
1028+ fee_amount : alloy_u256_to_big_decimal ( & expected_order_data. fee_amount ) ,
10261029 kind : order_kind_into ( expected_order_data. kind ) ,
10271030 class : OrderClass :: Market ,
10281031 partially_fillable : expected_order_data. partially_fillable ,
@@ -1050,14 +1053,14 @@ mod test {
10501053 let fee_amount = U256 :: from ( 0 ) ;
10511054 let owner = Address :: from ( [ 5 ; 20 ] ) ;
10521055 let order_data = OrderData {
1053- sell_token : sell_token . into_legacy ( ) ,
1054- buy_token : buy_token . into_legacy ( ) ,
1055- receiver : Some ( receiver. into_legacy ( ) ) ,
1056- sell_amount : sell_amount . into_legacy ( ) ,
1057- buy_amount : buy_amount . into_legacy ( ) ,
1056+ sell_token,
1057+ buy_token,
1058+ receiver : Some ( receiver) ,
1059+ sell_amount,
1060+ buy_amount,
10581061 valid_to,
10591062 app_data : AppDataHash ( app_data) ,
1060- fee_amount : fee_amount . into_legacy ( ) ,
1063+ fee_amount,
10611064 kind : OrderKind :: Sell ,
10621065 partially_fillable : false ,
10631066 sell_token_balance : SellTokenSource :: Erc20 ,
@@ -1106,14 +1109,14 @@ mod test {
11061109 Metrics :: get ( ) ,
11071110 ) ;
11081111 let expected_order_data = OrderData {
1109- sell_token : sell_token . into_legacy ( ) ,
1110- buy_token : buy_token . into_legacy ( ) ,
1111- receiver : Some ( receiver. into_legacy ( ) ) ,
1112- sell_amount : sell_amount . into_legacy ( ) ,
1113- buy_amount : buy_amount . into_legacy ( ) ,
1112+ sell_token,
1113+ buy_token,
1114+ receiver : Some ( receiver) ,
1115+ sell_amount,
1116+ buy_amount,
11141117 valid_to,
11151118 app_data : AppDataHash ( app_data) ,
1116- fee_amount : 0 . into ( ) ,
1119+ fee_amount : alloy :: primitives :: U256 :: ZERO ,
11171120 kind : OrderKind :: Sell ,
11181121 partially_fillable : order_placement. order . partiallyFillable ,
11191122 sell_token_balance : SellTokenSource :: Erc20 ,
@@ -1129,11 +1132,11 @@ mod test {
11291132 owner : ByteArray ( owner. into_legacy ( ) . 0 ) ,
11301133 creation_timestamp : order. creation_timestamp , /* Using the actual result to keep test
11311134 * simple */
1132- sell_token : ByteArray ( expected_order_data. sell_token . 0 ) ,
1133- buy_token : ByteArray ( expected_order_data. buy_token . 0 ) ,
1134- receiver : expected_order_data. receiver . map ( |h160 | ByteArray ( h160 . 0 ) ) ,
1135- sell_amount : u256_to_big_decimal ( & expected_order_data. sell_amount ) ,
1136- buy_amount : u256_to_big_decimal ( & expected_order_data. buy_amount ) ,
1135+ sell_token : ByteArray ( expected_order_data. sell_token . 0 . 0 ) ,
1136+ buy_token : ByteArray ( expected_order_data. buy_token . 0 . 0 ) ,
1137+ receiver : expected_order_data. receiver . map ( |addr | ByteArray ( addr . 0 . 0 ) ) ,
1138+ sell_amount : alloy_u256_to_big_decimal ( & expected_order_data. sell_amount ) ,
1139+ buy_amount : alloy_u256_to_big_decimal ( & expected_order_data. buy_amount ) ,
11371140 valid_to : expected_order_data. valid_to as i64 ,
11381141 app_data : ByteArray ( expected_order_data. app_data . 0 ) ,
11391142 fee_amount : u256_to_big_decimal ( & fee_amount. into_legacy ( ) ) ,
@@ -1278,14 +1281,14 @@ mod test {
12781281 . await
12791282 . unwrap ( ) ;
12801283 let expected_order_data = OrderData {
1281- sell_token : sell_token . into_legacy ( ) ,
1282- buy_token : buy_token . into_legacy ( ) ,
1283- receiver : Some ( receiver. into_legacy ( ) ) ,
1284- sell_amount : sell_amount . into_legacy ( ) ,
1285- buy_amount : buy_amount . into_legacy ( ) ,
1284+ sell_token,
1285+ buy_token,
1286+ receiver : Some ( receiver) ,
1287+ sell_amount,
1288+ buy_amount,
12861289 valid_to,
12871290 app_data : AppDataHash ( app_data) ,
1288- fee_amount : fee_amount . into_legacy ( ) ,
1291+ fee_amount,
12891292 kind : OrderKind :: Sell ,
12901293 partially_fillable : order_placement. order . partiallyFillable ,
12911294 sell_token_balance : SellTokenSource :: Erc20 ,
0 commit comments