The dapp-bin standardized currency API, with one slot the code never touches
Context
Frontier and Homestead era deployment.
Key Facts
Description
Ethereum's dapp-bin repository published a set of standardized contract APIs, and this is its currency: balances held in an Account struct, sendCoin and sendCoinFrom, an approval mapping named withdrawers, and a CoinSent event. The deployment differs from the published file in one respect. A second 32-byte member sits inside Account between balance and withdrawers, shifting every withdrawers access from offset one to offset two. Nothing reads or writes it, so the runtime is the same length as the original and differs only in those seven nibbles. The name is the upstream file's. The deployed code is consistent with it: the function currency() is the constructor and never reaches the dispatcher, so the contract was not renamed while its constructor kept the old name, which is the way such a rename usually announces itself.
Source Verified
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
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract currency {
struct Account {
uint balance;
uint spent;
mapping ( address => uint) withdrawers;
}
mapping ( address => Account ) accounts;
event CoinSent(address indexed from, uint256 value, address indexed to);
function currency() {
accounts[msg.sender].balance = 1000000;
}
function sendCoin(uint _value, address _to) returns (bool _success) {
if (accounts[msg.sender].balance >= _value && _value < 340282366920938463463374607431768211456) {
accounts[msg.sender].balance -= _value;
accounts[_to].balance += _value;
CoinSent(msg.sender, _value, _to);
_success = true;
}
else _success = false;
}
function sendCoinFrom(address _from, uint _value, address _to) returns (bool _success) {
uint auth = accounts[_from].withdrawers[msg.sender];
if (accounts[_from].balance >= _value && auth >= _value && _value < 340282366920938463463374607431768211456) {
accounts[_from].withdrawers[msg.sender] -= _value;
accounts[_from].balance -= _value;
accounts[_to].balance += _value;
CoinSent(_from, _value, _to);
_success = true;
_success = true;
}
else _success = false;
}
function coinBalance() constant returns (uint _r) {
_r = accounts[msg.sender].balance;
}
function coinBalanceOf(address _addr) constant returns (uint _r) {
_r = accounts[_addr].balance;
}
function approve(address _addr) {
accounts[msg.sender].withdrawers[_addr] = 340282366920938463463374607431768211456;
}
function isApproved(address _proxy) returns (bool _r) {
_r = (accounts[msg.sender].withdrawers[_proxy] > 0);
}
function approveOnce(address _addr, uint256 _maxValue) {
accounts[msg.sender].withdrawers[_addr] += _maxValue;
}
function isApprovedOnceFor(address _target, address _proxy) returns (uint256 _r) {
_r = accounts[_target].withdrawers[_proxy];
}
function disapprove(address _addr) {
accounts[msg.sender].withdrawers[_addr] = 0;
}
}External Links
Related contracts
SimpleStorage
Same deployerThe canonical SimpleStorage example from the Solidity documentation: one uint in storage, with set() and get().
0x7b4dd5...0c87e8October 5, 2015SimpleStorage
Same deployerThe canonical SimpleStorage example from the Solidity documentation: one uint in storage, with set() and get().
0x099d14...bcb8efOctober 5, 2015SimpleStorage
Same deployerThe canonical SimpleStorage example from the Solidity documentation: one uint in storage, with set() and get().
0xba4ce2...14027fOctober 5, 2015SimpleStorage
Same deployerThe canonical SimpleStorage example from the Solidity documentation: one uint in storage, with set() and get().
0x4c70da...170399October 5, 2015SimpleStorage
Same deployerThe canonical SimpleStorage example from the Solidity documentation: one uint in storage, with set() and get().
0x70efcf...1bfa68October 5, 2015SimpleStorage
Same deployerThe canonical SimpleStorage example from the Solidity documentation: one uint in storage, with set() and get().
0x3bb4cc...77eeb4October 5, 2015