Files
Fuma Nama eea1b224a6 refactor(fhe): unify API - reveal() replaces getDecryptResult()
- Update to unified FHE decryption API
- Update dependencies to @luxfi/contracts
2025-12-31 21:11:35 -08:00

27 lines
954 B
Solidity

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "./FHERC20.sol";
import { FHE, euint32, Euint32 } from "@luxfi/contracts/fhe/FHE.sol";
import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol";
contract ExampleToken is FHERC20, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
constructor(string memory name, string memory symbol, uint256 initialBalance, Euint32 memory encryptedBalance) FHERC20(name, symbol) {
_mint(msg.sender, initialBalance);
_mintEncrypted(msg.sender, encryptedBalance);
_grantRole(MINTER_ROLE, msg.sender);
}
function mintEncrypted(address recipient, Euint32 memory amount) public {
if (hasRole(MINTER_ROLE, msg.sender)) {
_mintEncrypted(recipient, amount);
}
}
function mintEncryptedDebug(Euint32 memory amount) public {
_mintEncrypted(msg.sender, amount);
}
}