Files
zeekay 2a145d1976 Update @luxfhe packages to latest versions
- @luxfhe/wasm: ^0.2.0
- @luxfhe/kms: ^0.2.0
- @luxfhe/relayer-sdk: ^0.6.0
- @luxfhe/mock-contracts: ^0.6.0
- Remove deprecated Zama dependencies
2026-01-02 10:49:14 -08:00

38 lines
955 B
Solidity

//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
// Import FHE.sol library
import "@luxfi/contracts/fhe/FHE.sol";
// Useful for debugging. Remove when deploying to a live network.
import "hardhat/console.sol";
contract FHEContract {
euint32 public val;
constructor() {
val = FHE.asEuint32(0);
}
function setVal(Euint32 memory _inVal) public {
val = FHE.asEuint32(_inVal);
FHE.allowSender(val);
FHE.allowThis(val);
}
function valOp(uint8 op, Euint32 memory _operand) public {
euint32 operand = FHE.asEuint32(_operand);
if (op == 0) {
val = FHE.add(val, operand);
} else if (op == 1) {
val = FHE.sub(val, operand);
} else if (op == 2) {
val = FHE.mul(val, operand);
} else if (op == 3) {
val = FHE.div(val, operand);
}
FHE.allowSender(val);
FHE.allowThis(val);
}
}