@@ -4,9 +4,17 @@ pragma solidity 0.8.25;
4
4
import {ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol " ;
5
5
import "@openzeppelin/contracts/access/Ownable.sol " ;
6
6
7
+ /// @title ERC20MockToken
8
+ /// @notice A mock ERC20 token for testing purposes, with minting and burning capabilities controlled by the owner.
9
+ /// @dev Extends the OpenZeppelin ERC20 and Ownable contracts.
7
10
contract ERC20MockToken is ERC20 , Ownable {
11
+ /// @dev Custom decimal places for the mock token.
8
12
uint8 private immutable _decimals;
9
13
14
+ /// @notice Constructor to initialize the mock token with a name, symbol, and decimals.
15
+ /// @param name The name of the token.
16
+ /// @param symbol The symbol of the token.
17
+ /// @param decimals_ The number of decimal places for the token.
10
18
constructor (
11
19
string memory name ,
12
20
string memory symbol ,
@@ -15,14 +23,22 @@ contract ERC20MockToken is ERC20, Ownable {
15
23
_decimals = decimals_;
16
24
}
17
25
26
+ /// @notice Mints new tokens to the specified account.
27
+ /// @param account The address of the account to mint tokens to.
28
+ /// @param amount The amount of tokens to mint.
18
29
function mint (address account , uint256 amount ) external onlyOwner {
19
30
_mint (account, amount);
20
31
}
21
32
33
+ /// @notice Burns tokens from the specified account.
34
+ /// @param account The address of the account to burn tokens from.
35
+ /// @param amount The amount of tokens to burn.
22
36
function burn (address account , uint256 amount ) external onlyOwner {
23
37
_burn (account, amount);
24
38
}
25
39
40
+ /// @notice Returns the number of decimals used to get its user representation.
41
+ /// @return The number of decimals.
26
42
function decimals () public view override returns (uint8 ) {
27
43
return _decimals;
28
44
}
0 commit comments