pragma solidity ^0.4.24;
library Math {
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;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner_;
mapping(address => bool) locked_;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public { owner_ = msg.sender; }
modifier onlyOwner() {
require(msg.sender == owner_);
_;
}
modifier locked() {
require(!locked_[msg.sender]);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner_, newOwner);
owner_ = newOwner;
}
function lock(address owner) public onlyOwner {
locked_[owner] = true;
}
function unlock(address owner) public onlyOwner {
locked_[owner] = false;
}
}
contract ERC20Token {
using Math for uint256;
event Burn(address indexed burner, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
uint256 totalSupply_;
mapping(address => uint256) balances_;
mapping (address => mapping (address => uint256)) internal allowed_;
function totalSupply() public view returns (uint256) { return totalSupply_; }
function transfer(address to, uint256 value) public returns (bool) {
require(to != address(0));
require(value <= balances_[msg.sender]);
balances_[msg.sender] = balances_[msg.sender].sub(value);
balances_[to] = balances_[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
}
function balanceOf(address owner) public view returns (uint256 balance) { return balances_[owner]; }
function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(to != address(0));
require(value <= balances_[from]);
require(value <= allowed_[from][msg.sender]);
balances_[from] = balances_[from].sub(value);
balances_[to] = balances_[to].add(value);
allowed_[from][msg.sender] = allowed_[from][msg.sender].sub(value);
emit Approval(from, msg.sender, allowed_[from][msg.sender]);
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
allowed_[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
allowed_[msg.sender][spender] = allowed_[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, allowed_[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
allowed_[msg.sender][spender] = allowed_[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, allowed_[msg.sender][spender]);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return allowed_[owner][spender];
}
function burn(uint256 value) public {
require(value <= balances_[msg.sender]);
address burner = msg.sender;
balances_[burner] = balances_[burner].sub(value);
totalSupply_ = totalSupply_.sub(value);
emit Transfer(burner, address(0), value);
emit Burn(burner, value);
}
}
contract ErugoCoin is Ownable, ERC20Token {
using Math for uint;
uint8 constant public decimals = 18;
string constant public symbol = "EWC";
string constant public name = "erugo world coin";
address constant company = 0xc3ed3B32b6771122548279be6bDd2644CabEc99D; // company account
constructor(uint amount) public {
totalSupply_ = amount;
initSetting(company, totalSupply_);
}
modifier lockedSender(address from) {
require(!locked_[from]);
_;
}
function withdrawTokens(address cont) external onlyOwner {
ErugoCoin tc = ErugoCoin(cont);
tc.transfer(owner_, tc.balanceOf(this));
}
function initSetting(address addr, uint amount) internal returns (bool) {
balances_[addr] = amount;
emit Transfer(address(0x0), addr, amount);
return true;
}
function transfer(address to, uint256 value) public locked returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public lockedSender(from) returns (bool) {
return super.transferFrom(from, to, value);
}
}
{
"compilationTarget": {
"ErugoCoin.sol": "ErugoCoin"
},
"evmVersion": "byzantium",
"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":"value","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":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"owner","type":"address"}],"name":"unlock","outputs":[],"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":"spender","type":"address"},{"name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"cont","type":"address"}],"name":"withdrawTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"value","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":true,"inputs":[],"name":"owner_","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"owner","type":"address"}],"name":"lock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"amount","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"burner","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"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]