Created
January 12, 2022 09:00
-
-
Save gladunrv/cefebfdf2ad0997be23c7ccb09ea96b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.2; | |
| import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
| import "@openzeppelin/contracts/security/Pausable.sol"; | |
| import "@openzeppelin/contracts/access/Ownable.sol"; | |
| contract BingoCoin is ERC20, Pausable, Ownable { | |
| mapping (address => bool) public isBlackListed; | |
| event AddedBlackList(address _user); | |
| event RemovedBlackList(address _user); | |
| constructor() ERC20("BingoCoin", "BNG") { | |
| _mint(msg.sender, 100000000 * 10 ** decimals()); | |
| } | |
| function pause() public onlyOwner { | |
| _pause(); | |
| } | |
| function unpause() public onlyOwner { | |
| _unpause(); | |
| } | |
| function mint(address to, uint256 amount) public onlyOwner { | |
| _mint(to, amount); | |
| } | |
| function burn(uint256 amount) public onlyOwner { | |
| _burn(msg.sender, amount); | |
| } | |
| function _beforeTokenTransfer(address from, address to, uint256 amount) | |
| internal | |
| whenNotPaused | |
| override | |
| { | |
| require(!isBlackListed[from]); | |
| super._beforeTokenTransfer(from, to, amount); | |
| } | |
| function getBlackListStatus(address _maker) external view returns (bool) { | |
| return isBlackListed[_maker]; | |
| } | |
| function addBlackList(address _evilUser) public onlyOwner { | |
| isBlackListed[_evilUser] = true; | |
| emit AddedBlackList(_evilUser); | |
| } | |
| function removeBlackList(address _clearedUser) public onlyOwner { | |
| isBlackListed[_clearedUser] = false; | |
| emit RemovedBlackList(_clearedUser); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment