Skip to content

Commit 791763f

Browse files
committed
feat: add unchecked blocks to _checkSlippage
1 parent 2b28e0f commit 791763f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

contracts/helpers/MultiBlockHarvester.sol

+8-4
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,16 @@ contract MultiBlockHarvester is BaseHarvester {
187187

188188
if (asset == USDC || asset == USDM || asset == EURC) {
189189
// Assume 1:1 ratio between stablecoins
190-
uint256 slippage = ((amountIn - amountOut) * 1e9) / amountIn;
191-
if (slippage > maxSlippage) revert SlippageTooHigh();
190+
unchecked {
191+
uint256 slippage = ((amountIn - amountOut) * 1e9) / amountIn;
192+
if (slippage > maxSlippage) revert SlippageTooHigh();
193+
}
192194
} else if (asset == XEVT) {
193195
// Assume 1:1 ratio between the underlying asset of the vault
194-
uint256 slippage = ((IPool(depositAddress).convertToAssets(amountIn) - amountOut) * 1e9) / amountIn;
195-
if (slippage > maxSlippage) revert SlippageTooHigh();
196+
unchecked {
197+
uint256 slippage = ((IPool(depositAddress).convertToAssets(amountIn) - amountOut) * 1e9) / amountIn;
198+
if (slippage > maxSlippage) revert SlippageTooHigh();
199+
}
196200
} else revert InvalidParam();
197201
}
198202
}

0 commit comments

Comments
 (0)