File tree Expand file tree Collapse file tree 2 files changed +7
-24
lines changed Expand file tree Collapse file tree 2 files changed +7
-24
lines changed Original file line number Diff line number Diff line change @@ -136,23 +136,6 @@ async fn place_order_with_quote_same_token_pair(web3: Web3) {
136136
137137 token. mint ( trader. address ( ) , to_wei ( 10 ) ) . await ;
138138
139- /*onchain
140- .contracts()
141- .weth
142- .approve(onchain.contracts().allowance.into_alloy(), eth(3))
143- .from(trader.address().into_alloy())
144- .send_and_watch()
145- .await
146- .unwrap();
147- onchain
148- .contracts()
149- .weth
150- .deposit()
151- .from(trader.address().into_alloy())
152- .value(eth(3))
153- .send_and_watch()
154- .await
155- .unwrap();*/
156139 token
157140 . approve ( onchain. contracts ( ) . allowance . into_alloy ( ) , eth ( 10 ) )
158141 . from ( trader. address ( ) . into_alloy ( ) )
Original file line number Diff line number Diff line change @@ -208,13 +208,6 @@ impl Inner {
208208 } )
209209 . collect ( ) ;
210210
211- // The baseline solver generates a path with swapping
212- // for exact output token amounts. This leads to
213- // potential rounding errors for buy orders, where we
214- // can buy slightly more than intended. Fix this by
215- // capping the output amount to the order's buy amount
216- // for buy orders.
217- // let mut output = route.output();
218211 let mut output = if route. is_empty ( ) {
219212 order. sell
220213 } else {
@@ -225,6 +218,13 @@ impl Inner {
225218 } else {
226219 route. input ( )
227220 } ;
221+
222+ // The baseline solver generates a path with swapping
223+ // for exact output token amounts. This leads to
224+ // potential rounding errors for buy orders, where we
225+ // can buy slightly more than intended. Fix this by
226+ // capping the output amount to the order's buy amount
227+ // for buy orders.
228228 if let order:: Side :: Buy = order. side {
229229 output. amount = cmp:: min ( output. amount , order. buy . amount ) ;
230230 }
You can’t perform that action at this time.
0 commit comments