Per-user deposit wallet from June 2018 whose sweep(token, to, amount) can move ether or any token to a caller-chosen address, if the controller lists the caller as a sweeper.
Historical Significance
Shows how the Bittrex deposit wallet design spread and mutated during 2018. The shape survives intact, with a thin per-user wallet, a central controller and sweep plus tokenFallback as the interface, but the operator moved the choice of destination from the controller to each sweep call. That makes every approved sweeper key able to send any customer deposit anywhere, which is a real change in who has to be trusted, made with only a few lines of code.
Key Facts
Description
A deposit wallet in the style of the NewAlchemy UserWallet used by Bittrex, rewritten around a different trust model. The wallet stores only the address of a controller. The controller keeps a list of approved sweepers, managed through addSweeper, and the wallet asks it isSweeper(msg.sender) before doing anything.
sweep(address token, address to, uint256 amount) is the only real function. If the token address is zero it checks that the wallet holds at least the requested amount of ether and sends it to the given address; otherwise it checks the token balance with balanceOf and calls transfer. A short balance returns false instead of reverting, and so does a call from anyone who is not a sweeper. Unlike the NewAlchemy design, the destination is an argument chosen by the sweeper for each call rather than a single address held by the controller. The wallet also accepts ether through a payable fallback and implements an empty tokenFallback so ERC223 token transfers do not bounce.
The first copy was deployed in June 2018 as a test, and the operator later ran production deployments through a factory account. The source was compiled with solc 0.4.21 with the optimizer on at 200 runs. The runtime code matches the deployed bytecode; only the trailing swarm metadata hash differs, because the EthereumHistory attribution comment changes the source text. Sourcify records this as a partial match and Etherscan shows it as verified.
Source Verified
Historian Categories
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Byzantium Era
First Metropolis hard fork. Added zk-SNARK precompiles, REVERT opcode, and staticcall.
Bytecode Overview
Verified Source Available
This contract has verified source code.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
pragma solidity ^0.4.18;
contract Controller {
function isSweeper(address _sweeper) public view returns (bool);
}
contract Token {
function balanceOf(address _owner) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract UserWallet {
Controller controller;
function () public payable {}
function sweep(address _token, address _to, uint256 _amount) public returns (bool) {
if (controller.isSweeper(msg.sender)) {
bool success = false;
if (_token != address(0)) {
Token token = Token(_token);
if (_amount > token.balanceOf(this)) {
return false;
}
success = token.transfer(_to, _amount);
} else {
uint256 amountInWei = _amount;
if (amountInWei > this.balance) {
return false;
}
success = _to.send(amountInWei);
}
return success;
}
}
function tokenFallback(address _from, uint256 _value, bytes _data) public {}
}External Links
Related contracts
BankWallet
Same eraProxy wallet that forwards received ETH to a configured bank address. Owner can sweep ETH and ERC-20 token balances to that same destination.
0x449ad8...17a931November 14, 2017Contract 0xb3c5f3...9a2462
Same eraMinimal delegatecall proxy. Forwards all calls to a hardcoded implementation address using DELEGATECALL, preserving the caller's storage context.
0xb3c5f3...9a2462January 4, 2018UserWallet
Same eraExchange deposit wallet with ETH and ERC20 sweep functions. One of the most widely deployed bytecodes on Ethereum.
0x24eb88...a068a7January 4, 2018Contract 0x493bbd...50d3bb
Same eraToken sweeper contract. Collects ERC20 balances from deposit addresses by calling sweep(tokenAddress) and forwarding tokens to a master wallet.
0x493bbd...50d3bbJanuary 4, 2018Contract 0x5d200d...52b7fa
Same eraETH forwarder with configurable destination. Forwards incoming Ether to a parent address set at deployment, with an owner-only flush() method.
0x5d200d...52b7faJanuary 4, 2018Contract 0x600719...e09409
Same eraMinimal ETH forwarder. Hardcodes a destination address at deployment and unconditionally forwards all incoming Ether to it.
0x600719...e09409January 7, 2018