mirror of
https://github.com/vacp2p/minime.git
synced 2026-01-07 22:34:03 -05:00
fix(MiniMeBase): make burn() and mint() virtual
Otherwise they can't be overriden, which is necessary when inheriting contracts. This commit also renames `burn()` to `_burn()` and `mint()` to `_mint()`, simply to allow inheriting contracts to make use of those non-underscored function names instead.
This commit is contained in:
@@ -368,7 +368,7 @@ abstract contract MiniMeBase is Controlled, IERC20, IERC20Permit, EIP712, Nonces
|
||||
/// @param _owner The address that will be assigned the new tokens
|
||||
/// @param _amount The quantity of tokens generated
|
||||
/// @return True if the tokens are generated correctly
|
||||
function mint(address _owner, uint256 _amount) internal returns (bool) {
|
||||
function _mint(address _owner, uint256 _amount) internal virtual returns (bool) {
|
||||
uint256 curTotalSupply = totalSupply();
|
||||
if (uint128(curTotalSupply + _amount) < curTotalSupply) revert Overflow(); // Check for overflow
|
||||
uint256 previousBalanceTo = balanceOf(_owner);
|
||||
@@ -383,7 +383,7 @@ abstract contract MiniMeBase is Controlled, IERC20, IERC20Permit, EIP712, Nonces
|
||||
/// @param _owner The address that will lose the tokens
|
||||
/// @param _amount The quantity of tokens to burn
|
||||
/// @return True if the tokens are burned correctly
|
||||
function burn(address _owner, uint256 _amount) internal returns (bool) {
|
||||
function _burn(address _owner, uint256 _amount) internal virtual returns (bool) {
|
||||
uint256 curTotalSupply = totalSupply();
|
||||
if (curTotalSupply < _amount) revert NotEnoughSupply();
|
||||
uint256 previousBalanceFrom = balanceOf(_owner);
|
||||
|
||||
@@ -48,7 +48,7 @@ contract MiniMeToken is MiniMeBase {
|
||||
/// @param _amount The quantity of tokens generated
|
||||
/// @return True if the tokens are generated correctly
|
||||
function generateTokens(address _owner, uint256 _amount) public onlyController returns (bool) {
|
||||
return mint(_owner, _amount);
|
||||
return _mint(_owner, _amount);
|
||||
}
|
||||
|
||||
/// @notice Burns `_amount` tokens from `_owner`
|
||||
@@ -56,6 +56,6 @@ contract MiniMeToken is MiniMeBase {
|
||||
/// @param _amount The quantity of tokens to burn
|
||||
/// @return True if the tokens are burned correctly
|
||||
function destroyTokens(address _owner, uint256 _amount) public onlyController returns (bool) {
|
||||
return burn(_owner, _amount);
|
||||
return _burn(_owner, _amount);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user