Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/governance/utils/VotesConfidential.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions contracts/token/ConfidentialFungibleToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/TFHESafeMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down