Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Read Proxy
Write Contract
Write Proxy
Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB 0x0b5dd794f0cc0a0e5b4cd7c76a3026e22a181031.
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
Verify & Publish
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
- Contract name:
- UpgradeabilityProxy
- Optimization enabled
- false
- Compiler version
- v0.7.6+commit.7338295f
- Verified at
- 2022-10-25T14:32:04.274427Z
Contract source code
// Sources flattened with hardhat v2.7.0 https://hardhat.org // File @openzeppelin/contracts/math/SafeMath.sol@v3.4.2 pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // File @openzeppelin/contracts/utils/Address.sol@v3.4.2 pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File contracts/UpgradeabilityProxy.sol pragma solidity ^0.7.0; contract UpgradeabilityProxy { using SafeMath for uint; bytes32 private constant proxyOwnerPosition = keccak256("proxy.owner"); bytes32 private constant newProxyOwnerPosition = keccak256("proxy.newOwner"); bytes32 private constant implementationPosition = keccak256("proxy.implementation"); bytes32 private constant newImplementationPosition = keccak256("proxy.newImplementation"); bytes32 private constant timelockPosition = keccak256("proxy.timelock"); uint public constant timelockPeriod = 21600; constructor (address _proxyOwner, address _implementation, bytes memory initializationData, bool forceCall) { _setProxyOwner(_proxyOwner); _setImplementation(_implementation); if (initializationData.length > 0 || forceCall) { Address.functionDelegateCall(implementation(), initializationData); } } function proxyOwner() public view returns (address _proxyOwner) { bytes32 position = proxyOwnerPosition; assembly { _proxyOwner := sload(position) } } function newProxyOwner() public view returns (address _newProxyOwner) { bytes32 position = newProxyOwnerPosition; assembly { _newProxyOwner := sload(position) } } function _setProxyOwner(address _newProxyOwner) private { bytes32 position = proxyOwnerPosition; assembly { sstore(position, _newProxyOwner) } } function setNewProxyOwner(address _newProxyOwner) public { require(msg.sender == proxyOwner(), "UpgradeabilityProxy: only current proxy owner can set new proxy owner."); bytes32 position = newProxyOwnerPosition; assembly { sstore(position, _newProxyOwner) } } function transferProxyOwnership() public { address _newProxyOwner = newProxyOwner(); require(msg.sender == _newProxyOwner, "UpgradeabilityProxy: only new owner can transfer ownership."); _setProxyOwner(_newProxyOwner); } function implementation() public view returns (address _implementation) { bytes32 position = implementationPosition; assembly { _implementation := sload(position) } } function newImplementation() public view returns (address _newImplementation) { bytes32 position = newImplementationPosition; assembly { _newImplementation := sload(position) } } function timelock() public view returns (uint _timelock) { bytes32 position = timelockPosition; assembly { _timelock := sload(position) } } function _setTimelock(uint newTimelock) private { bytes32 position = timelockPosition; assembly { sstore(position, newTimelock) } } function _setImplementation(address _newImplementation) private { bytes32 position = implementationPosition; assembly { sstore(position, _newImplementation) } } function setNewImplementation(address _newImplementation) public { require(msg.sender == proxyOwner(), "UpgradeabilityProxy: only current proxy owner can set new implementation."); bytes32 position = newImplementationPosition; assembly { sstore(position, _newImplementation) } uint newTimelock = block.timestamp.add(timelockPeriod); _setTimelock(newTimelock); } function transferImplementation() public { require(msg.sender == proxyOwner(), "UpgradeabilityProxy: only proxy owner can transfer implementation."); require(block.timestamp >= timelock(), "UpgradeabilityProxy: cannot transfer implementation yet."); _setImplementation(newImplementation()); } function _delegate(address _implementation) internal virtual { assembly { calldatacopy(0, 0, calldatasize()) let result := delegatecall(gas(), _implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } fallback () external payable virtual { _delegate(implementation()); } receive () external payable virtual { _delegate(implementation()); } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_proxyOwner","internalType":"address"},{"type":"address","name":"_implementation","internalType":"address"},{"type":"bytes","name":"initializationData","internalType":"bytes"},{"type":"bool","name":"forceCall","internalType":"bool"}]},{"type":"fallback","stateMutability":"payable"},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"_implementation","internalType":"address"}],"name":"implementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"_newImplementation","internalType":"address"}],"name":"newImplementation","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"_newProxyOwner","internalType":"address"}],"name":"newProxyOwner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"_proxyOwner","internalType":"address"}],"name":"proxyOwner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNewImplementation","inputs":[{"type":"address","name":"_newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNewProxyOwner","inputs":[{"type":"address","name":"_newProxyOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"_timelock","internalType":"uint256"}],"name":"timelock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"timelockPeriod","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferImplementation","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferProxyOwnership","inputs":[]},{"type":"receive","stateMutability":"payable"}]
Deployed ByteCode
0x6080604052600436106100955760003560e01c806381ac16591161005957806381ac1659146101d357806387b27951146102145780638b677b031461022b578063adb3ce921461026c578063d33219b4146102bd576100ac565b8063025313a2146100be57806310776181146100ff5780632ecaf675146101505780632fa8ad531461017b5780635c60da1b14610192576100ac565b366100ac576100aa6100a56102e8565b610316565b005b6100bc6100b76102e8565b610316565b005b3480156100ca57600080fd5b506100d361033c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561010b57600080fd5b5061014e6004803603602081101561012257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061036a565b005b34801561015c57600080fd5b50610165610421565b6040518082815260200191505060405180910390f35b34801561018757600080fd5b50610190610427565b005b34801561019e57600080fd5b506101a76102e8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101df57600080fd5b506101e86104c3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561022057600080fd5b506102296104f1565b005b34801561023757600080fd5b506102406105ee565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561027857600080fd5b506102bb6004803603602081101561028f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061061c565b005b3480156102c957600080fd5b506102d26106f6565b6040518082815260200191505060405180910390f35b6000807f24ed44ee9374370fd3aa7c8b1abf58827504c20f65246b17d2b9e7e1aef778479050805491505090565b3660008037600080366000845af43d6000803e8060008114610337573d6000f35b3d6000fd5b6000807f58a6b8f109ed5c70ad37140473420d0209511d3629dc7480eab94a450067bd5f9050805491505090565b61037261033c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103f5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526046815260200180610a6b6046913960600191505060405180910390fd5b60007f089a30daf7a7609a193f76c173c735bdd3fb300b4d9b7c61ea0c4395e0b20cf690508181555050565b61546081565b60006104316104c3565b90508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b815260200180610afe603b913960400191505060405180910390fd5b6104c081610751565b50565b6000807f089a30daf7a7609a193f76c173c735bdd3fb300b4d9b7c61ea0c4395e0b20cf69050805491505090565b6104f961033c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461057c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526042815260200180610bba6042913960600191505060405180910390fd5b6105846106f6565b4210156105dc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180610b826038913960400191505060405180910390fd5b6105ec6105e76105ee565b61077d565b565b6000807f762ff5225469654ad30beda02ad3106fbdd38c4bff827c9426bf649d95ed7e1d9050805491505090565b61062461033c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106a7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526049815260200180610b396049913960600191505060405180910390fd5b60007f762ff5225469654ad30beda02ad3106fbdd38c4bff827c9426bf649d95ed7e1d905081815560006106e6615460426107a990919063ffffffff16565b90506106f181610831565b505050565b6000807fbc70700c0bb41e729f3b16a22511bc61a02ceaa6d1f98256bf8f5df4fa51e7a99050805491505090565b60606107498383604051806060016040528060278152602001610ab16027913961085d565b905092915050565b60007f58a6b8f109ed5c70ad37140473420d0209511d3629dc7480eab94a450067bd5f90508181555050565b60007f24ed44ee9374370fd3aa7c8b1abf58827504c20f65246b17d2b9e7e1aef7784790508181555050565b600080828401905083811015610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60007fbc70700c0bb41e729f3b16a22511bc61a02ceaa6d1f98256bf8f5df4fa51e7a990508181555050565b60606108688461098b565b6108bd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610ad86026913960400191505060405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16856040518082805190602001908083835b6020831061090b57805182526020820191506020810190506020830392506108e8565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461096b576040519150601f19603f3d011682016040523d82523d6000602084013e610970565b606091505b509150915061098082828661099e565b925050509392505050565b600080823b905060008111915050919050565b606083156109ae57829050610a63565b6000835111156109c15782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a28578082015181840152602081019050610a0d565b50505050905090810190601f168015610a555780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b939250505056fe557067726164656162696c69747950726f78793a206f6e6c792063757272656e742070726f7879206f776e65722063616e20736574206e65772070726f7879206f776e65722e416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374557067726164656162696c69747950726f78793a206f6e6c79206e6577206f776e65722063616e207472616e73666572206f776e6572736869702e557067726164656162696c69747950726f78793a206f6e6c792063757272656e742070726f7879206f776e65722063616e20736574206e657720696d706c656d656e746174696f6e2e557067726164656162696c69747950726f78793a2063616e6e6f74207472616e7366657220696d706c656d656e746174696f6e207965742e557067726164656162696c69747950726f78793a206f6e6c792070726f7879206f776e65722063616e207472616e7366657220696d706c656d656e746174696f6e2ea2646970667358221220aa86e7a3ae0db39245e225e7068b658c6bc013b51acc7203d49848393fc4865e64736f6c63430007060033