From 0c818410d6969100ec2ed2f10a6434f94849437b Mon Sep 17 00:00:00 2001 From: Matthew Krak Date: Tue, 10 Dec 2024 09:46:32 -0800 Subject: [PATCH] chore: update MintBurnERC20Mock warnings --- .../contracts/mocks/MintBurnERC20Mock.sol | 48 +++++++++++++++++++ .../contracts/mocks/MyMintBurnERC20Mock.sol | 21 -------- .../test/mocks/MintBurnERC20Mock.sol | 29 ++++++++++- 3 files changed, 76 insertions(+), 22 deletions(-) create mode 100644 examples/mint-burn-oft-adapter/contracts/mocks/MintBurnERC20Mock.sol delete mode 100644 examples/mint-burn-oft-adapter/contracts/mocks/MyMintBurnERC20Mock.sol diff --git a/examples/mint-burn-oft-adapter/contracts/mocks/MintBurnERC20Mock.sol b/examples/mint-burn-oft-adapter/contracts/mocks/MintBurnERC20Mock.sol new file mode 100644 index 000000000..8dcc03043 --- /dev/null +++ b/examples/mint-burn-oft-adapter/contracts/mocks/MintBurnERC20Mock.sol @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +import { IMintableBurnable } from "@layerzerolabs/oft-evm/contracts/interfaces/IMintableBurnable.sol"; + +/** + * @title MintBurnERC20Mock + * + * @dev WARNING: This contract is for testing purposes only. + * In a production scenario, the `mint` and `burn` methods + * should be guarded by appropriate access control mechanisms. + */ +contract MintBurnERC20Mock is ERC20, IMintableBurnable { + /// @notice Constructor to initialize the ERC20 token with a name and symbol. + constructor(string memory name, string memory symbol) ERC20(name, symbol) {} + + /** + * @notice Burns a specific amount of tokens from a given address. + * + * @dev WARNING: In production, this function should have access control. + * + * @param _from The address from which tokens will be burned. + * @param _amount The amount of tokens to burn. + * + * @return A boolean indicating the success of the burn operation. + */ + function burn(address _from, uint256 _amount) external returns (bool) { + _burn(_from, _amount); + return true; + } + + /** + * @notice Mints a specific amount of tokens to a given address. + * + * @dev WARNING: In production, this function should have access control. + * + * @param _to The address to which tokens will be minted. + * @param _amount The amount of tokens to mint. + * + * @return A boolean indicating the success of the mint operation. + */ + function mint(address _to, uint256 _amount) external returns (bool) { + _mint(_to, _amount); + return true; + } +} diff --git a/examples/mint-burn-oft-adapter/contracts/mocks/MyMintBurnERC20Mock.sol b/examples/mint-burn-oft-adapter/contracts/mocks/MyMintBurnERC20Mock.sol deleted file mode 100644 index 13e1e12c2..000000000 --- a/examples/mint-burn-oft-adapter/contracts/mocks/MyMintBurnERC20Mock.sol +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; - -import { IMintableBurnable } from "@layerzerolabs/oft-evm/contracts/interfaces/IMintableBurnable.sol"; - -// @dev WARNING: This is for testing purposes only -contract MintBurnERC20Mock is ERC20, IMintableBurnable { - constructor(string memory name, string memory symbol) ERC20(name, symbol) {} - - function burn(address _from, uint256 _amount) external returns (bool) { - _burn(_from, _amount); - return true; - } - - function mint(address _to, uint256 _amount) external returns (bool) { - _mint(_to, _amount); - return true; - } -} diff --git a/examples/mint-burn-oft-adapter/test/mocks/MintBurnERC20Mock.sol b/examples/mint-burn-oft-adapter/test/mocks/MintBurnERC20Mock.sol index 13e1e12c2..8dcc03043 100644 --- a/examples/mint-burn-oft-adapter/test/mocks/MintBurnERC20Mock.sol +++ b/examples/mint-burn-oft-adapter/test/mocks/MintBurnERC20Mock.sol @@ -5,15 +5,42 @@ import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { IMintableBurnable } from "@layerzerolabs/oft-evm/contracts/interfaces/IMintableBurnable.sol"; -// @dev WARNING: This is for testing purposes only +/** + * @title MintBurnERC20Mock + * + * @dev WARNING: This contract is for testing purposes only. + * In a production scenario, the `mint` and `burn` methods + * should be guarded by appropriate access control mechanisms. + */ contract MintBurnERC20Mock is ERC20, IMintableBurnable { + /// @notice Constructor to initialize the ERC20 token with a name and symbol. constructor(string memory name, string memory symbol) ERC20(name, symbol) {} + /** + * @notice Burns a specific amount of tokens from a given address. + * + * @dev WARNING: In production, this function should have access control. + * + * @param _from The address from which tokens will be burned. + * @param _amount The amount of tokens to burn. + * + * @return A boolean indicating the success of the burn operation. + */ function burn(address _from, uint256 _amount) external returns (bool) { _burn(_from, _amount); return true; } + /** + * @notice Mints a specific amount of tokens to a given address. + * + * @dev WARNING: In production, this function should have access control. + * + * @param _to The address to which tokens will be minted. + * @param _amount The amount of tokens to mint. + * + * @return A boolean indicating the success of the mint operation. + */ function mint(address _to, uint256 _amount) external returns (bool) { _mint(_to, _amount); return true;