Deposit forwarder that reports each payment to its controller, reads the payout address from it, and forwards the full amount there.
Historical Significance
The same system as its sibling family with one fewer piece of information crossing the boundary: this controller is told only the amount, not who sent it, and the deposit address is expected to have been handed to a known customer already. Comparing the two interfaces shows an operator deciding how much attribution work belongs on chain and how much belongs in their own records.
Key Facts
Description
A close relative of the larger controller-driven forwarder, with a smaller controller interface. The payable fallback calls accept on the controller with the incoming value, reads getDestination, transfers the whole payment to that address and emits Forwarded with the sender, this contract, the destination, the value and the raw calldata.
flushTokens sweeps an ERC20 balance to the same destination and flush moves stranded ether. The controller reference is held privately with no getter, so the only way to learn which controller a given deposit address trusts is to read its storage directly.
Source Verified
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 accept(uint256 _value) public;
function getDestination() public returns (address);
}
contract ERC20 {
function balanceOf(address _owner) public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract Forwarder {
Controller controller;
event Forwarded(address from, address to, address destination, uint256 value, bytes data);
function () public payable {
controller.accept(msg.value);
address dest = controller.getDestination();
dest.transfer(msg.value);
Forwarded(msg.sender, this, dest, msg.value, msg.data);
}
function flushTokens(address _token) public {
ERC20 token = ERC20(_token);
uint256 bal = token.balanceOf(this);
address dest = controller.getDestination();
if (bal > 0) {
token.transfer(dest, bal);
}
}
function flush() public {
address dest = controller.getDestination();
dest.transfer(this.balance);
}
}