Payment forwarder that sends incoming ether to a stored destination and reports the payment to an Augur style factory that owns the event log.
Key Facts
Description
Two storage values: a factory and a destination, both readable. The payable fallback transfers the whole incoming value to the destination and then calls emitLogPaymentForwarded on the factory with the sender, this contract and the amount, so the log entry is emitted by the factory rather than by the forwarder.
transferToken asks the factory for its owner and requires the caller to match before moving an ERC20 balance to any address. The forwarder itself holds no owner field, which means rotating control happens on the factory and every forwarder follows.
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 on Etherscan.
Show source code (Solidity)
{{
"language": "Solidity",
"sources": {
"Forwarder.sol": {
"content": "// Submitted by EthereumHistory (ethereumhistory.com)\npragma solidity ^0.4.20;\n\ncontract Factory {\n function owner() public returns (address);\n function emitLogPaymentForwarded(address _from, address _to, uint256 _amount) public;\n}\n\ncontract ERC20 {\n function transfer(address _to, uint256 _value) public returns (bool);\n}\n\ncontract Forwarder {\n Factory public factory;\n address public destination;\n\n function () public payable {\n destination.transfer(msg.value);\n factory.emitLogPaymentForwarded(msg.sender, this, msg.value);\n }\n\n function transferToken(address _token, address _to, uint256 _amount) public {\n require(msg.sender == factory.owner());\n ERC20 token = ERC20(_token);\n token.transfer(_to, _amount);\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 1
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}}