Skip to content

Commit c6a4b8f

Browse files
committed
Fold exact-out fee into the else branch in QuoteLib (gas optimisation)
Spearbit #13
1 parent 598a1fb commit c6a4b8f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libraries/QuoteLib.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ library QuoteLib {
9292
} else {
9393
// if `!exactIn`, `amount` is the amount of assets to buy from the AMM
9494
require(amount <= outLimit && quote <= inLimit, SwapLimitExceeded());
95-
}
9695

97-
// exactOut: inflate required amountIn
98-
if (!exactIn) quote = (quote * 1e18) / (1e18 - fee);
96+
// exactOut: inflate required amountIn
97+
quote = (quote * 1e18) / (1e18 - fee);
98+
}
9999

100100
return quote;
101101
}

0 commit comments

Comments
 (0)