Address Contract Partially Verified
Address
0x2ecB13A8c458c379c4d9a7259e202De03c8F3D19
Balance
0 ETH
Nonce
1
Code Size
6807 bytes
Creator
0x1e1fEdbe...5Cf1 at tx 0x141af96d...bd5781
Indexed Transactions
0
Contract Bytecode
6807 bytes
0x6060604052600436106101745763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166302d6f730811461017957806305d2035b146101be57806306fdde03146101e5578063095ea7b31461026f5780630bb2cd6b14610291578063158ef93e146102c057806317a950ac146102d357806318160ddd1461030457806323b872dd14610317578063313ce5671461033f5780633be1e952146103685780633f4ba83a1461039957806340c10f19146103ac57806342966c68146103ce5780635be7fde8146103e45780635c975abb146103f7578063661884631461040a57806366a92cda1461042c57806370a082311461043f5780637d64bcb41461045e5780638456cb59146104715780638da5cb5b1461048457806395d89b41146104b3578063a9059cbb146104c6578063ca63b5b8146104e8578063d73dd62314610507578063d8aeedf514610529578063dd62ed3e14610548578063f2fde38b1461056d575b600080fd5b341561018457600080fd5b61019b600160a060020a036004351660243561058c565b60405167ffffffffffffffff909216825260208201526040908101905180910390f35b34156101c957600080fd5b6101d1610619565b604051901515815260200160405180910390f35b34156101f057600080fd5b6101f8610629565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561023457808201518382015260200161021c565b50505050905090810190601f1680156102615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561027a57600080fd5b6101d1600160a060020a036004351660243561066a565b341561029c57600080fd5b6101d1600160a060020a036004351660243567ffffffffffffffff604435166106d6565b34156102cb57600080fd5b6101d161084a565b34156102de57600080fd5b6102f2600160a060020a036004351661086d565b60405190815260200160405180910390f35b341561030f57600080fd5b6102f261087e565b341561032257600080fd5b6101d1600160a060020a0360043581169060243516604435610884565b341561034a57600080fd5b6103526108b1565b60405160ff909116815260200160405180910390f35b341561037357600080fd5b610397600160a060020a036004351660243567ffffffffffffffff604435166108b6565b005b34156103a457600080fd5b610397610a19565b34156103b757600080fd5b6101d1600160a060020a0360043516602435610a99565b34156103d957600080fd5b610397600435610ba6565b34156103ef57600080fd5b6102f2610c6f565b341561040257600080fd5b6101d1610cd4565b341561041557600080fd5b6101d1600160a060020a0360043516602435610ce4565b341561043757600080fd5b610397610dde565b341561044a57600080fd5b6102f2600160a060020a0360043516610fa6565b341561046957600080fd5b6101d1610fcf565b341561047c57600080fd5b61039761105a565b341561048f57600080fd5b6104976110df565b604051600160a060020a03909116815260200160405180910390f35b34156104be57600080fd5b6101f86110ee565b34156104d157600080fd5b6101d1600160a060020a036004351660243561112f565b34156104f357600080fd5b6102f2600160a060020a036004351661115a565b341561051257600080fd5b6101d1600160a060020a03600435166024356111e0565b341561053457600080fd5b6102f2600160a060020a0360043516611284565b341561055357600080fd5b6102f2600160a060020a036004358116906024351661129f565b341561057857600080fd5b610397600160a060020a03600435166112ca565b600080805b836001018110156105e557600360006105b4878667ffffffffffffffff16611365565b815260208101919091526040016000205467ffffffffffffffff1692508215156105dd57610611565b600101610591565b600460006105fd878667ffffffffffffffff16611365565b815260208101919091526040016000205491505b509250929050565b60065460a060020a900460ff1681565b6106316117ec565b60408051908101604052601581527f426c6f636b2d436861696e2e636f6d20546f6b656e00000000000000000000006020820152905090565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b600654600090819033600160a060020a039081169116146106f657600080fd5b60065460a060020a900460ff161561070d57600080fd5b600054610720908563ffffffff61139916565b6000556107378567ffffffffffffffff8516611365565b600081815260046020526040902054909150610759908563ffffffff61139916565b600082815260046020908152604080832093909355600160a060020a0388168252600590522054610790908563ffffffff61139916565b600160a060020a0386166000908152600560205260409020556107b385846113a8565b84600160a060020a03167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968858560405190815260200160405180910390a284600160a060020a03167f2ecd071e4d10ed2221b04636ed0724cce66a873aa98c1a31b4bb0e6846d3aab4848660405167ffffffffffffffff909216825260208201526040908101905180910390a2506001949350505050565b600654760100000000000000000000000000000000000000000000900460ff1681565b600061087882611542565b92915050565b60005481565b60065460009060a860020a900460ff161561089e57600080fd5b6108a984848461155d565b949350505050565b601290565b6000600160a060020a03841615156108cd57600080fd5b600160a060020a0333166000908152600160205260409020548311156108f257600080fd5b600160a060020a03331660009081526001602052604090205461091b908463ffffffff6116df16565b600160a060020a0333166000908152600160205260409020556109488467ffffffffffffffff8416611365565b60008181526004602052604090205490915061096a908463ffffffff61139916565b600082815260046020908152604080832093909355600160a060020a03871682526005905220546109a1908463ffffffff61139916565b600160a060020a0385166000908152600560205260409020556109c484836113a8565b83600160a060020a03167f2ecd071e4d10ed2221b04636ed0724cce66a873aa98c1a31b4bb0e6846d3aab4838560405167ffffffffffffffff909216825260208201526040908101905180910390a250505050565b60065433600160a060020a03908116911614610a3457600080fd5b60065460a860020a900460ff161515610a4c57600080fd5b6006805475ff000000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60065460009033600160a060020a03908116911614610ab757600080fd5b60065460a060020a900460ff1615610ace57600080fd5b600054610ae1908363ffffffff61139916565b6000908155600160a060020a038416815260016020526040902054610b0c908363ffffffff61139916565b600160a060020a0384166000818152600160205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a03831660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b6000808211610bb457600080fd5b600160a060020a033316600090815260016020526040902054821115610bd957600080fd5b5033600160a060020a038116600090815260016020526040902054610bfe90836116df565b600160a060020a03821660009081526001602052604081209190915554610c2b908363ffffffff6116df16565b600055600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a25050565b6000806000610c7f33600061058c565b67ffffffffffffffff909116925090505b8115801590610c9e57508142115b15610ccf57610cab610dde565b91820191610cba33600061058c565b67ffffffffffffffff90911692509050610c90565b505090565b60065460a860020a900460ff1681565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610d4157600160a060020a033381166000908152600260209081526040808320938816835292905290812055610d78565b610d51818463ffffffff6116df16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6000806000806000610df1336000611365565b60008181526003602052604090205490955067ffffffffffffffff169350831515610e1b57600080fd5b8367ffffffffffffffff164267ffffffffffffffff16111515610e3d57600080fd5b610e51338567ffffffffffffffff16611365565b60008181526003602090815260408083205460048352818420805490859055600160a060020a0333168552600190935292205492955067ffffffffffffffff90911693509150610ea7908263ffffffff61139916565b600160a060020a033316600090815260016020908152604080832093909355600590522054610edc908263ffffffff6116df16565b600160a060020a03331660009081526005602052604090205567ffffffffffffffff82161515610f28576000858152600360205260409020805467ffffffffffffffff19169055610f62565b600085815260036020526040808220805467ffffffffffffffff861667ffffffffffffffff19918216179091558583529120805490911690555b33600160a060020a03167fb21fb52d5749b80f3182f8c6992236b5e5576681880914484d7f4c9b062e619e8260405190815260200160405180910390a25050505050565b600160a060020a038116600090815260056020526040812054610fc883611542565b0192915050565b60065460009033600160a060020a03908116911614610fed57600080fd5b60065460a060020a900460ff161561100457600080fd5b6006805474ff0000000000000000000000000000000000000000191660a060020a1790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b60065433600160a060020a0390811691161461107557600080fd5b60065460a860020a900460ff161561108c57600080fd5b6006805475ff000000000000000000000000000000000000000000191660a860020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600654600160a060020a031681565b6110f66117ec565b60408051908101604052600281527f42430000000000000000000000000000000000000000000000000000000000006020820152905090565b60065460009060a860020a900460ff161561114957600080fd5b61115383836116f1565b9392505050565b6000806003600061116c856000611365565b815260208101919091526040016000205467ffffffffffffffff1690505b67ffffffffffffffff8116156111da57600190910190600360006111b88567ffffffffffffffff8516611365565b815260208101919091526040016000205467ffffffffffffffff16905061118a565b50919050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054611218908363ffffffff61139916565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a031660009081526005602052604090205490565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60065433600160a060020a039081169116146112e557600080fd5b600160a060020a03811615156112fa57600080fd5b600654600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6801000000000000000091909102177f57495348000000000000000000000000000000000000000000000000000000001790565b60008282018381101561115357fe5b6000808080804267ffffffffffffffff8716116113c457600080fd5b6113d8878767ffffffffffffffff16611365565b94506113e5876000611365565b60008181526003602052604090205490945067ffffffffffffffff169250821515611438576000848152600360205260409020805467ffffffffffffffff191667ffffffffffffffff8816179055611539565b61144c878467ffffffffffffffff16611365565b91505b67ffffffffffffffff83161580159061147b57508267ffffffffffffffff168667ffffffffffffffff16115b156114b4575060008181526003602052604090205490925067ffffffffffffffff908116918391166114ad8784611365565b915061144f565b8267ffffffffffffffff168667ffffffffffffffff1614156114d557611539565b67ffffffffffffffff83161561150f576000858152600360205260409020805467ffffffffffffffff191667ffffffffffffffff85161790555b6000848152600360205260409020805467ffffffffffffffff191667ffffffffffffffff88161790555b50505050505050565b600160a060020a031660009081526001602052604090205490565b6000600160a060020a038316151561157457600080fd5b600160a060020a03841660009081526001602052604090205482111561159957600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156115cc57600080fd5b600160a060020a0384166000908152600160205260409020546115f5908363ffffffff6116df16565b600160a060020a03808616600090815260016020526040808220939093559085168152205461162a908363ffffffff61139916565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054611672908363ffffffff6116df16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6000828211156116eb57fe5b50900390565b6000600160a060020a038316151561170857600080fd5b600160a060020a03331660009081526001602052604090205482111561172d57600080fd5b600160a060020a033316600090815260016020526040902054611756908363ffffffff6116df16565b600160a060020a03338116600090815260016020526040808220939093559085168152205461178b908363ffffffff61139916565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b60206040519081016040526000815290565b611806611a1c565b61180e611a44565b611816611a1c565b600654600090760100000000000000000000000000000000000000000000900460ff161561184357600080fd5b6006805476ff000000000000000000000000000000000000000000001916760100000000000000000000000000000000000000000000179055606060405190810160409081527393abee979b9094f16082f71c01f60f51e52c78e38252739daf89767751c56fccaa711cea1bd7d6589cec08602083015273ca9d01465be0fa4b7f5540556283244f49532f8d8183015290945060609051908101604052806aa56fa5b99019a5c800000081526020016a18d0bf423c03d8de00000081526020016a0e0fe3d8bb9bc7b10000008152509250606060405190810160409081526000808352635c2a83526020840152635ace77519183019190915290925090505b60038110156119e15781816003811061195757fe5b602002015167ffffffffffffffff16151561199c5761199684826003811061197b57fe5b602002015184836003811061198c57fe5b6020020151610a99565b506119d9565b6119d78482600381106119ab57fe5b60200201518483600381106119bc57fe5b60200201518484600381106119cd57fe5b60200201516106d6565b505b600101611942565b6119e9610fcf565b507f5daa87a0e9463431830481fd4b6e3403442dfb9a12b9c07597e9f61d50b633c860405160405180910390a150505050565b60606040519081016040526003815b600081526000199091019060200181611a2b5790505090565b60606040519081016040526003815b6000815260200190600190039081611a5357905050905600a165627a7a72305820d78442629678404b5e168d4e0dd214f8d287d7ca04eaf1b8d4f3fe3c9eb6b4890029
Verified Source Code Partial Match
Compiler: v0.4.20+commit.3155dd80
Optimization: Yes (200 runs)
MainToken.sol 732 lines
/*
* This file was generated by MyWish Platform (https://mywish.io/)
* The complete code could be found at https://github.com/MyWishPlatform/
* Copyright (C) 2018 MyWish
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
pragma solidity ^0.4.20;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
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) {
// 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;
}
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;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
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);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract FreezableToken is StandardToken {
// freezing chains
mapping (bytes32 => uint64) internal chains;
// freezing amounts for each chain
mapping (bytes32 => uint) internal freezings;
// total freezing balance per address
mapping (address => uint) internal freezingBalance;
event Freezed(address indexed to, uint64 release, uint amount);
event Released(address indexed owner, uint amount);
/**
* @dev Gets the balance of the specified address include freezing tokens.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return super.balanceOf(_owner) + freezingBalance[_owner];
}
/**
* @dev Gets the balance of the specified address without freezing tokens.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function actualBalanceOf(address _owner) public view returns (uint256 balance) {
return super.balanceOf(_owner);
}
function freezingBalanceOf(address _owner) public view returns (uint256 balance) {
return freezingBalance[_owner];
}
/**
* @dev gets freezing count
* @param _addr Address of freeze tokens owner.
*/
function freezingCount(address _addr) public view returns (uint count) {
uint64 release = chains[toKey(_addr, 0)];
while (release != 0) {
count ++;
release = chains[toKey(_addr, release)];
}
}
/**
* @dev gets freezing end date and freezing balance for the freezing portion specified by index.
* @param _addr Address of freeze tokens owner.
* @param _index Freezing portion index. It ordered by release date descending.
*/
function getFreezing(address _addr, uint _index) public view returns (uint64 _release, uint _balance) {
for (uint i = 0; i < _index + 1; i ++) {
_release = chains[toKey(_addr, _release)];
if (_release == 0) {
return;
}
}
_balance = freezings[toKey(_addr, _release)];
}
/**
* @dev freeze your tokens to the specified address.
* Be careful, gas usage is not deterministic,
* and depends on how many freezes _to address already has.
* @param _to Address to which token will be freeze.
* @param _amount Amount of token to freeze.
* @param _until Release date, must be in future.
*/
function freezeTo(address _to, uint _amount, uint64 _until) public {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
bytes32 currentKey = toKey(_to, _until);
freezings[currentKey] = freezings[currentKey].add(_amount);
freezingBalance[_to] = freezingBalance[_to].add(_amount);
freeze(_to, _until);
Freezed(_to, _until, _amount);
}
/**
* @dev release first available freezing tokens.
*/
function releaseOnce() public {
bytes32 headKey = toKey(msg.sender, 0);
uint64 head = chains[headKey];
require(head != 0);
require(uint64(block.timestamp) > head);
bytes32 currentKey = toKey(msg.sender, head);
uint64 next = chains[currentKey];
uint amount = freezings[currentKey];
delete freezings[currentKey];
balances[msg.sender] = balances[msg.sender].add(amount);
freezingBalance[msg.sender] = freezingBalance[msg.sender].sub(amount);
if (next == 0) {
delete chains[headKey];
}
else {
chains[headKey] = next;
delete chains[currentKey];
}
Released(msg.sender, amount);
}
/**
* @dev release all available for release freezing tokens. Gas usage is not deterministic!
* @return how many tokens was released
*/
function releaseAll() public returns (uint tokens) {
uint release;
uint balance;
(release, balance) = getFreezing(msg.sender, 0);
while (release != 0 && block.timestamp > release) {
releaseOnce();
tokens += balance;
(release, balance) = getFreezing(msg.sender, 0);
}
}
function toKey(address _addr, uint _release) internal pure returns (bytes32 result) {
// WISH masc to increase entropy
result = 0x5749534800000000000000000000000000000000000000000000000000000000;
assembly {
result := or(result, mul(_addr, 0x10000000000000000))
result := or(result, _release)
}
}
function freeze(address _to, uint64 _until) internal {
require(_until > block.timestamp);
bytes32 key = toKey(_to, _until);
bytes32 parentKey = toKey(_to, uint64(0));
uint64 next = chains[parentKey];
if (next == 0) {
chains[parentKey] = _until;
return;
}
bytes32 nextKey = toKey(_to, next);
uint parent;
while (next != 0 && _until > next) {
parent = next;
parentKey = nextKey;
next = chains[nextKey];
nextKey = toKey(_to, next);
}
if (_until == next) {
return;
}
if (next != 0) {
chains[key] = next;
}
chains[parentKey] = _until;
}
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223Receiver {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
contract ERC223Basic is ERC20Basic {
function transfer(address to, uint value, bytes data) public returns (bool);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
}
contract SuccessfulERC223Receiver is ERC223Receiver {
event Invoked(address from, uint value, bytes data);
function tokenFallback(address _from, uint _value, bytes _data) public {
Invoked(_from, _value, _data);
}
}
contract FailingERC223Receiver is ERC223Receiver {
function tokenFallback(address, uint, bytes) public {
revert();
}
}
contract ERC223ReceiverWithoutTokenFallback {
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract FreezableMintableToken is FreezableToken, MintableToken {
/**
* @dev Mint the specified amount of token to the specified address and freeze it until the specified date.
* Be careful, gas usage is not deterministic,
* and depends on how many freezes _to address already has.
* @param _to Address to which token will be freeze.
* @param _amount Amount of token to mint and freeze.
* @param _until Release date, must be in future.
* @return A boolean that indicates if the operation was successful.
*/
function mintAndFreeze(address _to, uint _amount, uint64 _until) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
bytes32 currentKey = toKey(_to, _until);
freezings[currentKey] = freezings[currentKey].add(_amount);
freezingBalance[_to] = freezingBalance[_to].add(_amount);
freeze(_to, _until);
Mint(_to, _amount);
Freezed(_to, _until, _amount);
return true;
}
}
contract Consts {
uint constant TOKEN_DECIMALS = 18;
uint8 constant TOKEN_DECIMALS_UINT8 = 18;
uint constant TOKEN_DECIMAL_MULTIPLIER = 10 ** TOKEN_DECIMALS;
string constant TOKEN_NAME = "Block-Chain.com Token";
string constant TOKEN_SYMBOL = "BC";
bool constant PAUSED = false;
address constant TARGET_USER = 0x39e1ABc4440A59a54790b7A729812981BbEA4295;
bool constant CONTINUE_MINTING = false;
}
/**
* @title Reference implementation of the ERC223 standard token.
*/
contract ERC223Token is ERC223Basic, BasicToken, FailingERC223Receiver {
using SafeMath for uint;
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public returns (bool) {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly.
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength > 0) {
ERC223Receiver receiver = ERC223Receiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
Transfer(msg.sender, _to, _value, _data);
return true;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
bytes memory empty;
return transfer(_to, _value, empty);
}
}
contract MainToken is Consts, FreezableMintableToken, BurnableToken, Pausable
{
event Initialized();
bool public initialized = false;
function MainToken() public {
init();
transferOwnership(TARGET_USER);
}
function init() private {
require(!initialized);
initialized = true;
if (PAUSED) {
pause();
}
address[3] memory addresses = [address(0x93abee979b9094f16082f71c01f60f51e52c78e3),address(0x9daf89767751c56fccaa711cea1bd7d6589cec08),address(0xca9d01465be0fa4b7f5540556283244f49532f8d)];
uint[3] memory amounts = [uint(200000000000000000000000000),uint(30000000000000000000000000),uint(17000000000000000000000000)];
uint64[3] memory freezes = [uint64(0),uint64(1546290002),uint64(1523480401)];
for (uint i = 0; i < addresses.length; i++) {
if (freezes[i] == 0) {
mint(addresses[i], amounts[i]);
} else {
mintAndFreeze(addresses[i], amounts[i], freezes[i]);
}
}
if (!CONTINUE_MINTING) {
finishMinting();
}
Initialized();
}
function name() pure public returns (string _name) {
return TOKEN_NAME;
}
function symbol() pure public returns (string _symbol) {
return TOKEN_SYMBOL;
}
function decimals() pure public returns (uint8 _decimals) {
return TOKEN_DECIMALS_UINT8;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool _success) {
require(!paused);
return super.transferFrom(_from, _to, _value);
}
function transfer(address _to, uint256 _value) public returns (bool _success) {
require(!paused);
return super.transfer(_to, _value);
}
}
Read Contract
actualBalanceOf 0x17a950ac → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
freezingBalanceOf 0xd8aeedf5 → uint256
freezingCount 0xca63b5b8 → uint256
getFreezing 0x02d6f730 → uint64, uint256
initialized 0x158ef93e → bool
mintingFinished 0x05d2035b → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 15 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address _spender
uint256 _value
returns: bool
burn 0x42966c68
uint256 _value
decreaseApproval 0x66188463
address _spender
uint256 _subtractedValue
returns: bool
finishMinting 0x7d64bcb4
No parameters
returns: bool
freezeTo 0x3be1e952
address _to
uint256 _amount
uint64 _until
increaseApproval 0xd73dd623
address _spender
uint256 _addedValue
returns: bool
mint 0x40c10f19
address _to
uint256 _amount
returns: bool
mintAndFreeze 0x0bb2cd6b
address _to
uint256 _amount
uint64 _until
returns: bool
pause 0x8456cb59
No parameters
releaseAll 0x5be7fde8
No parameters
returns: uint256
releaseOnce 0x66a92cda
No parameters
transfer 0xa9059cbb
address _to
uint256 _value
returns: bool
transferFrom 0x23b872dd
address _from
address _to
uint256 _value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
Recent Transactions
No transactions found for this address