/** * Copyright 2017–2019, LaborX PTY * Licensed under the AGPL Version 3 license. */ pragma solidity ^0.4.25; import "./Delegatable.sol"; /// @title Proxy /// @notice Implements delegation of calls to other contracts, with proper /// forwarding of return values and bubbling of failures. /// It defines a fallback function that delegates all calls to the address /// returned by the abstract _implementation() internal function. contract Proxy is Delegatable { /// @notice Fallback function. /// Implemented entirely in `_fallback`. function () external payable { _fallback(); } /// @return The Address of the implementation. function _implementation() internal view returns (address); /// @dev Function that is run as the first thing in the fallback function. /// Can be redefined in derived contracts to add functionality. /// Redefinitions must call super._willFallback(). function _willFallback() internal { } /// @dev fallback implementation. /// Extracted to enable manual triggering. function _fallback() internal { _willFallback(); _delegate(_implementation()); } }