A factory for pre-ERC-20 standard tokens: one call deploys a token with a chosen supply and records it under the caller's address.
Historical Significance
A token factory operating before ERC-20 was proposed, offering the thing that later token generators sold: a token without writing or compiling Solidity. The registry it keeps of who created what is the part that outlived the interface, since the address list survives whether or not anything uses the tokens.
Context
Ethereum's Frontier network went live on 30 July 2015. The chain carried almost no applications in its first months: what was deployed was mostly tutorial code, token experiments and registries, written in a Solidity that was itself only a few months old and compiled from the geth console.
Key Facts
Description
Standard_Token_Factory deploys tokens on request. createStandardToken(amount) creates a new fixed supply token, immediately sends the whole supply on to the caller, and files the new token's address under that caller in a public mapping. createdByMe() returns the list of tokens an account has created through it.
The tokens it produces follow the Standardized Contract APIs that preceded ERC-20: sendCoin, sendCoinFrom, coinBalance and coinBalanceOf, with blanket and single-use approvals rather than an allowance mapping.
The factory keeps no fee, has no owner and no way to stop it. Anyone who has the address can mint themselves a token by sending one transaction.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
This contract has verified source code on Etherscan.
Show source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract Coin {
function sendCoin(uint _value, address _to) returns (bool _success) {}
function sendCoinFrom(address _from, uint _value, address _to) returns (bool _success) {}
function coinBalance() constant returns (uint _r) {}
function coinBalanceOf(address _addr) constant returns (uint _r) {}
function approve(address _addr) {}
function approveOnce(address _addr, uint256 _maxValue) {}
function unapprove(address _addr) {}
function isApproved(address _proxy) constant returns (bool _r) {}
function isApprovedFor(address _target, address _proxy) constant returns (bool _r) {}
}
contract Standard_Token is Coin {
function Standard_Token(uint _initialAmount) {
balances[msg.sender] = _initialAmount;
}
event CoinTransfer(address indexed from, address indexed to, uint256 value);
event AddressApproval(address indexed from, address indexed to, bool result);
event AddressApprovalOnce(address indexed from, address indexed to, uint256 value);
function sendCoin(uint _value, address _to) returns (bool _success) {
if (balances[msg.sender] >= _value) {
balances[msg.sender] -= _value;
balances[_to] += _value;
CoinTransfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function sendCoinFrom(address _from, uint _value, address _to) returns (bool _success) {
if (balances[_from] >= _value) {
bool transfer = false;
if(approved[_from][msg.sender]) {
transfer = true;
} else {
if(_value < approved_once[_from][msg.sender]) {
transfer = true;
approved_once[_from][msg.sender] = 0; //reset
}
}
if(transfer == true) {
balances[_from] -= _value;
balances[_to] += _value;
CoinTransfer(_from, _to, _value);
return true;
} else { return false; }
}
}
function coinBalance() constant returns (uint _r) {
return balances[msg.sender];
}
function coinBalanceOf(address _addr) constant returns (uint _r) {
return balances[_addr];
}
function approve(address _addr) {
approved[msg.sender][_addr] = true;
AddressApproval(msg.sender, _addr, true);
}
function approveOnce(address _addr, uint256 _maxValue) {
approved_once[msg.sender][_addr] = _maxValue;
AddressApprovalOnce(msg.sender, _addr, _maxValue);
}
function unapprove(address _addr) {
approved[msg.sender][_addr] = false;
approved_once[msg.sender][_addr] = 0;
AddressApproval(msg.sender, _addr, false);
AddressApprovalOnce(msg.sender, _addr, 0);
}
function isApproved(address _proxy) constant returns (bool _r) {
if(approved[msg.sender][_proxy] == true || approved_once[msg.sender][_proxy] > 0) {
return true;
}
}
function isApprovedFor(address _target, address _proxy) constant returns (bool _r) {
if(approved[_target][_proxy] == true || approved_once[_target][_proxy] > 0) {
return true;
}
}
mapping (address => uint) public balances;
mapping (address => mapping (address => bool)) public approved;
mapping (address => mapping (address => uint256)) public approved_once;
}
contract Standard_Token_Factory {
mapping(address => address[]) public created;
function createdByMe() returns (address[]) {
return created[msg.sender];
}
function createStandardToken(uint256 _initialAmount) returns (address) {
address newTokenAddr = address(new Standard_Token(_initialAmount));
Standard_Token newToken = Standard_Token(newTokenAddr);
newToken.sendCoin(_initialAmount, msg.sender); //the factory will own the created tokens. You must transfer them.
uint count = created[msg.sender].length += 1;
created[msg.sender][count-1] = newTokenAddr;
created[msg.sender].length = count;
}
}
External Links
Related contracts
Standard_Token
Same deployerA token built to the pre-ERC-20 Standardized Contract APIs, with sendCoin and coinBalanceOf in place of transfer and balanceOf.
0xdc3153...a8f965August 13, 2015Token
Same deployerA minimal ERC20 token with allowances: balanceOf, allowance, totalSupply, transfer, approve, transferFrom, with Transfer/Approval events. Guards balance, allowa
0x37dca3...38f00dJanuary 28, 2016Verify Token
Same deployerA ConsenSys HumanStandardToken deployed as Verify Token, symbol VTX, with 3 decimals and a fixed supply credited to its deployer.
0x584761...ea4afaJune 24, 2016Test Simon Bucks
Same deployerA ConsenSys HumanStandardToken deployed as Test Simon Bucks, symbol SBX, with 2 decimals and a fixed supply credited to its deployer.
0x42d1e2...8d55ecJuly 17, 2016Greeter
Same eraA HelloWorld greeter deployed at block 51,909 on 8 August 2015, one of a run of contracts from the same account that week.
0x412fda...7267edAugust 8, 2015Greeter
Same eraA Greeter with the message 'Ethereum will change the world smarter' - deployed Aug 8, 2015 by a developer connected to the Tokyo Smart Contract meetup.
0xda0c1c...7a68ebAugust 8, 2015