mirror of
https://github.com/luxfhe/example-blind-auction.git
synced 2026-10-30 18:13:37 +00:00
- Update to unified FHE decryption API - Update dependencies to @luxfi/contracts
27 lines
954 B
Solidity
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);
|
|
}
|
|
}
|