From f14536cfbda4000a4cf7a5a0c147b46b760b8db8 Mon Sep 17 00:00:00 2001 From: thedavidmeister Date: Sun, 11 Aug 2024 16:36:32 +0400 Subject: [PATCH] round outputs up on diffs --- src/concrete/ob/OrderBook.sol | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/concrete/ob/OrderBook.sol b/src/concrete/ob/OrderBook.sol index 0d0e68482..dbf0353b0 100644 --- a/src/concrete/ob/OrderBook.sol +++ b/src/concrete/ob/OrderBook.sol @@ -872,7 +872,11 @@ contract OrderBook is IOrderBookV4, IMetaV1_2, ReentrancyGuard, Multicall, Order LibFixedPointDecimalScale.scale18( output, orderIOCalculation.context[CONTEXT_VAULT_OUTPUTS_COLUMN][CONTEXT_VAULT_IO_TOKEN_DECIMALS] / 1e18, - 0 + // Round outputs diff up if the scaling causes a rounding error. + // This only happens if the token has more than 18 decimals. + // Generally it's safer to overestimate output than + // underestimate. + FLAG_ROUND_UP ); }