2016 token sweeper wallet that forwards its DAO token balance to its creator.
Historical Significance
Written in Solidity 0.3.6, before the language had a payable keyword, so every function, including the fallback, accepted ether implicitly, and errors were raised with throw, which burned all remaining gas. Returning an integer status code instead of a boolean is a habit from that era, when the compiler's boolean handling was still settling. The auto-sweeping fallback let an operator empty a deposit wallet with a plain zero-value transaction, no ABI encoding required.
Key Facts
Description
A per-holder sweeper wallet from 2016, deployed by a factory that passed the token contract address to the constructor. The owner is fixed to whoever deployed it. balance() reads the wallet's token balance from the token contract, and the wallet can be emptied two ways: calling sweep(), which only the owner may do, or simply sending it a transaction with no calldata, in which case the fallback sweeps automatically and throws if the token transfer fails. sweep() reports a numeric status code and the amount moved rather than a boolean. Compiled with Solidity 0.3.6 with the optimizer on; the bytecode carries no metadata trailer, so this is an exact match rather than a partial one.
Source Verified
Homestead Era
The first planned hard fork. Removed the canary contract, adjusted gas costs.
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 Token {
function balanceOf(address _owner) constant returns (uint256);
function transfer(address _to, uint256 _value) returns (bool);
}
contract Wallet {
address public owner;
Token public tokenContract;
function Wallet(address _tokenContract) {
owner = msg.sender;
tokenContract = Token(_tokenContract);
}
function balance() constant returns (uint256) {
return tokenContract.balanceOf(this);
}
function () {
uint256 amount = balance();
if (!tokenContract.transfer(owner, amount)) throw;
}
function sweep() returns (uint256 success, uint256 amount) {
if (msg.sender != owner) throw;
amount = balance();
if (tokenContract.transfer(owner, amount)) {
success = 1;
} else {
success = 0;
}
}
}