Skip to content

Commit

Permalink
chore: update MintBurnERC20Mock warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
St0rmBr3w committed Dec 10, 2024
1 parent 5c56f20 commit 0c81841
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}
}

This file was deleted.

29 changes: 28 additions & 1 deletion examples/mint-burn-oft-adapter/test/mocks/MintBurnERC20Mock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0c81841

Please sign in to comment.