Skip to content

Instantly share code, notes, and snippets.

@gladunrv
Created January 12, 2022 09:00
Show Gist options
  • Select an option

  • Save gladunrv/cefebfdf2ad0997be23c7ccb09ea96b2 to your computer and use it in GitHub Desktop.

Select an option

Save gladunrv/cefebfdf2ad0997be23c7ccb09ea96b2 to your computer and use it in GitHub Desktop.
// 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