pragma solidity ^0.4;
contract ERC20 {
uint public totalSupply;
function balanceOf(address _account) public constant returns (uint balance);
function transfer(address _to, uint _value) public returns (bool success);
function transferFrom(address _from, address _to, uint _value) public returns (bool success);
function approve(address _spender, uint _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint remaining);
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
contract Token is ERC20 {
mapping(address => uint256) public balances;
mapping(address => uint256) public investBalances;
mapping(address => mapping (address => uint)) allowed;
// Total amount of supplied tokens
uint256 public totalSupply;
// Information about token
string public constant name = "MMS";
string public constant symbol = "MMS";
address public owner;
address public owner2;
address public owner3;
uint public decimals = 18;
// If function has this modifier, only owner can execute this function
modifier onlyOwner() {
require(msg.sender == owner || msg.sender == owner2 || msg.sender == owner3);
_;
}
function Token() public {
totalSupply = 10000000000000000000000000;
owner = 0x1FC11ac635e89c228765f3e6aEe0970D9aFf2BF5;
owner2 = 0x4AB9AA258369438bC146b26af02F6E3568009D92;
balances[owner] = totalSupply;
}
// Change main owner address and transer tokens to new owner
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != owner);
balances[newOwner] = balances[owner];
balances[owner] = 0;
owner = newOwner;
}
// Chech trade balance of account
function balanceOf(address _account) public constant returns (uint256 balance) {
return balances[_account];
}
// Transfer tokens from your account to other account
function transfer(address _to, uint _value) public returns (bool success) {
require(_to != 0x0); // Prevent transfer to 0x0 address.
require(balances[msg.sender] >= _value); // Check if the sender has enough
balances[msg.sender] -= _value; // Subtract from the sender
balances[_to] += _value; // Add the same to the recipient
Transfer(msg.sender, _to, _value);
return true;
}
// Transfer tokens from account (_from) to another account (_to)
function transferFrom(address _from, address _to, uint256 _amount) public returns(bool) {
require(_amount <= allowed[_from][msg.sender]);
if (balances[_from] >= _amount && _amount > 0) {
balances[_from] -= _amount;
balances[_to] += _amount;
allowed[_from][msg.sender] -= _amount;
Transfer(_from, _to, _amount);
return true;
}
else {
return false;
}
}
function approve(address _spender, uint _value) public returns (bool success){
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint remaining) {
return allowed[_owner][_spender];
}
function add_tokens(address _to, uint256 _amount) public onlyOwner {
balances[owner] -= _amount;
investBalances[_to] += _amount;
}
// Transfer tokens from investBalance to Balncec for trading
function transferToken_toBalance(address _user, uint256 _amount) public onlyOwner {
investBalances[_user] -= _amount;
balances[_user] += _amount;
}
// Transfer toknes from Balncec to investBalance
function transferToken_toInvestBalance(address _user, uint256 _amount) public onlyOwner {
balances[_user] -= _amount;
investBalances[_user] += _amount;
}
function changeOwner3(address _owner3) public onlyOwner {
owner3 = _owner3;
}
}
{
"compilationTarget": {
"Token.sol": "Token"
},
"libraries": {},
"optimizer": {
"enabled": true,
"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":"success","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":"_user","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferToken_toBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"","type":"address"}],"name":"balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner3","type":"address"}],"name":"changeOwner3","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner2","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"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":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_user","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transferToken_toInvestBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"add_tokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner3","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"investBalances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"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"}]