Contract Address Details

0xb21E0064BE8699B5d2Cf2058977bb58a69e9a996

YourNewToken SamR Test Token (SRT) Last Balance Update: Block #9609837
Created by 0x763b–109962 at 0x9cc8–b3c648

Balance

0 ETC

(@ /ETC)

Fetching tokens...

Contract name:
YourNewToken




Optimization enabled
true
Compiler version
v0.4.24+commit.e67f0147





Contract source code

/**
* Submitted for verification at blockscout.com on 2018-12-14 12:11:25.616414Z
*/
pragma solidity ^0.4.24;
contract ERC223 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function name() constant returns (string _name);
function symbol() constant returns (string _symbol);
function decimals() constant returns (uint8 _decimals);
function totalSupply() constant returns (uint256 _supply);
function transfer(address to, uint value) returns (bool ok);
function transfer(address to, uint value, bytes data) returns (bool ok);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event ERC223Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data);
}
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data);
}
contract ERC223Token is ERC223 {
using SafeMath for uint;
mapping(address => uint) balances;
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
// Function to access name of token .
function name() constant returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() constant returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() constant returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() constant returns (uint256 _totalSupply) {
return totalSupply;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
if(length>0) {
return true;
}
else {
return false;
}
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
Transfer(msg.sender, _to, _value);
ERC223Transfer(msg.sender, _to, _value, _data);
return true;
}
//function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
ContractReceiver reciever = ContractReceiver(_to);
reciever.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value);
ERC223Transfer(msg.sender, _to, _value, _data);
return true;
}
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
}
/**
* @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;
}
}
// change contract name to your contract's name
// i.e. "contract Bitcoin is ERC223Token"
contract YourNewToken is ERC223Token {
using SafeMath for uint256;
// for example, "Bitcoin"
string public name = "SamR Test Token";
// for example, "BTC"
string public symbol = "SRT";
// set token's precision
// pick any number from 0 to 18
// for example, 4 decimal points means that
// smallest token using will be 0.0001 TKN
uint public decimals = 8;
// total supply of the token
// for example, for Bitcoin it would be 21000000
uint public totalSupply = 25000000 * (10**decimals);
// Treasure is where ICO funds (ETH/ETC) will be forwarded
// replace this address with your wallet address!
// it is recommended that you create a paper wallet for this purpose
address private treasury = 0x763b7a79c28767af07d94435a501729491109962;
// ICO price. You will need to do a little bit of math to figure it out
// given 4 decimals, this setting means "1 ETC = 50,000 TKN"
uint256 private priceDiv = 5000000;
event Purchase(address indexed purchaser, uint256 amount);
constructor() public {
// This is how many tokens you want to allocate to yourself
balances[msg.sender] = 10000000 * (10**decimals);
// This is how many tokens you want to allocate for ICO
balances[0x0] = 15000000 * (10**decimals);
}
function () public payable {
bytes memory empty;
if (msg.value == 0) { revert(); }
uint256 purchasedAmount = msg.value.div(priceDiv);
if (purchasedAmount == 0) { revert(); } // not enough ETC sent
if (purchasedAmount > balances[0x0]) { revert(); } // too much ETC sent
treasury.transfer(msg.value);
balances[0x0] = balances[0x0].sub(purchasedAmount);
balances[msg.sender] = balances[msg.sender].add(purchasedAmount);
emit Transfer(0x0, msg.sender, purchasedAmount);
emit ERC223Transfer(0x0, msg.sender, purchasedAmount, empty);
emit Purchase(msg.sender, purchasedAmount);
}
}

Contract ABI

[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":""}],"name":"name","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"totalSupply","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"decimals","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"balance"}],"name":"balanceOf","inputs":[{"type":"address","name":"_owner"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":""}],"name":"symbol","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"success"}],"name":"transfer","inputs":[{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"success"}],"name":"transfer","inputs":[{"type":"address","name":"_to"},{"type":"uint256","name":"_value"},{"type":"bytes","name":"_data"}],"constant":false},{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[]},{"type":"fallback","stateMutability":"payable","payable":true},{"type":"event","name":"Purchase","inputs":[{"type":"address","name":"purchaser","indexed":true},{"type":"uint256","name":"amount","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"_from","indexed":true},{"type":"address","name":"_to","indexed":true},{"type":"uint256","name":"_value","indexed":false}],"anonymous":false},{"type":"event","name":"ERC223Transfer","inputs":[{"type":"address","name":"_from","indexed":true},{"type":"address","name":"_to","indexed":true},{"type":"uint256","name":"_value","indexed":false},{"type":"bytes","name":"_data","indexed":false}],"anonymous":false}]
            

Contract Byte Code

0x6080604052600436106100825763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146102d457806318160ddd1461035e578063313ce5671461038557806370a082311461039a57806395d89b41146103bb578063a9059cbb146103d0578063be45fd6214610408575b6060600034151561009257600080fd5b600b546100a690349063ffffffff61047116565b90508015156100b457600080fd5b6000805260016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49548111156100eb57600080fd5b600a54604051600160a060020a03909116903480156108fc02916000818181858888f19350505050158015610124573d6000803e3d6000fd5b506000805260016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4954610160908263ffffffff61048d16565b60016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb495533600090815260409020546101a2908263ffffffff61049f16565b3360008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a333600160a060020a031660007f9bfafdc2ae8835972d7b64ef3f8f307165ac22ceffde4a742c52da5487f45fd183856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561025f578181015183820152602001610247565b50505050905090810190601f16801561028c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a360408051828152905133917f2499a5330ab0979cc612135e7883ebc3cd5c9f7a8508f042540c34723348f632919081900360200190a25050005b3480156102e057600080fd5b506102e96104b5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561036a57600080fd5b50610373610543565b60408051918252519081900360200190f35b34801561039157600080fd5b50610373610549565b3480156103a657600080fd5b50610373600160a060020a036004351661054f565b3480156103c757600080fd5b506102e961056a565b3480156103dc57600080fd5b506103f4600160a060020a03600435166024356105c5565b604080519115158252519081900360200190f35b34801561041457600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526103f4948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506105f49650505050505050565b600080828481151561047f57fe5b0490508091505b5092915050565b60008282111561049957fe5b50900390565b6000828201838110156104ae57fe5b9392505050565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561053b5780601f106105105761010080835404028352916020019161053b565b820191906000526020600020905b81548152906001019060200180831161051e57829003601f168201915b505050505081565b60095481565b60085481565b600160a060020a031660009081526001602052604090205490565b6007805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561053b5780601f106105105761010080835404028352916020019161053b565b600060606105d284610621565b156105e9576105e2848483610641565b9150610486565b6105e284848361089f565b60006105ff84610621565b156106165761060f848484610641565b90506104ae565b61060f84848461089f565b6000813b81811115610636576001915061063b565b600091505b50919050565b6000808361064e3361054f565b101561065957600080fd5b610672846106663361054f565b9063ffffffff61048d16565b3360009081526001602052604090205561069b8461068f8761054f565b9063ffffffff61049f16565b600160a060020a03861660008181526001602090815260408083209490945592517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018a90526060604484019081528951606485015289518c9850959663c0ee0b8a9693958c958c956084909101928601918190849084905b83811015610739578181015183820152602001610721565b50505050905090810190601f1680156107665780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561078757600080fd5b505af115801561079b573d6000803e3d6000fd5b5050604080518781529051600160a060020a03891693503392507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a384600160a060020a031633600160a060020a03167f9bfafdc2ae8835972d7b64ef3f8f307165ac22ceffde4a742c52da5487f45fd186866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610859578181015183820152602001610841565b50505050905090810190601f1680156108865780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001949350505050565b6000826108ab3361054f565b10156108b657600080fd5b6108c3836106663361054f565b336000908152600160205260409020556108e08361068f8661054f565b600160a060020a0385166000818152600160209081526040918290209390935580518681529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a383600160a060020a031633600160a060020a03167f9bfafdc2ae8835972d7b64ef3f8f307165ac22ceffde4a742c52da5487f45fd185856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156109af578181015183820152602001610997565b50505050905090810190601f1680156109dc5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a350600193925050505600a165627a7a72305820539f2a18aeb896c4c53edb30cf65c8639ab3d3310d61395ef722f370654751240029