/**
*Submitted for verification at Etherscan.io on 2019-06-25
*/
pragma solidity 0.4.18;
// File: contracts/util/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/token/ERC20.sol
/**
* @title ERC20
* @dev Standart ERC20 token interface
*/
contract ERC20 {
mapping(address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
function allowance(address _owner, address _spender) public view returns (uint256);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
// File: contracts/token/BSYS.sol
contract BSYS is ERC20 {
using SafeMath for uint256;
address public admin;
string public constant name = "BSYS";
string public constant symbol = "BSYS";
uint8 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => bool) internal blacklist;
event Burn(address indexed from, uint256 value);
// Disables/enables token transfers, for migration to platform mainnet
// true = Can not transfers
// false = Can transfer
bool public checkTokenLock = false;
// Allows execution by the ico only
modifier adminOnly {
require(msg.sender == admin);
_;
}
modifier transferable {
require(msg.sender == admin || !checkTokenLock);
_;
}
function BSYS(uint256 _initialSupply) public {
totalSupply = _initialSupply.mul(1e18);
balances[msg.sender] = _initialSupply.mul(1e18);
admin = msg.sender;
}
// _block
// True : Can not Transfer
// false : Can Transfer
function blockTransfer(bool _block) external adminOnly {
checkTokenLock = _block;
}
// _inBlackList
// True : Can not Transfer
// false : Can Transfer
function updateBlackList(address _addr, bool _inBlackList) external adminOnly{
blacklist[_addr] = _inBlackList;
}
function isInBlackList(address _addr) public view returns(bool){
return blacklist[_addr];
}
function balanceOf(address _who) public view returns(uint256) {
return balances[_who];
}
function transfer(address _to, uint256 _amount) public transferable returns(bool) {
require(_to != address(0));
require(_to != address(this));
require(_amount > 0);
require(_amount <= balances[msg.sender]);
require(blacklist[msg.sender] == false);
require(blacklist[_to] == false);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) public transferable returns(bool) {
require(_to != address(0));
require(_to != address(this));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
require(blacklist[_from] == false);
require(blacklist[_to] == false);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _amount) public returns(bool) {
// reduce spender's allowance to 0 then set desired value after to avoid race condition
require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
function allowance(address _owner, address _spender) public view returns(uint256) {
return allowed[_owner][_spender];
}
function burn(uint256 _amount) public transferable returns (bool) {
require(_amount > 0);
require(balances[msg.sender] >= _amount);
totalSupply = totalSupply.sub(_amount);
balances[msg.sender] = balances[msg.sender].sub(_amount);
Burn(msg.sender, _amount);
return true;
}
function burnFrom(address _from, uint256 _amount)public transferable returns (bool) {
require(_amount > 0);
require(balances[_from] >= _amount);
require(allowed[_from][msg.sender] >= _amount);
totalSupply = totalSupply.sub(_amount);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
Burn(_from, _amount);
return true;
}
}
{
"compilationTarget": {
"BSYS.sol": "BSYS"
},
"libraries": {},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"burn","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"checkTokenLock","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_addr","type":"address"}],"name":"isInBlackList","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_amount","type":"uint256"}],"name":"burnFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_block","type":"bool"}],"name":"blockTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_addr","type":"address"},{"name":"_inBlackList","type":"bool"}],"name":"updateBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]