From 36841f285c9fabb2e3e46e13c76595e8380131fb Mon Sep 17 00:00:00 2001 From: PacificYield <173040337+PacificYield@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:03:19 +0100 Subject: [PATCH] test: test files with Zama gateway/fhevm config --- .../test/token/ERC20/TestERC20Mintable.sol | 38 +++++++++++++++++++ .../token/ERC20/TestEncryptedERC20Wrapped.sol | 12 ++++++ .../test/token/ERC20/TestEncryptedWETH.sol | 9 +++++ 3 files changed, 59 insertions(+) create mode 100644 contracts/test/token/ERC20/TestERC20Mintable.sol create mode 100644 contracts/test/token/ERC20/TestEncryptedERC20Wrapped.sol create mode 100644 contracts/test/token/ERC20/TestEncryptedWETH.sol diff --git a/contracts/test/token/ERC20/TestERC20Mintable.sol b/contracts/test/token/ERC20/TestERC20Mintable.sol new file mode 100644 index 0000000..742eb14 --- /dev/null +++ b/contracts/test/token/ERC20/TestERC20Mintable.sol @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: BSD-3-Clause-Clear +pragma solidity ^0.8.24; + +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import { Ownable2Step, Ownable } from "@openzeppelin/contracts/access/Ownable2Step.sol"; + +/** + * @title ERC20Mintable + * @notice This contract is an ERC20 token that is mintable by the owner. + */ +contract ERC20Mintable is ERC20, Ownable2Step { + /// @dev override number of decimals + uint8 private immutable _DECIMALS; + + constructor( + string memory name_, + string memory symbol_, + uint8 decimals_, + address owner_ + ) ERC20(name_, symbol_) Ownable(owner_) { + _DECIMALS = decimals_; + } + + /** + * @notice Returns the number of decimals. + */ + function decimals() public view override returns (uint8) { + return _DECIMALS; + } + + /** + * @notice Mint tokens. + * @param amount Amount of tokens to mint. + */ + function mint(uint256 amount) public onlyOwner { + _mint(msg.sender, amount); + } +} diff --git a/contracts/test/token/ERC20/TestEncryptedERC20Wrapped.sol b/contracts/test/token/ERC20/TestEncryptedERC20Wrapped.sol new file mode 100644 index 0000000..ef35867 --- /dev/null +++ b/contracts/test/token/ERC20/TestEncryptedERC20Wrapped.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: BSD-3-Clause-Clear +pragma solidity ^0.8.24; + +import { EncryptedERC20Wrapped } from "../../../token/ERC20/EncryptedERC20Wrapped.sol"; +import { DefaultFHEVMConfig } from "../../DefaultFHEVMConfig.sol"; +import { DefaultGatewayConfig } from "../../DefaultGatewayConfig.sol"; + +contract TestEncryptedERC20Wrapped is DefaultFHEVMConfig, DefaultGatewayConfig, EncryptedERC20Wrapped { + constructor(address erc20_) EncryptedERC20Wrapped(erc20_) { + // + } +} diff --git a/contracts/test/token/ERC20/TestEncryptedWETH.sol b/contracts/test/token/ERC20/TestEncryptedWETH.sol new file mode 100644 index 0000000..7f8e752 --- /dev/null +++ b/contracts/test/token/ERC20/TestEncryptedWETH.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: BSD-3-Clause-Clear +pragma solidity ^0.8.24; + +import { EncryptedWETH } from "../../../token/ERC20/EncryptedWETH.sol"; +import { DefaultFHEVMConfig } from "../../DefaultFHEVMConfig.sol"; +import { DefaultGatewayConfig } from "../../DefaultGatewayConfig.sol"; + +/* solhint-disable no-empty-blocks*/ +contract TestEncryptedWETH is DefaultFHEVMConfig, DefaultGatewayConfig, EncryptedWETH {}