The first contract on Ethereum mainnet fully compliant with EIP-20 as finalised, tested by execution against all ten mandatory requirements. An ether wrapper, deployed 20 March 2016, and never used.
Historical Significance
Tested by execution against all ten mandatory requirements of EIP-20 as finalised, this is the first contract on Ethereum mainnet that satisfies every one of them. Compliance is a claim about behaviour, so it was settled by behaviour: the contract was run on a mainnet fork, funded through its own deposit() rather than by writing storage, receipts read for the events actually emitted, and eth_call used to measure the width of every return value. It passes twice, once at the head of the chain and once on a fork pinned 93 blocks after its deployment, under the hardfork rules of the day. Earlier candidates each fail at least one rule under execution rather than by inspection: the Digix ledgers and DGX 1.0 emit Transfer with the value indexed and an empty data field, elcoin's transfer, approve and transferFrom return false and move nothing, and 0x37Dca38b1CBB2Cd043910eC46fe82Ddb9e38F00d rejects a zero value transfer. The zero value clause is also what separates this contract from 0xb345180D0a2c791d4943a239f8eBb50efa01c81a, deployed on 25 February 2016, whose only difference is a strict comparison in the bounds helper. The claim does not extend to name, symbol and decimals, which this contract does not have; those three are optional in EIP-20. Deployed in block 1,184,107 on 20 March 2016, it holds one transaction in its life, its own creation. The copy that saw use is its byte identical twin 0xd654bDD32FC99471455e86C2E7f7D7b6437e9179, 81 blocks later.
Key Facts
Description
Deployed 20 March 2016. An ether wrapper of the kind that later became WETH: deposit() credits the caller with the ether sent, withdraw(uint256) checks the balance and sends the ether back before decrementing, and totalSupply() returns address(this).balance rather than a stored counter, so supply and collateral cannot drift apart. The fallback function forwards to deposit(), so a plain ether send wraps. Its Deposit(address indexed, uint256) and Withdrawal(address indexed, uint256) event signatures are the ones WETH9 would carry a year later. On top of that it is a full ERC-20 with allowances, and every failed check is a throw rather than a false return.
It has one transaction in its life, its own creation, and holds no ether.
Source recovered by compiling against solc v0.3.0+commit.11d67369 with the optimizer off, reproducing the deployed runtime exactly. The 85 byte constructor prologue in the creation bytecode is not reproduced by any archived build, so the published source carries no constructor.
Source Verified
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Homestead Era
The first planned hard fork. Removed the canary contract, adjusted gas costs.
Bytecode Overview
Verified Source Available
This contract has verified source code.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract EtherToken {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Deposit(address indexed _owner, uint256 _value);
event Withdrawal(address indexed _owner, uint256 _value);
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function transfer(address _to, uint256 _value) returns (bool success) {
if (balances[msg.sender] < _value) throw;
if (!safeToAdd(balances[_to], _value)) throw;
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balances[_from] < _value) throw;
if (allowed[_from][msg.sender] < _value) throw;
if (!safeToAdd(balances[_to], _value)) throw;
allowed[_from][msg.sender] -= _value;
balances[_from] -= _value;
balances[_to] += _value;
Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function totalSupply() constant returns (uint256 supply) {
return this.balance;
}
function withdraw(uint256 _value) returns (bool success) {
if (balances[msg.sender] >= _value) {
if (msg.sender.call.value(_value)()) {
balances[msg.sender] -= _value;
Withdrawal(msg.sender, _value);
return true;
}
}
}
function deposit() returns (bool success) {
balances[msg.sender] += msg.value;
Deposit(msg.sender, msg.value);
return true;
}
function () returns (bool success) {
return deposit();
}
function safeToAdd(uint a, uint b) internal returns (bool) {
return (a + b >= a);
}
}External Links
Related contracts
Contract 0xd654bd...7e9179
Same deployerThe ether wrapper code of 0xacFD9D15fA769EaBb68410c4c675Ff2030f26416, the first fully EIP-20 compliant contract, redeployed 81 blocks later. This is the copy that saw real use, with around 400 transactions.
0xd654bd...7e9179March 20, 2016token
Same eraBare Homestead-era token (Mar 14 2016): public balanceOf mapping + a single unchecked transfer firing the standard Transfer event.
0xc77f06...494c69March 14, 2016DinastyCoinToken
Same eraHomestead-era transfer-only token, DinastyCoinToken (DCT), fixed supply 200000000 and 6 decimals.
0x3693fd...c11466March 14, 2016token
Same eraMinimal Homestead-era token shell (Mar 14 2016): just a public balanceOf mapping and its compiler-generated getter, with no other functions.
0x38e1da...41a81aMarch 14, 2016666๐
Same eraSix hundred and sixty six units, named and ticketed with a ram emoji.
0x7684aa...d0ed06March 16, 2016CampusCoin
Same eraByte-identical deployment of: Standard ethereum.org tutorial token (Homestead, Mar 2016): name/symbol/decimals metadata, a public balanceOf mapping and an overf
0x00f0b1...e6fcd2March 16, 2016