diff --git a/contracts/governance/utils/VotesConfidential.sol b/contracts/governance/utils/VotesConfidential.sol index da113c20..cab0364c 100644 --- a/contracts/governance/utils/VotesConfidential.sol +++ b/contracts/governance/utils/VotesConfidential.sol @@ -163,7 +163,7 @@ abstract contract VotesConfidential is Nonces, EIP712, IERC6372 { */ function _moveDelegateVotes(address from, address to, euint64 amount) internal virtual { CheckpointsConfidential.TraceEuint64 storage store; - if (from != to && euint64.unwrap(amount) != 0) { + if (from != to && FHE.isInitialized(amount)) { if (from != address(0)) { store = _delegateCheckpoints[from]; euint64 newValue = store.latest().sub(amount); diff --git a/contracts/token/ConfidentialFungibleToken.sol b/contracts/token/ConfidentialFungibleToken.sol index dc7b7fdc..c77f5278 100644 --- a/contracts/token/ConfidentialFungibleToken.sol +++ b/contracts/token/ConfidentialFungibleToken.sol @@ -230,7 +230,7 @@ abstract contract ConfidentialFungibleToken is IConfidentialFungibleToken { FHE.checkSignatures(requestId, signatures); euint64 requestHandle = _requestHandles[requestId]; - require(euint64.unwrap(requestHandle) != 0, ConfidentialFungibleTokenInvalidGatewayRequest(requestId)); + require(FHE.isInitialized(requestHandle), ConfidentialFungibleTokenInvalidGatewayRequest(requestId)); emit EncryptedAmountDisclosed(requestHandle, amount); _requestHandles[requestId] = euint64.wrap(0); @@ -287,7 +287,7 @@ abstract contract ConfidentialFungibleToken is IConfidentialFungibleToken { _totalSupply = ptr; } else { euint64 fromBalance = _balances[from]; - require(euint64.unwrap(fromBalance) != 0, ConfidentialFungibleTokenZeroBalance(from)); + require(FHE.isInitialized(fromBalance), ConfidentialFungibleTokenZeroBalance(from)); (success, ptr) = TFHESafeMath.tryDecrease(fromBalance, amount); FHE.allowThis(ptr); FHE.allow(ptr, from); diff --git a/contracts/utils/TFHESafeMath.sol b/contracts/utils/TFHESafeMath.sol index c3f07b3e..1abdb839 100644 --- a/contracts/utils/TFHESafeMath.sol +++ b/contracts/utils/TFHESafeMath.sol @@ -14,7 +14,7 @@ library TFHESafeMath { * and `updated` will be the original value. */ function tryIncrease(euint64 oldValue, euint64 delta) internal returns (ebool success, euint64 updated) { - if (euint64.unwrap(oldValue) == 0) { + if (!FHE.isInitialized(oldValue)) { success = FHE.asEbool(true); updated = delta; } else {