Skip to content

Commit 3ddb8ce

Browse files
committed
[Documentation] Add comments to mock tokens
1 parent ec1963b commit 3ddb8ce

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

contracts/mocks/ERC20MockToken.sol

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ pragma solidity 0.8.25;
44
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
55
import "@openzeppelin/contracts/access/Ownable.sol";
66

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.
710
contract ERC20MockToken is ERC20, Ownable {
11+
/// @dev Custom decimal places for the mock token.
812
uint8 private immutable _decimals;
913

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.
1018
constructor(
1119
string memory name,
1220
string memory symbol,
@@ -15,14 +23,22 @@ contract ERC20MockToken is ERC20, Ownable {
1523
_decimals = decimals_;
1624
}
1725

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.
1829
function mint(address account, uint256 amount) external onlyOwner {
1930
_mint(account, amount);
2031
}
2132

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.
2236
function burn(address account, uint256 amount) external onlyOwner {
2337
_burn(account, amount);
2438
}
2539

40+
/// @notice Returns the number of decimals used to get its user representation.
41+
/// @return The number of decimals.
2642
function decimals() public view override returns (uint8) {
2743
return _decimals;
2844
}

contracts/mocks/ERC721MockToken.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@ pragma solidity 0.8.25;
44
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
55
import "@openzeppelin/contracts/access/Ownable.sol";
66

7+
/// @title ERC721MockToken
8+
/// @notice A mock ERC721 token for testing purposes, with minting capabilities controlled by the owner.
9+
/// @dev Extends the OpenZeppelin ERC721 and Ownable contracts.
710
contract ERC721MockToken is ERC721, Ownable {
11+
/// @dev Counter for tracking the next token ID to be minted.
812
uint256 private _nextTokenId;
913

14+
/// @notice Constructor to initialize the mock token with a name and symbol.
15+
/// @param name The name of the token.
16+
/// @param symbol The symbol of the token.
1017
constructor(
1118
string memory name,
1219
string memory symbol
1320
) ERC721(name, symbol) Ownable(msg.sender) {}
1421

22+
/// @notice Mints a new token to the specified address.
23+
/// @param to The address to mint the token to.
1524
function safeMint(address to) public onlyOwner {
1625
uint256 tokenId = _nextTokenId++;
1726
_safeMint(to, tokenId);

0 commit comments

Comments
 (0)