pragma solidity ^0.5.16; // solhint-disable payable-fallback /// a variant of ReadProxy.sol that's not Owned, and so has an immutable target /// that can be used e.g. to read a oracle feed, and provide its interface, but from a /// different address contract ImmutableReadProxy { address public target; constructor(address _target) public { target = _target; } function() external { // The basics of a proxy read call // Note that msg.sender in the underlying will always be the address of this contract. assembly { calldatacopy(0, 0, calldatasize) // Use of staticcall - this will revert if the underlying function mutates state let result := staticcall(gas, sload(target_slot), 0, calldatasize, 0, 0) returndatacopy(0, 0, returndatasize) if iszero(result) { revert(0, returndatasize) } return(0, returndatasize) } } }