Utils
This document is better viewed at https://docs.openzeppelin.com/confidential-contracts/api/utils |
Miscellaneous contracts and libraries containing utility functions you can use to improve security, and ease integrations when working with confidential contracts.
-
TFHESafeMath
: Implementation of safe math operations for encrypted values.
Math
TFHESafeMath
import "@openzeppelin/confidential-contracts/utils/TFHESafeMath.sol";
Library providing safe arithmetic operations for encrypted values to handle potential overflows in FHE operations.
-
tryIncrease(oldValue, delta)
-
tryDecrease(oldValue, delta)
tryIncrease(euint64 oldValue, euint64 delta) → ebool success, euint64 updated
internal
Try to increase the encrypted value oldValue
by delta
. If the operation is successful,
success
will be true and updated
will be the new value. Otherwise, success
will be false
and updated
will be the original value.
tryDecrease(euint64 oldValue, euint64 delta) → ebool success, euint64 updated
internal
Try to decrease the encrypted value oldValue
by delta
. If the operation is successful,
success
will be true and updated
will be the new value. Otherwise, success
will be false
and updated
will be the original value.