A 180 byte proxy that verifies its implementation has code before delegating, and returns a fixed 4096 byte window of the result.
Historical Significance
Shares its exact shape with another family, differing only in the implementation address. Both date from before RETURNDATASIZE was available to proxies, when the size of a return had to be guessed in advance, and both answer that by reserving a flat window large enough for anything they expected to carry.
Key Facts
Description
An internal helper takes the hardcoded implementation and the calldata. A Yul switch on extcodesize rejects an implementation with no code, which is necessary because a delegatecall to an empty address returns success and would make every call look like it worked.
The delegatecall forwards all gas minus ten thousand and requests a fixed 4096 byte return window rather than using returndatasize. A second switch on the result reverts through the invalid opcode on failure and returns the whole fixed window on success.
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 Proxy {
function () public payable {
forward(0x6676F9a4bE165DAa756816f3234D5E019032728e, msg.data);
}
function forward(address _target, bytes _data) internal {
assembly {
switch extcodesize(_target)
case 0 { revert(0, 0) }
let ret := 0x1000
let result := delegatecall(sub(gas, 10000), _target, add(_data, 0x20), mload(_data), 0, ret)
switch result
case 0 { invalid() }
return(0, ret)
}
}
}