File tree Expand file tree Collapse file tree 3 files changed +5
-12
lines changed
Expand file tree Collapse file tree 3 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -310,17 +310,6 @@ async fn test_execute_same_sell_and_buy_token(web3: Web3) {
310310 let initial_balance = token. balanceOf ( trader. address ( ) ) . call ( ) . await . unwrap ( ) ;
311311 assert_eq ! ( initial_balance, eth( 10 ) ) ;
312312
313- // let quote_sell_amount = to_wei(2);
314- // let order_buy_amount = to_wei(1);
315- // let order = OrderCreation {
316- // sell_token: token.address().into_legacy(),
317- // sell_amount: order_sell_amount,
318- // buy_token: token.address().into_legacy(),
319- // buy_amount: order_buy_amount,
320- // valid_to: model::time::now_in_epoch_seconds() + 300,
321- // kind: OrderKind::Sell,
322- // ..Default::default()
323- // }
324313 let order = OrderCreation {
325314 kind : OrderKind :: Sell ,
326315 sell_token : token. address ( ) . into_legacy ( ) ,
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ impl<'a> Solver<'a> {
4848 max_hops : usize ,
4949 ) -> Option < solver:: Route < ' a > > {
5050 if request. sell . token == request. buy . token {
51- tracing:: info!( "Sell=Buy, returning empty route" ) ;
5251 return Some ( solver:: Route :: new ( vec ! [ ] ) ) ;
5352 }
5453 let candidates = self . base_tokens . path_candidates_with_hops (
Original file line number Diff line number Diff line change @@ -222,6 +222,11 @@ impl Inner {
222222 input = route. input ( ) . expect ( "route is not empty" ) ;
223223 output = route. output ( ) . expect ( "route is not empty" ) ;
224224 } else {
225+ // Route is empty in case of sell and buy tokens being the same, as there
226+ // is no need to figure out the liquidity for such pair.
227+ //
228+ // The input and output of the solution can be set directly to the
229+ // respective sell and buy tokens 1 to 1.
225230 interactions = Vec :: default ( ) ;
226231 gas = eth:: Gas ( U256 :: zero ( ) ) + self . solution_gas_offset ;
227232
You can’t perform that action at this time.
0 commit comments