Skip to content

Commit

Permalink
move minter functions into the token contract
Browse files Browse the repository at this point in the history
  • Loading branch information
tempe-techie committed Mar 24, 2024
1 parent 668d953 commit 6b8b995
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 63 deletions.
23 changes: 14 additions & 9 deletions contracts/token/meme/MemeToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ interface ISFS {
}

contract MemeToken is ERC20, Ownable, ERC20Votes {
address public minter;
uint256 public deadline; // timestamp when the token minting ends (see mintStart() function)

mapping(address => bool) public isMinter; // addresses that have minting privileges

// EVENTS
event MinterAddressChanged(address indexed _owner, address indexed _minter);
Expand Down Expand Up @@ -40,22 +42,25 @@ contract MemeToken is ERC20, Ownable, ERC20Votes {
// MINTER

function mint(address _to, uint256 _amount) external {
require(msg.sender == minter, "Only minter can mint");
require(deadline == 0, "Minting is paused");
require(isMinter[msg.sender], "Only minters can mint");
require(block.timestamp < deadline, "Minting period has ended");

_mint(_to, _amount);
}

// OWNER

function removeMinterAndRenounce() external onlyOwner {
minter = address(0);
emit MinterAddressChanged(msg.sender, address(0));
function addMinter(address _minter) external onlyOwner {
isMinter[_minter] = true;
}

renounceOwnership();
function removeMinter(address _minter) external onlyOwner {
isMinter[_minter] = false;
}

function setMinter(address _minter) external onlyOwner {
minter = _minter;
emit MinterAddressChanged(msg.sender, _minter);
function mintStart() external onlyOwner {
deadline = block.timestamp + 2 weeks; // minting period is 2 weeks
}

// INTERNAL (ERC20Votes requirements)
Expand Down
54 changes: 0 additions & 54 deletions contracts/token/meme/MemeTokenMinter.sol

This file was deleted.

0 comments on commit 6b8b995

Please sign in to comment.