Skip to main content
All arithmetic operations work on euint8 | euint16 | euint32 | euint64 | euint128. Both operands must be the same type.

add

sub

mul

div

Division by zero does not revert. The FHE Engine cannot inspect the encrypted divisor, so div returns the maximum value of the operand type instead (255 for euint8). If that result is wrong for your contract, test the divisor with eq and pick a fallback with select.

rem

Remainder by zero does not revert. rem returns the dividend unchanged, so 63 % 0 yields 63. The mock contracts behind the Hardhat and Foundry plugins differ here: they revert with a Solidity division panic. A local test of rem by zero therefore fails while the same call succeeds on a live network.

square