Skip to content

Commit

Permalink
feat(contract): add some more documentation to contract
Browse files Browse the repository at this point in the history
  • Loading branch information
owieth committed Jun 23, 2023
1 parent e9aeac7 commit bfc192d
Showing 1 changed file with 105 additions and 5 deletions.
110 changes: 105 additions & 5 deletions src/Token.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,115 @@ import {Ownable} from "@oz/access/Ownable.sol";
/// @author Olivier Winkler (https://github.com/owieth)
/// @custom:security-contact xxx@gmail.com
contract Token is ERC20, Ownable {
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/

/// @dev Explain to a developer any extra details
error Token__Error();

/// @dev Explain to a developer any extra details
/// @param id a parameter just like in doxygen (must be followed by parameter name)
error Token__ErrorWithParams(uint256 id);

/*//////////////////////////////////////////////////////////////
STRUCTS
//////////////////////////////////////////////////////////////*/

/// @dev Explain to a developer any extra details
/// @param id a parameter just like in doxygen (must be followed by parameter name)
/// @param name a parameter just like in doxygen (must be followed by parameter name)
struct TokenStruct {
uint256 id;
string name;
}

/*//////////////////////////////////////////////////////////////
CONSTANTS
//////////////////////////////////////////////////////////////*/

/// @dev Explain to a developer any extra details
uint256 private constant CONSTANT_NUMBER = 100;

/*//////////////////////////////////////////////////////////////
IMMUTABLES
//////////////////////////////////////////////////////////////*/

/// @dev Explain to a developer any extra details
uint256 private immutable i_immutableNumber = 100;

/*//////////////////////////////////////////////////////////////
STORAGE
//////////////////////////////////////////////////////////////*/

/// @dev Explain to a developer any extra details
uint256 public s_number;

/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/

/// @dev Explain to a developer any extra details
/// @param from a parameter just like in doxygen (must be followed by parameter name)
/// @param to a parameter just like in doxygen (must be followed by parameter name)
/// @param id a parameter just like in doxygen (must be followed by parameter name)
event TokenEvent(address indexed from, address indexed to, address indexed id);

/*//////////////////////////////////////////////////////////////
MODIFIERS
//////////////////////////////////////////////////////////////*/

/// @dev Explain to a developer any extra details
modifier onlyMinter() {
_;
}

/// @dev Explain to a developer any extra details
/// @param minter a parameter just like in doxygen (must be followed by parameter name)
modifier onlyMinterByAddress(address minter) {
_;
}

/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/

constructor() ERC20("Token", "TKN") {}

uint256 public number;
/*//////////////////////////////////////////////////////////////
EXTERNAL
//////////////////////////////////////////////////////////////*/

function setNumber(uint256 newNumber) public {
number = newNumber;
/// @notice Explain to an end user what this does
/// @dev Explain to a developer any extra details
/// @param newNumber a parameter just like in doxygen (must be followed by parameter name)
function setNumber(uint256 newNumber) external {
s_number = newNumber;
}

function increment() public {
number++;
/*//////////////////////////////////////////////////////////////
PUBLIC
//////////////////////////////////////////////////////////////*/

/// @notice Explain to an end user what this does
/// @dev Explain to a developer any extra details
function incrementNumber() public {
s_number++;
}

/*//////////////////////////////////////////////////////////////
INTERNAL
//////////////////////////////////////////////////////////////*/

/// @notice Explain to an end user what this does
/// @dev Explain to a developer any extra details
function _calculateNumber() internal {}

/*//////////////////////////////////////////////////////////////
PRIVATE
//////////////////////////////////////////////////////////////*/

/// @notice Explain to an end user what this does
/// @dev Explain to a developer any extra details
function _calculateAmount() private {}
}

0 comments on commit bfc192d

Please sign in to comment.