Source Code
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 4298183 | 3075 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
BasicCoin
Compiler Version
v0.4.2+commit.af6afb04
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2017-09-25
*/
//! BasicCoin ECR20-compliant token contract
//! By Parity Team (Ethcore), 2016.
//! Released under the Apache Licence 2.
pragma solidity ^0.4.1;
// ECR20 standard token interface
contract Token {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
}
// Owner-specific contract interface
contract Owned {
event NewOwner(address indexed old, address indexed current);
modifier only_owner {
if (msg.sender != owner) throw;
_;
}
address public owner = msg.sender;
function setOwner(address _new) only_owner {
NewOwner(owner, _new);
owner = _new;
}
}
// TokenReg interface
contract TokenReg {
function register(address _addr, string _tla, uint _base, string _name) payable returns (bool);
function registerAs(address _addr, string _tla, uint _base, string _name, address _owner) payable returns (bool);
function unregister(uint _id);
function setFee(uint _fee);
function tokenCount() constant returns (uint);
function token(uint _id) constant returns (address addr, string tla, uint base, string name, address owner);
function fromAddress(address _addr) constant returns (uint id, string tla, uint base, string name, address owner);
function fromTLA(string _tla) constant returns (uint id, address addr, uint base, string name, address owner);
function meta(uint _id, bytes32 _key) constant returns (bytes32);
function setMeta(uint _id, bytes32 _key, bytes32 _value);
function transferTLA(string _tla, address _to) returns (bool success);
function drain();
uint public fee;
}
// BasicCoin, ECR20 tokens that all belong to the owner for sending around
contract BasicCoin is Owned, Token {
// this is as basic as can be, only the associated balance & allowances
struct Account {
uint balance;
mapping (address => uint) allowanceOf;
}
// the balance should be available
modifier when_owns(address _owner, uint _amount) {
if (accounts[_owner].balance < _amount) throw;
_;
}
// an allowance should be available
modifier when_has_allowance(address _owner, address _spender, uint _amount) {
if (accounts[_owner].allowanceOf[_spender] < _amount) throw;
_;
}
// no ETH should be sent with the transaction
modifier when_no_eth {
if (msg.value > 0) throw;
_;
}
// a value should be > 0
modifier when_non_zero(uint _value) {
if (_value == 0) throw;
_;
}
// the base, tokens denoted in micros
uint constant public base = 1000000;
// available token supply
uint public totalSupply;
// storage and mapping of all balances & allowances
mapping (address => Account) accounts;
// constructor sets the parameters of execution, _totalSupply is all units
function BasicCoin(uint _totalSupply, address _owner) when_no_eth when_non_zero(_totalSupply) {
totalSupply = _totalSupply;
owner = _owner;
accounts[_owner].balance = totalSupply;
}
// balance of a specific address
function balanceOf(address _who) constant returns (uint256) {
return accounts[_who].balance;
}
// transfer
function transfer(address _to, uint256 _value) when_no_eth when_owns(msg.sender, _value) returns (bool) {
Transfer(msg.sender, _to, _value);
accounts[msg.sender].balance -= _value;
accounts[_to].balance += _value;
return true;
}
// transfer via allowance
function transferFrom(address _from, address _to, uint256 _value) when_no_eth when_owns(_from, _value) when_has_allowance(_from, msg.sender, _value) returns (bool) {
Transfer(_from, _to, _value);
accounts[_from].allowanceOf[msg.sender] -= _value;
accounts[_from].balance -= _value;
accounts[_to].balance += _value;
return true;
}
// approve allowances
function approve(address _spender, uint256 _value) when_no_eth returns (bool) {
Approval(msg.sender, _spender, _value);
accounts[msg.sender].allowanceOf[_spender] += _value;
return true;
}
// available allowance
function allowance(address _owner, address _spender) constant returns (uint256) {
return accounts[_owner].allowanceOf[_spender];
}
// no default function, simple contract only, entry-level users
function() {
throw;
}
}
// Manages BasicCoin instances, including the deployment & registration
contract BasicCoinManager is Owned {
// a structure wrapping a deployed BasicCoin
struct Coin {
address coin;
address owner;
address tokenreg;
}
// a new BasicCoin has been deployed
event Created(address indexed owner, address indexed tokenreg, address indexed coin);
// a list of all the deployed BasicCoins
Coin[] coins;
// all BasicCoins for a specific owner
mapping (address => uint[]) ownedCoins;
// the base, tokens denoted in micros (matches up with BasicCoin interface above)
uint constant public base = 1000000;
// return the number of deployed
function count() constant returns (uint) {
return coins.length;
}
// get a specific deployment
function get(uint _index) constant returns (address coin, address owner, address tokenreg) {
Coin c = coins[_index];
coin = c.coin;
owner = c.owner;
tokenreg = c.tokenreg;
}
// returns the number of coins for a specific owner
function countByOwner(address _owner) constant returns (uint) {
return ownedCoins[_owner].length;
}
// returns a specific index by owner
function getByOwner(address _owner, uint _index) constant returns (address coin, address owner, address tokenreg) {
return get(ownedCoins[_owner][_index]);
}
// deploy a new BasicCoin on the blockchain
function deploy(uint _totalSupply, string _tla, string _name, address _tokenreg) payable returns (bool) {
TokenReg tokenreg = TokenReg(_tokenreg);
BasicCoin coin = new BasicCoin(_totalSupply, msg.sender);
uint ownerCount = countByOwner(msg.sender);
uint fee = tokenreg.fee();
ownedCoins[msg.sender].length = ownerCount + 1;
ownedCoins[msg.sender][ownerCount] = coins.length;
coins.push(Coin(coin, msg.sender, tokenreg));
tokenreg.registerAs.value(fee)(coin, _tla, base, _name, msg.sender);
Created(msg.sender, tokenreg, coin);
return true;
}
// owner can withdraw all collected funds
function drain() only_owner {
if (!msg.sender.send(this.balance)) {
throw;
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"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,"type":"function"},{"constant":true,"inputs":[],"name":"base","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"_totalSupply","type":"uint256"},{"name":"_owner","type":"address"}],"type":"constructor"},{"payable":false,"type":"fallback"},{"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":"old","type":"address"},{"indexed":true,"name":"current","type":"address"}],"name":"NewOwner","type":"event"}]Contract Creation Code
6060604081815260008054600160a060020a0319163317905580610523833960a09052516080516000341115609d576002565b8260016000508190555081600060006101000a815481600160a060020a03021916908302179055506001600050546002600050600084600160a060020a0316815260200190815260200160002060005060000160005081905550505050610479806100aa6000396000f35b818060001415603257600256606060405236156100775760e060020a6000350463095ea7b3811461008457806313af4035146100a257806318160ddd146100c957806323b872dd146100d75780635001f3b5146100f857806370a08231146101075780638da5cb5b1461013a578063a9059cbb14610151578063dd62ed3e1461016f575b34610002576101ae610002565b34610002576101b0600435602435600060003411156101e157610002565b34610002576101ae600435600054600160a060020a03908116339091161461026457610002565b346100025761012860015481565b34610002576101b0600435602435604435600060003411156102bf57610002565b3461000257610128620f424081565b3461000257600160a060020a03600435166000908152600260205260409020545b60408051918252519081900360200190f35b34610002576101c4600054600160a060020a031681565b34610002576101b0600435602435600060003411156103cb57610002565b3461000257610128600435602435600160a060020a03828116600090815260026020908152604080832093851683526001909301905220545b92915050565b005b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b82600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a35033600160a060020a0390811660009081526002602090815260408083209386168352600193840190915290208054830190556101a8565b60008054604051600160a060020a03848116939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b600160a060020a03841660009081526002602052604090205484908390819010156102e957610002565b600160a060020a03868116600090815260026020908152604080832033948516845260010190915290205487919086908190101561032657610002565b87600160a060020a031689600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef896040518082815260200191505060405180910390a3600160a060020a03898116600090815260026020818152604080842033861685526001818101845282862080548f900390559390925281548c9003909155928b168252919020805489019055955050505050509392505050565b33600160a060020a0381166000908152600260205260409020548390819010156103f457610002565b84600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a333600160a060020a039081166000908152600260205260408082208054889003905591871681522080548501905560019250505092915050560000000000000000000000000000000000000000000000000000b5e620f4800000000000000000000000000000438a827b29e346879dc81404e296182d9b2b20
Deployed Bytecode
0x606060405236156100775760e060020a6000350463095ea7b3811461008457806313af4035146100a257806318160ddd146100c957806323b872dd146100d75780635001f3b5146100f857806370a08231146101075780638da5cb5b1461013a578063a9059cbb14610151578063dd62ed3e1461016f575b34610002576101ae610002565b34610002576101b0600435602435600060003411156101e157610002565b34610002576101ae600435600054600160a060020a03908116339091161461026457610002565b346100025761012860015481565b34610002576101b0600435602435604435600060003411156102bf57610002565b3461000257610128620f424081565b3461000257600160a060020a03600435166000908152600260205260409020545b60408051918252519081900360200190f35b34610002576101c4600054600160a060020a031681565b34610002576101b0600435602435600060003411156103cb57610002565b3461000257610128600435602435600160a060020a03828116600090815260026020908152604080832093851683526001909301905220545b92915050565b005b604080519115158252519081900360200190f35b60408051600160a060020a03929092168252519081900360200190f35b82600160a060020a031633600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a35033600160a060020a0390811660009081526002602090815260408083209386168352600193840190915290208054830190556101a8565b60008054604051600160a060020a03848116939216917f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b236491a36000805473ffffffffffffffffffffffffffffffffffffffff19168217905550565b600160a060020a03841660009081526002602052604090205484908390819010156102e957610002565b600160a060020a03868116600090815260026020908152604080832033948516845260010190915290205487919086908190101561032657610002565b87600160a060020a031689600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef896040518082815260200191505060405180910390a3600160a060020a03898116600090815260026020818152604080842033861685526001818101845282862080548f900390559390925281548c9003909155928b168252919020805489019055955050505050509392505050565b33600160a060020a0381166000908152600260205260409020548390819010156103f457610002565b84600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a333600160a060020a03908116600090815260026020526040808220805488900390559187168152208054850190556001925050509291505056
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000b5e620f4800000000000000000000000000000438a827b29e346879dc81404e296182d9b2b20
-----Decoded View---------------
Arg [0] : _totalSupply (uint256): 200000000000000
Arg [1] : _owner (address): 0x00438a827b29e346879dc81404E296182D9b2b20
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000b5e620f48000
Arg [1] : 00000000000000000000000000438a827b29e346879dc81404e296182d9b2b20
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.