/** * Source Code first verified at https://etherscan.io on Friday, April 26, 2019 (UTC) */ pragma solidity ^0.5.0; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } library Roles { struct Role { mapping (address => bool) bearer; } function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero account"); return role.bearer[account]; } } contract PauserRole { using Roles for Roles.Role; event PauserAdded(address indexed account); event PauserRemoved(address indexed account); Roles.Role private _pausers; constructor() internal { _addPauser(msg.sender); } modifier onlyPauser() { require(isPauser(msg.sender), "PauserRole: caller does not have the Pauser role"); _; } function isPauser(address account) public view returns (bool) { return _pausers.has(account); } function addPauser(address account) public onlyPauser { _addPauser(account); } function renouncePauser() public { _removePauser(msg.sender); } function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); } function _removePauser(address account) internal { _pausers.remove(account); emit PauserRemoved(account); } } contract AdministratorRole { using Roles for Roles.Role; event AdministractorTransfered(address indexed previousAdmin, address indexed newAdmin); event LockerAdded(address indexed account); event LockerRemoved(address indexed account); address private _admin; Roles.Role private _lockers; constructor() internal { _admin = msg.sender; emit AdministractorTransfered(address(0), _admin); } function administrator() public view returns (address) { return _admin; } modifier onlyAdministrator() { require(isAdministrator(), "AdministratorRole: caller is not the administrator"); _; } function isAdministrator() public view returns (bool) { return msg.sender == _admin; } function transferAdministrator(address newAdmin) public onlyAdministrator { _transferAdministrator(newAdmin); } function _transferAdministrator(address newAdmin) internal { require(newAdmin != address(0), "Ownable: new owner is the zero address"); emit AdministractorTransfered(_admin, newAdmin); _admin = newAdmin; } modifier lockerExists(address account) { require(isLocker(account), "AdministratorRole: account is not a locker"); _; } modifier lockerNotExists(address account) { require(!isLocker(account), "AdministratorRole: account is a locker"); _; } modifier onlyUnlocker() { require(!isLocker(msg.sender), "AdministratorRole: caller is a locker"); _; } modifier onlyLocker() { require(isLocker(msg.sender), "AdministratorRole: caller is not a locker"); _; } function isLocker(address account) public view returns (bool) { return _lockers.has(account); } function addLocker(address account) public onlyAdministrator lockerNotExists(account) { _addLocker(account); } function removeLocker(address account) public onlyAdministrator lockerExists(account) { _removeLocker(account); } function _addLocker(address account) internal { _lockers.add(account); emit LockerAdded(account); } function _removeLocker(address account) internal { _lockers.remove(account); emit LockerRemoved(account); } } contract Ownable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } function isOwner() public view returns (bool) { return msg.sender == _owner; } function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract Pausable is PauserRole { event Paused(address account); event Unpaused(address account); bool private _paused; constructor() internal { _paused = false; } function paused() public view returns (bool) { return _paused; } modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(msg.sender); } function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(msg.sender); } } interface IERC20 { function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract ERC20 is IERC20, AdministratorRole, Pausable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowed; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } function allowance(address owner, address spender) public view returns (uint256) { return _allowed[owner][spender]; } function transfer(address to, uint256 value) public whenNotPaused onlyUnlocker returns (bool) { _transfer(msg.sender, to, value); return true; } function approve(address spender, uint256 value) public whenNotPaused onlyUnlocker returns (bool) { if (value != 0 && _allowed[msg.sender][spender] != 0) return false; _approve(msg.sender, spender, value); return true; } function transferFrom(address from, address to, uint256 value) public whenNotPaused lockerNotExists(from) returns (bool) { _transfer(from, to, value); _approve(from, msg.sender, _allowed[from][msg.sender].sub(value)); return true; } function increaseAllowance(address spender, uint256 addedValue) public whenNotPaused onlyUnlocker returns (bool) { _approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public whenNotPaused onlyUnlocker returns (bool) { _approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue)); return true; } function _transfer(address from, address to, uint256 value) internal { require(to != address(0), "ERC20: transfer to zero address"); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(from, to, value); } function _approve(address owner, address spender, uint256 value) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowed[owner][spender] = value; emit Approval(owner, spender, value); } function _mint(address account, uint256 value) internal { require(account != address(0), "ERC20: mint to zero address"); _totalSupply = _totalSupply.add(value); _balances[account] = _balances[account].add(value); emit Transfer(address(0), account, value); } } contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } } contract ETMToken is Ownable, ERC20Detailed, ERC20 { using SafeMath for uint256; uint8 public constant DECIMALS = 18; uint256 private INIT_SUPPLY = uint256(210000000).mul(10 ** uint256(DECIMALS)); bool private _destoried = false; constructor() public ERC20Detailed("EnTanMo", "ETM", DECIMALS) { _mint(msg.sender, INIT_SUPPLY); } function destory() public onlyOwner returns (bool) { if (!_destoried) { selfdestruct(address(0)); _destoried = true; return true; } return false; } }